Networking 101
Copyright Priscilla Oppenheimer
Study Topics 4
Network Layer
IP Addresses
Size of an IP addresses
- With IP version 4 (IPv4), each interface has a 32-bit address.
- With IP version 6 (IPv6), each interface has a 128-bit address.
IPv4 addresses are broken into four 8-bit bytes (octets) that are separated by dots. This is called dotted decimal notation.
Converting between binary and IPv4 dotted decimal notation addresses:
- 00001010 00000010 00000000 00100101 = 10.2.0.37
- 10101100 00010000 00001010 00000001 = 172.16.10.1
- 10000001 00110100 00000110 00000001 = 129.52.6.1
Components of an IP address
- Two parts of an IP address: Network (prefix) and Host (suffix).
- The Network part says what network the host is on.
- The Host part specifies a unique host (interface).
An IP address is accompanied by an indication of the prefix length (Subnet mask or /length in CIDR notation).
- The subnet mask specifies which part of an IP address is the Network field and which part is the Host field.
- The Network portion of the mask is all 1s in binary.
- The Host portion of the mask is all 0s in binary.
- Convert the binary expression back to dotted decimal notation for entering into configurations.
- Sometimes the mask is written as /length.
Examples
- 255.255.255.0 is the same as /24
- 255.255.255.192 is the same as /26
Reserved IP addresses
The Network: To refer to the entire network (in documentation or routing tables, for example) use all zeros in the Host portion of the address.
Example: 192.168.70.0/24 (or 192.168.70.0 255.255.255.0) might appear on a network drawing or in a router's routing table and means the entire 192.168.70.0 network.
Broadcast: Devices can send to all hosts on their network by using all ones in the Host portion of the address.
If host 192.168.70.1/24 wants to send to everyone on its LAN, for example, it sends to 192.168.70.255.
Private IP addresses
Not routable on the Internet; great for internal networks, however.
If you use private addresses on hosts that need to reach the Internet, then you need a device that performs Network Address Translation (NAT).
Private Address ranges:
- 10.0.0.0 to 10.255.255.255
- 172.16.0.0 to 172.31.255.255
- 192.168.0.0 to 192.168.255.255
Microsoft's Automatic Private IP Addressing:
- 169.254.0.0 - 169.254.255.255
The main thing to know about the Microsoft private addresses is that they usually appear when a host has been configured to get its address from DHCP but has failed to reach the DHCP server (so the host makes up a private Microsoft address).
Subnetting
A network administrator can borrow bits from the original Host portion of the address space to divide a network into subnets. The subnet mask (or /length), in this case, specifies how many bits are used for Network/subnet and how many are used for Host IDs.
Working with IP Addresses and Subnet Masks
If the prefix length is a multiple of 8 (8, 16, or 24), working with addresses and subnet masks is easy.
Example: Network is 172.16.0.0 with a starting subnet mask of 255.255.0.0 (or /16).
- We want to divide the network into 254 subnets, each with 254 hosts.
- A subnet mask of 255.255.255.0 works well for this.
- The subnets would be: 172.16.1.0 - 172.16.254.0
- The first host on the first subnet is 172.16.1.1.
- The first host can send to all devices on its subnet by sending to 172.16.1.255 (broadcast).
However, network administrators need the flexibility of using any number of bits for Network/subnet versus Host. When the number of bits used for these fields isn't a multiple of 8, it's advisable to work with the numbers in binary before putting them into dotted decimal notation.
It's important to be able to tell what subnet you are on based on the subnet mask.
Example: 197.15.22.131 with a subnet mask of 255.255.255.224
- Means host 3 on subnet 197.15.22.128
- Put the final digit in binary to understand this
- 131 = 10000011
- The numbers in bold are part of the Network/subnet because the mask is 255.255.255.224 (or /27)
- 27 bits are used for Network/subnet.
- 5 bits are used for Host IDs.
It's also important to recognize a broadcast address.To send to all devices on its subnet, host 197.15.22.131 should send to:
- 197.15.22. followed by 10011111 in binary, which is 159 in decimal.
- So the broadcast address for this subnet is 197.15.22.159.
Designing subnets
Be prepared to write out the following to help you with questions related to designing IP subnets:
210 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
1024 |
512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
Binary |
Decimal |
1000 0000 |
128 |
1100 0000 |
192 |
1110 0000 |
224 |
1111 0000 |
240 |
1111 1000 |
248 |
1111 1100 |
252 |
1111 1110 |
254 |
1111 1111 |
255 |
Example: Network is 172.16.0.0 with a starting subnet mask of 255.255.0.0.
- You want to divide the network into subnets.
- You will allow 600 hosts per subnet.
- What subnet mask should you use?
Notice that 600 falls between 29 and 210 in the first chart. To accommodate all those hosts, we better use 210 or 1024. In other words, we will use 10 bits to uniquely identify each host on each subnet.
- So the subnet mask is 255.255 followed by 11111100 00000000 in binary.
- Notice that there are 10 zeroes in the subnet mask, which is what we need.
- Use the second chart to recognize that this is 255.255.252.0 in dotted decimal notation.
Another example: Network is 192.168.55.0 with a starting subnet mask of 255.255.255.0.
- You want to divide the network into subnets.
- You will have approximately 25 hosts per subnet.
- What subnet mask should you use?
How many bits are needed to uniquely identify 25 hosts? The answer is 5 because 25 is 32. (Notice that 24 wouldn't be enough).
- So the subnet mask is 255.255.255 followed by 11100000 in binary.
- Notice that there are 5 zeroes in the subnet mask, which is what we need.
- The subnet mask is 255.255.255.224 in dotted decimal notation.
Address Resolution Protocol (ARP)
- Used by a host to learn the MAC address of another host to which it wishes to send a packet.
- The host sends a broadcast that asks the question, "Who has this IP address? What is your MAC address?"
- The host with the IP address in the question responds with its MAC address.
Dynamic Host Configuration Protocol
- DHCP allows a host to obtain an IP address dynamically without the network administrator's having to set up an individual address on each machine.
- Requires the network administrator to configure a DHCP server.
Routing Fundamentals
Routed versus Routing
A routed protocol:
- Includes any network protocol that provides enough information in its Network Layer address to allow a router to forward a packet to the next device and ultimately to its destination.
- Defines the format and use of the fields within a packet.
- IP is a routed protocol, for example.
A routing protocol:
- Provides processes for routers to share route information.
- Allows routers to communicate with other routers to update and maintain routing tables.
- OSPF is a routing protocol, for example.
Interior versus Exterior Routing Protocols
- Interior routing protocols are used within an autonomous system.
- Exterior routing protocols are used between autonomous systems.
- (Autonomous system definition from textbooks: "a network or set of networks that are under the administrative control of a single entity")
Routing Protocol Metrics
A router can learn multiple paths to a remote network. The routing protocol metric lets the router decide which path is best.
Examples of metrics:
- Bandwidth - capacity
- Delay - time
- Load - amount of network traffic
- Reliability - error rate
- Hop count - number of routers that a packet must travel through before reaching the destination network
- Cost - arbitrary value defined by the protocol or administrator
Distance Vector versus Link-State Routing Protocols
Distance-Vector Routing Protocols
- Router maintains a routing table that lists known networks, direction (vector) to each network, and the distance to each network. (The meaning of "distance" is based on the routing protocol metric.)
- Router periodically (every 30 seconds, for example) transmits the routing table via a broadcast packet that reaches all other routers on the local segments. (To conserve bandwidth, some advanced distance-vector protocols don't send periodically but, rather, only when there is a change.)
- Router updates the routing table, if necessary, based on received broadcasts.
- If router receives information about a new route to a network, the router determines if the advertising router has a shorter path. If it does, this router updates its table to say that packets should be sent in the direction of the advertising router. ("Shorter" is defined by the metric.)
Link-State Routing Protocols
- Routers send updates only when a link changes state
- Neighbors propagate the change to their neighbors
- Routers update their database if necessary
- Link-state algorithms keep a database of routers and links between them.
- Link-state algorithms think of the internetwork as a graph instead of a list.
- When changes occur, link-state algorithms apply Dijkstra’s shortest-path algorithm to find the shortest path between any two nodes.
- Unlike distance-vector protocols, a simple comparison of distance isn't sufficient. The router must run the shortest-path algorithm, which can be CPU-intensive.
Back to Networking 101