5.0 Network Layer
5.0 Network Layer
1
Orientation
Network
ARP Link Layer
Access
Media
2
Application protocol
3
IP Service
• Consequences:
• Higher layer protocols have to deal with losses or with duplicate
packets
4
IP Service
unicast
broadcast multicast
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
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
• Intel processors use this order Motorola processors use big endian.
8
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
10
Fields of the IP Header
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
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)
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?
Router
16
What’s involved in Fragmentation?
18
Example of Fragmentation
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
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
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
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
34
Dynamic Assignment of IP addresses
35
Solutions for dynamic assignment of IP addresses
36
BOOTP
– 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
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
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
Options
43
DHCP Message Type
2 DHCPOFFER
3 DHCPREQUEST
4 DHCPDECLINE
5 DHCPACK
6 DHCPNAK
7 DHCPRELEASE
8 DHCPINFORM
44
Other options (selection)
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
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCPRELEASE
DCHP RELEASE
48