Supporting Protocols
ARP and ICMP
Kameswari Chebrolu
Recap
Forwarding needs IP to MAC address mapping
Service provided by ARP protocol
Network layer needs to provide means for
debugging (error signaling) and for router-host
communication (determine MTU size, indicate
better routes, provide netmask info etc)
Service provided by ICMP protocol
Problem Statement
IP layer forwarding is based on IP addresses
Next-hop delivery based on Link addresses
(MAC)
Need to perform IP to MAC address translation
Answer: Address Resolution Protocol (ARP)
Address Resolution Protocol (ARP)
Operates at Link layer (Frame type = 0x0806)
Based on broadcast: What is the MAC address
corresponding to given IP address?
Host with matching IP address replies
Each host maintains a cache with IP to MAC
translations
Entries in cache timed out periodically (15 min)
Address Resolution Protocol (ARP)
Originator: Add entry to cache corresponding
to target
Target: Add entry to cache corresponding to
the originator (sender)
Intermediate hosts: Refresh existing entries
When forwarding a datagram, check cache, if
no mapping, invoke ARP
ARP Packet Format
Hardware Type (=1)
HLEN (=48)
31
16
PLEN (=32)
Protocol Type (=0x0800)
Operation
Source Hardware Address (Bytes 0-3)
Source Hardware Address (Bytes 4-5)
Source Protocol Address (Bytes 0-1)
Source Protocol Address (Bytes 2-3)
Target Hardware Address (Bytes 0-1)
Target Hardware Address (Bytes 2-5)
Target Protocol Address (Bytes 0-3)
Numbers in brackets capture mapping
IP addresses to Ethernet addresses
Gratuitous ARPs
Generated by a host to inform others of its IP to
MAC mapping
Could be a request or reply
If request, no reply will occur
If reply, there was no preceding request
Source IP = destination IP = IP of machine
generating gratuitous ARP
Target MAC: ff:ff:ff:ff:ff:ff
Uses of Gratuitous ARPs
Issued whenever IP or MAC address of an
interface changes or brought up from down state
Help rectify cached ARP entries
Report IP address conflicts (duplicate IP)
Inform bridges of the location of new host
ICMP: Internet Control Message Protocol
Used by hosts & routers to communicate
network-level information
Error reporting: unreachable host, network, port,
protocol
Diagnostic purposes: Echo request/reply (used by
ping)
Routing: Source quench
ICMP Packet Format
ICMP messages carried in IP datagrams
8 bytes of header followed by data.
Data field in error messages carry
entire IP header and first 8 bytes of data of IP
packet that caused the error
0
16
Type
Code
31
Checksum
Type/Code defined information
Data
Select ICMP Messages
Type
Code Description
Echo Reply (Ping)
Destination network unreachable
Destination host unreachable
Destination port unreachable
Fragmentation required, DF flag set
Destination network unknown
Destination host unknown
Select ICMP Messages
Type
Code Description
Source Quench
Redirect datagram for the network
Echo request (Ping)
11
TTL expired
12
Bad IP header
13
Timestamp
14
Timestamp reply
17
Address mask request
18
Address mask reply
Example: Fragmentation Required
0
16
Type=3
Code=4
Unused
31
Checksum
Next hop MTU
IP header and first 8 bytes of original datagrams payload
Traceroute
Source sends series of UDP segments to
destination one after another
First has TTL =1
Second has TTL=2, etc.
Destination port is set to an unlikely number
Traceroute
When nth datagram arrives to nth router:
Router discards datagram
Sends to source an ICMP message (type 11, code 0)
Message includes name of router& IP address
For each ICMP message, sending host notes router
id and RTT time
Sending host stops when it gets ICMP message
(type 3, code 3)
Summary
Studied two useful protocols: ARP and ICMP
ARP is needed for forwarding
Performs IP to MAC address translation
ICMP helps with error reporting and host
signaling