IP - The Internet Protocol: Unit - I IP Header
IP - The Internet Protocol: Unit - I IP Header
Unit – I
IP Header
1
Orientation
Network
ARP Link Layer
Access
Media
2
IP: The waist of the hourglass
TCP UDP
• Multiple higher-layer protocols
• Multiple lower-layer protocols IP
3
Application protocol
4
IP Service
• Consequences:
• Higher layer protocols have to deal with losses or with duplicate
packets
5
IP Service
unicast
broadcast multicast
source IP address
destination IP address
options (0 to 40 bytes)
payload
4 bytes
7
IP Datagram Format
• Question: In which order are the bytes of an IP datagram
transmitted?
• Answer:
• Transmission is row by row
• For each row:
1. First transmit bits 0-7
2. Then transmit bits 8-15
3. Then transmit bits 16-23
4. Then transmit bits 24-31
• This is called network byte order or big endian byte
ordering.
8
Big endian vs. small endian
• Intel processors use this order Motorola processors use big endian.
9
Fields of the IP Header
• Flags (3 bits):
– First bit always set to 0
– DF bit (Do not fragment)
– MF bit (More fragments)
Will be explained later Fragmentation
11
Fields of the IP Header
12
Fields of the IP Header
• Protocol (1 byte):
• Specifies the higher-layer protocol.
4 = IP-in-IP
• Used for de-multiplexing to higher layers. encapsulation
17 = UDP
6 = TCP
1 = ICMP 2 = IGMP
IP
13
Fields of the IP Header
• Options:
• Security restrictions
• Record Route: each router that processes the packet adds its IP
address to the header.
• Timestamp: each router that processes the packet adds its IP
address and time to the header.
• (loose) Source Routing: specifies a list of routers that must be
traversed.
• (strict) Source Routing: specifies a list of the only routers that
can be traversed.
• Padding: Padding bytes are added to ensure that header
ends on a 4-byte boundary
14
Maximum Transmission Unit
• Maximum size of IP datagram is 65535, but the data link layer
protocol generally imposes a limit that is much smaller
• For example:
– Ethernet frames have a maximum payload of 1500 bytes
IP datagrams encapsulated in Ethernet frame cannot be longer than
1500 bytes
• The limit on the maximum IP datagram size, imposed by the
data link protocol is called maximum transmission unit
(MTU)
15
IP Fragmentation
Ethernet
FDDI
Ring
Host A Router Host B
MTUs: FDDI: 4352 Ethernet: 1500
• Fragmentation:
• IP router splits the datagram into several datagram
• Fragments are reassembled at receiver
16
Where is Fragmentation done?
Router
17
What’s involved in Fragmentation?
19
Example of Fragmentation
Second Fragment:
IP datagram Fragment 3 Fragment 2 Fragment 1
Data remaining to be carried: 2380 – 976 = 1404 > 980 --> 976
Third Fragment:
The second fragment will be 20 (Header) + 976 data = 996 in length.
MTU: 4000 Data remaining to be transmitted = 2380 – 97
MTU: 1000
Fragment offset will be 122 bytes (size of 1st fragment payload).
Router The 3rd fragment will be 20 (Header) + 428 d
Offset of next datagram will be 122 + 976/8 = 244
Fragment offset will be 244 bytes (size of 1st +
20