IP
Internet Protocol
- Addressing hosts
- Encapsulating data
- Global routing capability
- Determined by the use of a subnet mask
- Connectionless, best-effort
- TCP vs UDP
Understanding IP
- Address
- Ex: 10.1.1.5
- Subnet mask
- What if we want to send a transmission to a host of 10.1.2.5, is that on my local network or is that on a different network?
- It depend on the subnet mask.
- The subnet mask lets us know where a network begins and ends, and it lets us determine which of the IP address, which portions of it, which bits, out host bits versus network bits.
- Ex: 255.255.255.0
- Sometimes abbreviated as a /24 (24 contiguous ones in binary)
- The first octet, the second octet and the third octet in their entirety are used for network bits, and the last octet is used for host bits.
- Network address
- Ex: 10.1.1.0
- It's something that we would see in a routing table, the first host is typically .1, the last host in a range like this is gonna be 254.
- Ex: 10.1.1.0
- Broadcast address
- Layer 2 broadcast address is gonna be all Fs, because in layer 2 MAC addresses are the main language.
- Layer 3 broadcast depends on if it is directed broadcast, or a general broadcast.
- General broadcast is gonna be 255.255.255.255, this is called "shouting" to a layer 3 destination
- There is also an specific network broadcast address, in this example it would be 10.1.1.255. Targeting this address is also called a directed broadcast.
- This is a host, that is reserved and it's not gonna be assigned to an endpoint, this represents all hosts, this is how we talk to all hosts within the 10.1.1.0 network.
Routing Table
When we do ipconfig on a Windows DOS prompt we get:
Ethernet adapter Ethernet 2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::8424:d364:766:b75e%19
IPv4 Address. . . . . . . . . . . : 10.119.41.246
Subnet Mask . . . . . . . . . . . : 255.255.254.0
Default Gateway . . . . . . . . . : 10.119.40.1
...
- This command list all network interfaces both physical and virtual.
The route print command on Windows DOS will print your routing table.
netstat -ris an altarnate command for this same function (works on MacOS and Linux).
C:\Users\mxmarin18>route print
===========================================================================
Interface List
19...38 14 28 a2 83 f4 ......Realtek USB GbE Family Controller #2
11...48 51 c5 21 fc 5f ......Intel(R) Wi-Fi 6 AX201 160MHz
4...48 51 c5 21 fc 60 ......Microsoft Wi-Fi Direct Virtual Adapter
5...4a 51 c5 21 fc 5f ......Microsoft Wi-Fi Direct Virtual Adapter #2
9...48 51 c5 21 fc 63 ......Bluetooth Device (Personal Area Network)
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.119.40.1 10.119.41.246 25
10.119.40.0 255.255.254.0 On-link 10.119.41.246 281
10.119.41.246 255.255.255.255 On-link 10.119.41.246 281
10.119.41.255 255.255.255.255 On-link 10.119.41.246 281
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 10.119.41.246 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 331
255.255.255.255 255.255.255.255 On-link 10.119.41.246 281
===========================================================================
Persistent Routes:
None
IPv6 Route Table
===========================================================================
Active Routes:
If Metric Network Destination Gateway
1 331 ::1/128 On-link
19 281 fe80::/64 On-link
19 281 fe80::8424:d364:766:b75e/128
On-link
1 331 ff00::/8 On-link
19 281 ff00::/8 On-link
===========================================================================
Persistent Routes:
None
Interface List
- The interface list has got interface identifiers for each of our network interfaces
- Here is where you can identify your NIC, WiFi card/adapter, Virtual Ethernet Adapters, and the Software Loopback Interface, which is just a logical interface that each system has and has the identifier 1.
- Format:
ID...MAC-Address......Name-of-device.
Route Table
- The least specific route in the universe is 0.0.0.0, also called the gateway of last resort or the default route.
- This is a
/0 - Zero bits have to match in order to use this exit.
- This is a
- For example if we look at
10.119.41.246 255.255.255.255(Destination/Netmask)- Do I know how to get to 10.119.41.246? YES that's me!, that /32 means that host is here.
- A directed Broadcast would look something like this:
10.119.41.255. 255.255.255.255 - For example on
224.0.0.0 24.0.0.0.(Destination/Netmask) Everything from 224 to 240 is gonna be multicast - For Broadcast we would look at something like
255.255.255.255 255.255.255.255