0% found this document useful (0 votes)
9 views39 pages

Understanding Internet Protocol (IP) Basics

The document provides an overview of the Internet Protocol (IP), specifically focusing on its structure, services, and functionality within the network layer of the Internet. It details the current version (IPv4), the format of IP datagrams, the concept of fragmentation, and the processes involved in routing and forwarding IP packets. Additionally, it explains the role of routing tables in directing datagrams to their destinations and the significance of various fields in the IP header.

Uploaded by

khedkaramit100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views39 pages

Understanding Internet Protocol (IP) Basics

The document provides an overview of the Internet Protocol (IP), specifically focusing on its structure, services, and functionality within the network layer of the Internet. It details the current version (IPv4), the format of IP datagrams, the concept of fragmentation, and the processes involved in routing and forwarding IP packets. Additionally, it explains the role of routing tables in directing datagrams to their destinations and the significance of various fields in the IP header.

Uploaded by

khedkaramit100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

IP - The Internet Protocol

1
Orientation

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

TCP UDP Transport


Layer

Network
ICMP IP IGMP
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)

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.

• Note: some computers store 32-bit words in little endian format.

8
Fields of the IP Header

• Version (4 bits): current version is 4, next version will be 6.


• Header length (4 bits): length of IP header, in multiples of 4
bytes
• 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):
• New feedback mechanism used by TCP
9
Fields of the IP Header

• Identification (16 bits): Unique identification of a datagram


from a host. Incremented whenever a datagram is transmitted

• Flags (3 bits):
– First bit always set to 0
– DF bit (Do not fragment)
– MF bit (More fragments)
Will be explained later Fragmentation

10
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

11
Fields of the IP Header

• Protocol (1 byte):
• Specifies the higher-layer protocol.
4 = IP-in-IP
• Used for demultiplexing to higher layers. encapsulation

6 = TCP 17 = UDP

1 = ICMP 2 = IGMP

IP

• Header checksum (2 bytes): A simple 16-bit long checksum


which is computed for the header of the datagram.

12
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

13
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

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


IP datagram is fragmented into smaller units.
• What if the route contains networks with different MTUs?

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

• 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 protocols:


Ethernet: 1500 FDDI: 4352
802.3: 1492 ATM AAL5: 9180
802.5: 4464 PPP: negotiated
15
IP Fragmentation

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


IP datagram is fragmented into smaller units.

• What if the route contains networks with different MTUs?

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 hosts !!

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

Header length: 20 Header length: 20 Header length: 20 Header length: 20


Total length: 2400 Total length: 448 Total length: 996 Total length: 996
Identification: 0xa428 Identification: 0xa428 Identification: 0xa428 Identification: 0xa428
DF flag: 0 DF flag: 0 DF flag: 0 DF flag: 0
MF flag: 0 MF flag: 0 MF flag: 1 MF flag: 1
Fragment offset: 0 Fragment offset: 244 Fragment offset: 122 fragment offset: 0

IP datagram Fragment 3 Fragment 2 Fragment 1

MTU: 4000 MTU: 1000


Router
20
Figure Fragmentation example

21
Figure Detailed fragmentation example

22
IP Forwarding

23
Delivery of an IP datagram

• View at the data link layer layer:


– Internetwork is a collection of LANs or point-to-point links or switched
networks that are connected by routers

IP

24
Delivery of an IP datagram

• View at the IP layer:


– An IP network is a logical entity with a network number
– We represent an IP network as a “cloud”
– The IP delivery service takes the view of clouds, and ignores the data
link layer view

IP

25
Tenets of end-to-end delivery of datagrams

The following conditions must hold so that an IP datagram can


be successfully delivered

1. The network prefix of an IP destination address must


correspond to a unique data link layer network (=LAN or
point-to-point link or switched network).
(The reverse need not be true!)
2. Routers and hosts that have a common network prefix
must be able to exchange IP dagrams using a data link
protocol (e.g., Ethernet, PPP)
3. Every data link layer network must be connected to at least
one other data link layer network via a router.

26
Routing tables
• Each router and each host keeps a routing table which tells the router
how to process an outgoing packet
• Main columns:
1. Destination address: where is the IP datagram going to?
2. Next hop: how to send the IP datagram?
3. Interface: what is the output port?
• Next hop and interface column can often be summarized as one column
• Routing tables are set so that datagrams gets closer to the its destination
Destination Next interface
Hop
[Link]/24 direct eth0
[Link]/24 direct eth0
Routing table of a host or router [Link]/24 R4 serial0
IP datagrams can be directly delivered [Link]/24 direct eth1
(“direct”) or is sent to a router (“R4”) [Link]/16 R4 eth0
[Link]/28 R4 eth0

27
Delivery with routing tables

to:
[Link]

28
Delivery of IP datagrams

• There are two distinct processes to delivering IP datagrams:


1. Forwarding: How to pass a packet from an input
interface to the output interface?
2. Routing: How to find and setup the routing tables?

• Forwarding must be done as fast as possible:


– on routers, is often done with support of hardware
– on PCs, is done in kernel of the operating system
• Routing is less time-critical
– On a PC, routing is done as a background process

29
Processing of an IP datagram in IP

Routing Static
UDP TCP
Protocol routing

Demultiplex

Yes

Lookup next Yes IP forwarding No Destination


routing
table hop enabled? address local?

No
Send Input
IP module datagram Discard queue

Data Link Layer

IP router: IP forwarding enabled


Host: IP forwarding disabled 30
Processing of an IP datagram in IP

• Processing of IP datagrams is very similar on an IP router and


a host
• Main difference:
“IP forwarding” is enabled on router and disabled on host

• IP forwarding enabled
 if a datagram is received, but it is not for the local system,
the datagram will be sent to a different system
• IP forwarding disabled
 if a datagram is received, but it is not for the local system,
the datagram will be sent to a different system

31
Processing of an IP datagram at a router

Receive an
IP datagram 1. IP header validation
2. Process options in IP header
3. Parsing the destination IP address
4. Routing table lookup
5. Decrement TTL
6. Perform fragmentation (if necessary)
7. Calculate checksum
8. Transmit to next hop
9. Send ICMP packet (if necessary)

32
Routing table lookup

• When a router or host need to


transmit an IP datagram, it
performs a routing table lookup
Destination Next hop/
address interface
• Routing table lookup: Use the
IP destination address as a key to network prefix IP address of
search the routing table.
or next hop router
host IP address
• Result of the lookup is the IP or or
address of a next hop router, loopback address
and/or the name of a network or Name of a
interface default route network
interface

33
Type of routing table entries

• Network route
– Destination addresses is a network address (e.g., [Link]/24)
– Most entries are network routes

• Host route
– Destination address is an interface address (e.g., [Link]/32)
– Used to specify a separate route for certain hosts

• Default route
– Used when no network or host route matches
– The router that is listed as the next hop of the default route is the
default gateway (for Cisco: “gateway of last resort)

• Loopback address
– Routing table for the loopback address ([Link])
– The next hop lists the loopback (lo0) interface as outgoing interface

34
Routing table lookup: Longest Prefix Match

• Longest Prefix Match: Search for the [Link]


routing table entry that has the longest
= of the destination
match with the prefix
IP address
Destination address Next hop

[Link]/8 R1
1. Search for a match on all 32 bits [Link]/16 R2
2. Search for a match for 31 bits [Link]/20 R3
[Link]/20 R3
….. [Link]/24 R4
32. Search for a mach on 0 bits [Link]/32 R3
default R5

Host route, loopback entry The longest prefix match for


 32-bit prefix match [Link] is for 24 bits
Default route is represented as [Link]/0 with entry [Link]/24
 0-bit prefix match
Datagram will be sent to R4
35
Route Aggregation

• Longest prefix match algorithm permits to aggregate prefixes


with identical next hop address to a single entry
• This contributes significantly to reducing the size of routing
tables of Internet routers

Destination Next Hop Destination Next Hop


[Link]/24 R3 [Link]/24 R3
[Link]/24 direct [Link]/24 direct
[Link]/24 direct [Link]/24 direct
[Link]/24 R3 [Link]/24 R3
[Link]/16 R2 [Link]/8 R2
[Link]/28 R2
36
How do routing table get updated?

• Adding an interface:
– Configuring an interface eth2 with Destination Next Hop/
[Link]/24 adds a routing table interface
entry: [Link]/24 eth2

• Adding a default gateway:


– Configuring [Link] as the Destination Next Hop/
default gateway adds the entry: interface
[Link]/0 [Link]
• Static configuration of network routes
or host routes
• Update of routing tables through
routing protocols

• ICMP messages

37
Routing table manipulations with ICMP

• When a router detects that an IP datagram should have gone


to a different router, the router (here R2)
• forwards the IP datagram to the correct router
• sends an ICMP redirect message to the host
• Host uses ICMP message to update its routing table

(2) IP datagram
(3) ICMP redirect
(1) IP datagram

R1

38
ICMP Router Solicitation
ICMP Router Advertisement

• After bootstrapping a router


broadcasts an ICMP router
solicitation. R1 R2
• In response, routers send an
ICMP router ICMP router
ICMP router advertisement advertisement advertisement
message
• Also, routers periodically ICMP router
broadcast ICMP router advertisement
advertisement
Ethernet

This is sometimes called the


Router Discovery Protocol
H1

39

You might also like