0% found this document useful (0 votes)
67 views

IP - The Internet Protocol: Unit - I IP Header

IP is the network layer protocol that provides an unreliable, connectionless best-effort delivery service and operates by fragmenting data packets if needed to fit within the maximum transmission unit of the underlying data link layer; it uses a 20-24 byte header that includes fields for identification, flags, time-to-live, protocol type, and source/destination addressing to route packets between hosts and routers on the Internet.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

IP - The Internet Protocol: Unit - I IP Header

IP is the network layer protocol that provides an unreliable, connectionless best-effort delivery service and operates by fragmenting data packets if needed to fit within the maximum transmission unit of the underlying data link layer; it uses a 20-24 byte header that includes fields for identification, flags, time-to-live, protocol type, and source/destination addressing to route packets between hosts and routers on the Internet.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

IP - The Internet Protocol

Unit – I
IP Header

1
Orientation

• IP (Internet Protocol) is a Network Layer Protocol.

TCP UDP Transport


Layer

ICMP IP IGMP Network


Layer

Network
ARP Link Layer
Access

Media

• IP’s current version is Version 4 (IPv4). It is specified in RFC


891.

2
IP: The waist of the hourglass

• IP is the waist of the


hourglass of the Internet Applications
protocol architecture
HTTP FTP SMTP

TCP UDP
• Multiple higher-layer protocols
• Multiple lower-layer protocols IP

• Only one protocol at the Data link layer


protocols
network layer.
Physical layer
protocols

3
Application protocol

• IP is the highest layer protocol which is implemented at both


routers and hosts

Application Application protocol Application

TCP TCP protocol TCP

IP IP protocol IP IP protocol IP IP protocol IP

Data Data Data Data Data Data Data Network


Data Link
Link Link Link Link Link Link Link Access

Host Router Router Host

4
IP Service

• Delivery service of IP is minimal

• IP provide provides an unreliable connectionless best effort service (also


called: “datagram service”).
– Unreliable: IP does not make an attempt to recover lost packets
– Connectionless: Each packet (“datagram”) is handled independently.
IP is not aware that packets between hosts may be sent in a logical
sequence
– Best effort: IP does not make guarantees on the service (no
throughput guarantee, no delay guarantee,…)

• Consequences:
• Higher layer protocols have to deal with losses or with duplicate
packets

• Packets may be delivered out-of-sequence

5
IP Service

• IP supports the following services:


• one-to-one (unicast)
• one-to-all (broadcast)
• one-to-several (multicast)

unicast
broadcast multicast

• IP multicast also supports a many-to-many service.


• IP multicast requires support of other protocols (IGMP, multicast routing)
• IP anycast, you transmit to any one device in a group, whose members are
all eligible to receive the data.
6
IP Datagram Format
bit # 0 7 8 15 16 23 24 31
header
version DS ECN total length (in bytes)
length
D M
Identification 0 Fragment offset
F F
time-to-live (TTL) protocol header checksum

source IP address

destination IP address

options (0 to 40 bytes)

payload

4 bytes

• 20 bytes ≤ Header Size < 24 x 4 bytes = 60 bytes


• 20 bytes ≤ Total Length < 216 bytes = 65536 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

• Conventions to store a multibyte work


• Example: a 4 byte Long Integer Byte3 Byte2 Byte1 Byte0

Little Endian Big Endian


• Stores the low-order byte at the • Stores the high-order byte at the
lowest address and the highest lowest address, and the low-order
order byte in the highest address. byte at the highest address.
Base Address+0 Byte0 Base Address+0 Byte3
Base Address+1 Byte1 Base Address+1 Byte2
Base Address+2 Byte2 Base Address+2 Byte1
Base Address+3 Byte3 Base Address+3 Byte0

• Intel processors use this order Motorola processors use big endian.

9
Fields of the IP Header

• Version (4 bits): current most widely used version is 4, IPv6


till not in wide use.
• Header length (4 bits): A 4-bit field containing the length of the IP header in 32-bit
increments. The minimum length of an IP header is 20 bytes, or five 32-bit increments. The maximum
length of an IP header is 24 bytes, or six 32-bit increments. Therefore, the header length field should
contain either 5 or 6.

• DS/ECN field (1 byte)


– This field was previously called as Type-of-Service (TOS) field. The
role of this field has been re-defined, but is “backwards compatible” to
TOS interpretation
– Differentiated Service (DS) (6 bits):
• Used to specify service level (currently not supported in the
Internet)
– Explicit Congestion Notification (ECN) (2 bits):
• Feedback mechanism used by TCP
10
Fields of the IP Header

• Identification (16 bits): Unique identification number for each


datagram set at host end.

• 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

• Time To Live (TTL) (1 byte):


– Specifies longest paths before datagram is dropped
– Role of TTL field: Ensure that packet is eventually dropped
when a routing loop occurs
Used as follows:
– Sender sets the value (e.g., 64)
– Each router decrements the value by 1
– When the value reaches 0, the datagram is dropped

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

• Header checksum (2 bytes): The IP checksum is a 16 bit 1's


complement sum of all the 16 bit words in the IP header.

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)

• MTUs for various data link layers:


Ethernet: 1500 FDDI: 4352
802.3: 1492 ATM AAL5: 9180
802.5: 4464 PPP: 296

15
IP Fragmentation

• What if the size of an IP datagram exceeds the MTU?


• What if the route contains networks with different MTUs?

 IP datagram is fragmented into smaller units.

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?

• Fragmentation can be done at the sender or at


intermediate routers
• The same datagram can be fragmented several times.
• Reassembly of original datagram is only done at
destination host.

IP datagram H Fragment 2 H2 Fragment 1 H1

Router

17
What’s involved in Fragmentation?

• The following fields in the IP


header are involved:
header
version
length
DS ECN total length (in bytes)
DM
Identification 0 Fragment offset
F F
time-to-live (TTL) protocol header checksum

Identification When a datagram is fragmented, the


identification is the same in all fragments
Flags
DF bit is set: Datagram cannot be fragmented and must
be discarded if MTU is too small
MF bit set: This datagram is part of a fragment and an
additional fragment follows this one
18
What’s involved in Fragmentation?

• The following fields in the IP


header are involved:
header
version
length
DS ECN total length (in bytes)
DM
Identification 0 Fragment offset
F F
time-to-live (TTL) protocol header checksum

Fragment offset Offset of the payload of the current


fragment in the original datagram
Total length Total length of the current fragment

19
Example of Fragmentation

• A datagram with size 2400 bytes must be fragmented according to an


MTU limit of 1000 bytes (note IP header is 20bytes)
First Fragment:
MTU = 1000
Datagram = 2400 = 20 header + 2380 payload
MTU can carry 1000 – 20 (Header) = 980 data bytes
Header length: 20 Header length: 20 Header length: 20 Header length: 20
Fragments have to be multiple of 8 in size (2 13).
Total length:
So 980/8=122R4 2400 Total length: 448 Total length: 996 Total length: 996
Identification:
Therefore carried0xa428 Identification:
payload will be 980-4=9760xa428
bytes Identification: 0xa428 Identification: 0xa428
DF flag: will0be 20 (Header) DF
The first fragment flag:
+ 976 data =0 996 in length. DF flag: 0 DF flag: 0
MF flag:
Fragment offset will be0 0 bytes. MF flag: 0 MF flag: 1 MF flag: 1
Data Fragment
remainingoffset: 0 Fragment
to be transmitted = 2380 offset:
– 976. 244 Fragment offset: 122 fragment offset: 0
Offset of next datagram will be 976/8 = 122

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

You might also like