140 likes | 270 Views
CSCI 4550/8556 Computer Networks. Comer, Chapter 21: IP Encapsulation, Fragmentation, and Reassembly. Datagram Transmission and Frames. The IP internet layer: constructs a datagram, determines the next hop, and hands the datagram to the network interface layer.
E N D
CSCI 4550/8556Computer Networks Comer, Chapter 21: IP Encapsulation, Fragmentation, and Reassembly
Datagram Transmission and Frames • The IP internet layer: • constructs a datagram, • determines the next hop, and • hands the datagram to the network interface layer. • The network interface layer: • binds the next hop address to the hardware address, and • prepares the datagram for transmission. • But, the hardware frame doesn’t understand IP; how is the datagram transmitted?
Encapsulation • The network interface layer encapsulates each IP datagram in the data area in the hardware frame • The hardware ignores the IP datagram format. • The standards for encapsulation describe the details. • The standard defines the data type for an IP datagram, as well as others (e.g., ARP) • The receiving protocol stack interprets the data area based on the frame type.
Encapsulation Across Multiple Hops • Each router in the path from the source to the destination: • unencapsulates incoming datagram from the frame; • processes the datagram - determines next hop; and • encapsulates the datagram in an outgoing frame. • Datagram may be encapsulated in a different hardware format at each hop. • The datagram itself is (almost!) unchanged.
Maximum Transmission Unit: MTU • Every hardware technology specification includes the definition of the maximum size of a frame’s data area. • This size is called the maximum transmission unit (MTU). • Any datagram encapsulated in a hardware frame must be no larger than the MTU for that hardware.
MTU and Datagram Transmission • IP datagrams can be larger than most hardware MTUs. For example • IP: 216 – 1, or 65535 bytes • Ethernet: 1500 bytes • Token ring: 2048 or 4096 bytes • The source can simply limit an IP datagram’s size to be no larger than the local MTU. • Thus we must pass information about the local MTU up to TCP for TCP segments. • But what about UDP datagrams? Aren’t these supposed to be treated as single “virtual frames?”
MTU and Heterogeneous Networks • An internet may have networks with different MTUs. • Suppose a “downstream” network has a smaller MTU than the local network. How is the hardware frame size handled in this case?
Fragmentation • It is obvious that the larger frame cannot fit in the smaller frame. • One technique to solve the problem is to limit a datagram’s size to the smallest MTU of any network in the internet. • IP uses fragmentation - datagrams can be split into pieces to fit into a network with a smaller MTU than the current network. • A router can detect that a datagram is larger than the next network’s MTU. • It then splits the datagram into pieces, each of which is no larger than the outbound network’s MTU.
Fragmentation (Details) • Each fragment is an independent datagram. • It includes all IP datagram header fields. • A bit in the header indicates the datagram is a fragment. • Other fields have information for reconstructing original datagram. • FRAGMENT OFFSET gives original location of fragment • A router uses the local MTU to compute the size of each fragment. • It puts part of the data from original datagram in each fragment. • Additional information is placed in the header.
Datagram Reassembly • Reconstruction of the original datagram is called reassembly . • The ultimate destination performs reassembly. • Fragments may arrive out of order; a header bit identifies the fragment containing the end of the data from the original datagram. • In the example, fragment 3 would be identified as the last fragment.
Fragment Identification • Inidivudal fragments must be associated with the original datagram. • The IDENT field in each fragment matches the IDENTfield in the original datagram. • Fragments from different datagrams can arrive out of order and still be sorted out by : • matching them using the IDENTfield values; • recognizing the last fragment from the bit set in its header; and • recognizing when all fragments in an original datagram have been received.
Fragment Loss • IP may drop a fragment (for many reasons). • What happens to the original datagram in this case? • A. The destination drops the entire original datagram. • How does the destination identify a lost fragment? • A timer is associated with each datagram. • If the timer expires before all fragments arrive, one or more fragments are assumed lost, and … • The entire datagram is dropped. • The source (in the application layer protocol) is assumed to retransmit if necessary.
Fragmenting a Fragment • A fragment may encounter a subsequent network with an even smaller MTU. • The router fragments the fragment to fit that smaller MTU. • The resulting “subfragments” look just like the original fragments, except for their sizes. • There is no need to reassemble fragments hierarchically; “subfragments” include their position in original datagram in a header field.
Summary • IP uses encapsulation to transmit datagrams in hardware frames. • Network technologies have an MTU that limits the amount of data that a single frame can carry. • IP uses fragmentation to carry datagrams larger than the network MTU.