One key characteristic of IPv4 is fragmentation and reassembly. Although the maximum length of an IP packet is 65,535 bytes, most of the common lower-layer protocols do not support such large MTUs. For example, the MTU for Ethernet is approximately 1518 bytes. When the IP layer receives a packet to send, it first queries the outgoing interface to get its MTU. If the packet’s size is greater than the interface’s MTU, the layer fragments the packet.
When a packet is fragmented, it is not reassembled until it reaches the destination IP layer. The destination IP layer performs the reassembly. Any router in the path can fragment a packet, and any router in the path can fragment a fragmented packet again. Each fragmented packet receives its own IP header and identifier, and it is routed independently from other packets. Routers and Layer 3 switches in the path do not reassemble the fragments. The destination host performs the reassembly and places the fragments in the correct order by looking at the Identification and Fragment Offset fields.
If one or more fragments are lost, the entire packet must be retransmitted. Retransmission is the responsibility of a higher-layer protocol (such as TCP). Also, you can set the Flags field in the IP header to Do Not Fragment; in this case, the packet is discarded if the outgoing MTU is smaller than the packet.
IPv4 Addressing
This section covers the IPv4 address classes, private addressing, and NAT. The IPv4 address space was initially divided into five classes. Each IP address class is identified by the initial bits of the address. Classes A, B, and C are unicast IP addresses, meaning that the destination is a single host. IP Class D addresses are multicast addresses, which are sent to multiple hosts. IP Class E addresses are reserved. This section introduces IPv4 private addresses, which are selected address ranges that are reserved for use by companies in their private networks. These private addresses are not routed on the Internet. NAT translates between private and public addresses.
An IP address is a unique logical number to a network device or interface. An IP address is 32 bits in length. To make the number easier to read, the dotted-decimal format is used. The bits are combined into four 8-bit groups, each converted into decimal numbers (for example, 10.1.1.1). If you are not familiar with binary numbers, see Appendix B, which provides a review of binary and hexadecimal number manipulation.
Consider an example involving the binary IP address 01101110 00110010 11110010 00001010. Convert each byte into decimal.
Convert the first octet as follows:
0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 |
0 | +64 | +32 | +0 | +8 | +4 | +2 | +0 = 110 |
01101110 = 110 |
Convert the second octet as follows:
0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
0 | +0 | +32 | +16 | +0 | +0 | +2 | +0 = 50 |
00110010 = 50 |
Convert the third octet as follows:
1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 |
128 | +64 | +32 | +16 | +0 | +0 | +2 | +0 = 242 |
11110010 = 242 |
Convert the fourth octet as follows:
0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 |
0 | +0 | +0 | +0 | +8 | +0 | +2 | +0 = 10 |
00001010 = 10 |
The IP address in decimal is 110.50.242.10.