Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Internet Networking Spring 2004 Tutorial 2 IP Checksum, Fragmentation.

Similar presentations


Presentation on theme: "1 Internet Networking Spring 2004 Tutorial 2 IP Checksum, Fragmentation."— Presentation transcript:

1 1 Internet Networking Spring 2004 Tutorial 2 IP Checksum, Fragmentation

2 2 IP Header Diagram Ver. Source Address IHLTOS FlagsFragment Offset Total Length Identification Destination Address OptionPadding TTLProtocolChecksum

3 3 IP Checksum Ensuring integrity of IP header Reducing processing time at routers. Allowing higher level protocols to choose their own checksum scheme for the data. Does not check data integrity.

4 4 Checksum (RFC 1071) Adjacent octets to be checksummed are paired to form 16-bit integers, and the 1's complement sum of these 16-bit integers is formed. The checksum field is cleared, the 16-bit 1's complement sum is computed over the octets concerned, and the 1's complement of this sum is placed in the checksum field.

5 5 Checksum To verify a checksum, the 1's complement sum is computed over the same set of octets, including the checksum field. If the result is all 1 bits, the check succeeds.

6 6 Checksum Insensitive to: Byte alignment insensitive. Byte order insensitive. Zero padding. Word width (2 bytes, 4 bytes, etc.). Software oriented (simple addition). Not robust (unlike CRC).

7 7 Example

8 8 Incremental Internet Checksum Updating part of the IP header data doesn’t require recomputing the entire Checksum field. (For example: when a router change the TTL field.) The technique for speed up checksum recomputing in this case is called - incremental checksum update.

9 9 Incremental Internet Checksum Notation: C - Old checksum. m - Old data. C’ - New checksum m’ - New data C’ = C + (-m) + m’ = C + ( m’ – m) For counting the 1's complement of the checksum ~C: ~C' = ~(C + (-m) + m') = ~C + (m - m') = ~C + m + ~m'

10 10 Incremental Internet Checksum Subtracting 1 from TTL field (common case) ~C’ = ~C + (m - m’) = ~C + 0100H (TTL byte is higher byte of integer) If ~C=220dH then ~C’ = 220dH + 0100H = 230dH

11 11 Incremental Internet Checksum Problem: In one's complement, there are two representations of zero. +0 = 0x0000 -0 = 0xffff. There is at least one non-zero field in the IP header, thus the checksum field can never contain 0xffff.

12 12 Incremental Internet Checksum Solution: Using the following equation (RFC 1624) ~C'=~(C+(-m)+m')=~(C+~m+m') Thus: ~C'=~(0x22d0+0xaaaa+0x3285)= 0xdd2f+0x5555+0xcd7a=~(0xffff)= 0x0000

13 13 IP Fragmentation The internet is used to connect network from different technologies. In particular every technology has its own maximum packet size. This maximum packet size is called MTU (Maximum Transfer Unit). In Ethernet the MTU is 1514 bytes. Large IP packets may traverse network in which the MTU is smaller than the packet sized. These packets must be fragmented.

14 14 IP Fragmentation IP fragmentation is done in the entry point of the (physical) network that requires the fragmentation. IP layer automatically performs fragmentation of a datagram when its too large to be sent on physical network. A datagram could be fragmented more than one time. Fragments are counted in units of 8 octets. Reassemble is done in the IP layer at the destination. Transparent to upper protocol.

15 15 IP Fragmentation Ver. Source Address IHLTOS FlagsFragment Offset Total Length Identification Destination Address OptionPadding TTLProtocolChecksum

16 16 Identification field Unique integer that identifies the datagram The originator of the IP packet (i.e. the source) sets the identification field to a value that must be unique for that source- destination pair and protocol for the time the datagram will be active in the internet system. Implemented by counter, which increments by one. Ensures that fragments of different datagrams are not mixed.

17 17 Fragment Offset Tells the receiver the position of a fragment in the original datagram. Identifies the fragment location, relative to the beginning of the original unfragmented datagram. The fragment offset and length determine the portion of the original datagram covered by this fragment. The fragment offset is measured in units of 8 octets (64 bits). Enables Additional fragmentation. This is not include the length of the IP header. Reason: 13 bits are used to map 16 bits (IP length). The first fragment has offset zero.

18 18 Flag Bit 0: reserved, must be zero. Bit 1: (DF) 0 = May Fragment, 1=Don't Fragment. If is set, then internet fragmentation of this datagram is NOT permitted If fragmentation required, but this bit is set than the packet is discarded and ICMP is returned. Bit 2: (MF) 0 = Last Fragment, 1=More Fragments. Set if the datagram is not the last fragment.

19 19 Fragmentation - Example Datagram header Data 1 600 octets Data 2 600 octets Data 3 200 octets Datagram header Data 1 600 octets Datagram header Data 2 600 octets Data 3 200 octets Datagram header Fragment 1 offset = 0 Fragment 2 offset = 75 Fragment 3 offset = 150 b a

20 20 Fragmentation Fragmentation must be supported by every IP entities (routers, host, etc.). Fragmentation should be avoided. Loss of one fragment requires retransmission of the entire packet. Advanced IP forwarding entities (e.g HW based forwarding entities) does not support IP fragmentation (i.e. IP fragmentation is an exception). MTU discovery protocol (RFC 1191) that uses the DF bit, is used to avoid the necessity of IP fragmentation.


Download ppt "1 Internet Networking Spring 2004 Tutorial 2 IP Checksum, Fragmentation."

Similar presentations


Ads by Google