0% found this document useful (0 votes)
38 views48 pages

5.0 Network Layer

This document provides an overview of the Internet Protocol (IP). IP is a network layer protocol that is implemented in both routers and hosts. It provides an unreliable, connectionless, best-effort datagram service. The current version is IPv4, specified in RFC 891. IP supports unicast, broadcast, and multicast delivery. The IP datagram format includes fields for version, header length, type of service, total length, identification, flags, time to live, protocol, header checksum, source/destination addresses, and options. IP fragmentation is used when the datagram size exceeds the maximum transmission unit of the network.

Uploaded by

teweldetekeste
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)
38 views48 pages

5.0 Network Layer

This document provides an overview of the Internet Protocol (IP). IP is a network layer protocol that is implemented in both routers and hosts. It provides an unreliable, connectionless, best-effort datagram service. The current version is IPv4, specified in RFC 891. IP supports unicast, broadcast, and multicast delivery. The IP datagram format includes fields for version, header length, type of service, total length, identification, flags, time to live, protocol, header checksum, source/destination addresses, and options. IP fragmentation is used when the datagram size exceeds the maximum transmission unit of the network.

Uploaded by

teweldetekeste
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/ 48

IP - The Internet Protocol

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

3
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

4
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)

5
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

6
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: Many computers (incl. Intel processors) store 32-bit words in little
endian format. Others (incl. Motorola processors) use big endian.

7
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.

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

17 = UDP
6 = TCP

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

• 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
14
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

15
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

16
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
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

Fragment offset Offset of the payload of the current


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

18
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
19
Determining the length of fragments

• To determine the size of the fragments we recall that, since


there are only 13 bits available for the fragment offset, the
offset is given as a multiple of eight bytes. As a result, the first
and second fragment have a size of 996 bytes (and not 1000
bytes). This number is chosen since 976 is the largest number
smaller than 1000–20= 980 that is divisible by eight. The
payload for the first and second fragments is 976 bytes long,
with bytes 0 through 975 of the original IP payload in the first
fragment, and bytes 976 through 1951 in the second
fragment. The payload of the third fragment has the remaining
428 bytes, from byte 1952 through 2379. With these
considerations, we can determine the values of the fragment
offset, which are 0, 976 / 8 = 122, and 1952 / 8 = 244,
respectively, for the first, second and third fragment.

20
Address Resolution Protocol (ARP)
Internet and Data Link Layer
Addresses
• Each host and router on a subnet needs a data link
layer address to specify its address on the subnet
– This address appears in the data link layer frame
sent on a subnet
– For instance, 48-bit 802.3 MAC layer frame
addresses for LANs

Subnet DA
DL Frame for Subnet
Addresses

• Each host and router also needs an IP address at the internet


layer to designate its position in the overall Internet

128.171.17.13
Subnet

Subnet

Subnet
Internet and Data Link Addresses Serve
Different Purposes

• IP address
– To guide delivery to destination host across the
Internet (across multiple networks)
• Subnet Address
– To guide delivery between two hosts, two routers,
and a host and router within a single subnet
– Same LAN, Frame Relay network, etc.
Analogy

• In company, each person has a company-wide ID number


(like IP address)
• In company, person also has a local office number in a
building
• Paychecks are made out to ID numbers
• For delivery, also need to know office number
Address Resolution
• Problem
– Router knows that destination host is on its
subnet based on the IP address of an arriving
packet
– Does not know the destination host’s subnet
address, so cannot deliver the packet across
the subnet

Destination Host
128.171.17.13
Subnet
subnet address?
Address Resolution Protocol (ARP)
• Router creates an ARP Request message to be
sent to all hosts on the subnet.
– Address resolution protocol message asks
“Who has IP address 128.171.17.13?”
– Passes ARP request to data link layer process
for delivery

Subnet
ARP Request
Address Resolution Protocol (ARP)
• Data link process of router broadcasts the ARP
Request message to all hosts on the subnet.
– On a LAN, MAC address of 48 ones tells all
stations to pay attention to the frame

Subnet
ARP Request
Address Resolution Protocol
(ARP)
• Host with IP address 128.171.17.13 responds
– Internet process creates an ARP response
message
– Contains the destination host’s subnet address
(48-bit MAC address on a LAN)

ARP Response

Subnet
Address Resolution Protocol
(ARP)
• Router delivers the IP packet to the destination
host
– Places the IP packet in the subnet frame
– Puts the destination host’s subnet address in
the destination address field of the frame

Deliver IP Packet
within a subnet frame

Subnet
Address Resolution Protocol

• ARP Requests and Responses are sent between the internet


layer processes on the router and the destination host

ARP
Router Destination Host
Request
Internet Internet
Process Process
ARP
Response
Address Resolution Protocol
• However, the data link processes deliver these
ARP packets
– Router broadcasts the ARP Request
– Destination host sends ARP response to the
subnet source address found in the broadcast
frame

Router Destination Host


Internet Internet
Process Broadcast ARP Request Process
Data Link Data Link
Process Process
Direct ARP Response
Figure 8.3 ARP packet

TCP/IP Protocol Suite 33


Dynamic Host Configuration Protocol
(DHCP)

34
Dynamic Assignment of IP addresses

• Dynamic assignment of IP addresses is desirable for several


reasons:
– IP addresses are assigned on-demand
– Avoid manual IP configuration
– Support mobility of laptops

35
Solutions for dynamic assignment of IP addresses

• Reverse Address Resolution Protocol (RARP)


– Works similar to ARP
– Broadcast a request for the IP address associated
with a given MAC address
– RARP server responds with an IP address
– Only assigns IP address (not the default router and
subnetmask)

ARP Ethernet MAC


IP address
address
(32 bit)
(48 bit)
RARP

36
BOOTP

• BOOTstrap Protocol (BOOTP)


• From 1985
• Host can configure its IP parameters at boot time.
• 3 services.
– IP address assignment.
– Detection of the IP address for a serving machine.
– The name of a file to be loaded and executed by the client machine
(boot file name)

– Not only assign IP address, but also default router, network mask, etc.
– Sent as UDP messages (UDP Port 67 (server) and 68 (host))
– Use limited broadcast address (255.255.255.255):
• These addresses are never forwarded

37
Dynamic Host Configuration Protocol
(DHCP)

Relates to Lab 7.
Module about dynamic assignment of IP addresses with DHCP.

38
DHCP

• Dynamic Host Configuration Protocol (DHCP)


– From 1993
– An extension of BOOTP, very similar to DHCP
– Same port numbers as BOOTP
– Extensions:
• Supports temporary allocation (“leases”) of IP addresses
• DHCP client can acquire all IP configuration parameters
needed to operate
– DHCP is the preferred mechanism for dynamic assignment
of IP addresses
– DHCP can interoperate with BOOTP clients.

39
BOOTP Interaction

(b)
Argon
(a) Argon
128.143.137.144
00:a0:24:71:e4:44 BOOTP Server 00:a0:24:71:e4:44 DHCP Server
BOOTP Response:
IP address: 128.143.137.144
BOOTP Request
00:a0:24:71:e4:44 Server IP address: 128.143.137.100
Sent to 255.255.255.255 Boot file name: filename

• BOOTP can be used for


Argon
128.143.137.144
(c) downloading memory
00:a0:24:71:e4:44 DHCP Server
image for diskless
TFTP
“filename”
workstations
• Assignment of IP addresses
128.143.137.100
to hosts is static

40
DHCP Interaction (simplified)

Argon
00:a0:24:71:e4:44 DHCP Server

DHCP Request
00:a0:24:71:e4:44
Sent to 255.255.255.255

Argon
128.143.137.144
00:a0:24:71:e4:44 DHCP Server
DHCP Response:
IP address: 128.143.137.144
Default gateway: 128.143.137.1
Netmask: 255.255.0.0

41
BOOTP/DHCP Message Format
Hardware Address
OpCode Hardware Type Hop Count
Length
Unused (in BOOTP)
Number of Seconds
Flags (in DHCP)
Transaction ID

Client IP address

Your IP address

Server IP address

Gateway IP address

Client hardware address (16 bytes)

Server host name (64 bytes)

Boot file name (128 bytes)

Options

(There are >100 different


42 options)
BOOTP/DHCP

• OpCode: 1 (Request), 2(Reply)


Note: DHCP message type is sent in an option
• Hardware Type: 1 (for Ethernet)
• Hardware address length: 6 (for Ethernet)
• Hop count: set to 0 by client
• Transaction ID: Integer (used to match reply to response)
• Seconds: number of seconds since the client started to boot
• Client IP address, Your IP address, server IP address,
Gateway IP address, client hardware address, server
host name, boot file name:
client fills in the information that it has, leaves rest blank

43
DHCP Message Type

• Message type is sent as an Value Message Type


option.
1 DHCPDISCOVER

2 DHCPOFFER

3 DHCPREQUEST

4 DHCPDECLINE

5 DHCPACK

6 DHCPNAK

7 DHCPRELEASE

8 DHCPINFORM

44
Other options (selection)

• Other DHCP information that is sent as an option:

Subnet Mask, Name Server, Hostname, Domain Name,


Forward On/Off, Default IP TTL, Broadcast Address, Static
Route, Ethernet Encapsulation, X Window Manager, X
Window Font, DHCP Msg Type, DHCP Renewal Time, DHCP
Rebinding, Time SMTP-Server, SMTP-Server, Client FQDN,
Printer Name, …

45
DHCP Operation

DHCP Client
00:a0:24:71:e4:44 DHCP Server

DHCPDISCOVER
• DCHP DISCOVER Sent to 255.255.255.255

DHCP Server

DHCP Client
00:a0:24:71:e4:44 DHCPOFFER DHCP Server

DHCPOFFER
DCHP OFFER

DHCP Server

46
DHCP Operation

DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCPREQUEST

DCHP DISCOVER DHCPACK

At this time, the DHCP DHCP Server


client can start to use the IP
address
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCPREQUEST

Renewing a Lease DHCPACK

(sent when 50% of lease


has expired)
If DHCP server sends DHCP Server
DHCPNACK, then
address is released.
47
DHCP Operation

DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCPRELEASE

DCHP RELEASE

At this time, the DHCP DHCP Server


client has released the IP
address

48

You might also like