Address Resolution

The address resolution problem:

remember IEEE 802.2 encapsulation...

Dest Source CRC Length DSAP SSAP cntl code type Address Address Data ( 38 - 1492) (4) (6) (6) (2) (1) (1) (1) (3) (2)

1 Address Resolution

Resolution through direct binding: Phys = f(IP) • Objective is to encode the IP address in Physical Dynamic binding protocol is required for networks where: •Physical address larger than IP address (48 vs 32 bits) •Physical address can change •Potentially many hosts on the network

Address Resolution Protocol (ARP) defined by RFC 826

2 Address Resolution

•ARP is a protocol outside the set of TCP/IP protocols

ARP R-ARP IP

Link

PHY

3 Address Resolution ARP Protocol: Case 1: Host A sends to Host D

Specific example, host a issues ‘ping –c hostd’

Host B Host A Host D Host C ARP whois broadcast Arp ‘I am “ reply Unicast to Host

Ping ICMP request Ping ICMP reply

4 Address Resolution Case 1 Issues •Why might there not be a response from D ?

•What happens if D does not respond?

•ARP cache entries timeout after 20 minutes •Why?

•Why is the entry removed regardless of if the host uses the information during the 20 minutes?

5 Address Resolution Case 1 Issues •Why might there not be a response from D ? •Host D might not exist or might not be turned on •What happens if D does not respond? •Arp waits for a timeout amount of time and then generates an error….which then triggers IP to generate an ICMP error message to the offending host

•ARP cache entries timeout after 20 minutes •Why? • To ensure unused IP’s are placed back in the pool

•Why is the entry removed regardless of if the host uses the information during the 20 minutes? • To handle the case if the target has been assigned a new IP address. 6 Address Resolution ARP Protocol: Case 1: Host A sends to Host D BUT Host D does not exit

Specific example, host a issues ‘ping –c hostd’

Host A Host B ping When IP reaches , whois broadcast

Ping timeouts, initiates next ping and next arp whois broadcast

Arp does not RETRY!!!! Ping timesout and causes the next arp ‘whois’ 7 Address Resolution

Case 2: Host D receives an ARP request message from Host A with target Host D.

….. Host D replies to Host A with a unicast ARP message providing Host D’s mac addr. Host D will cache The MAC/IP binding of Host A assuming it will need it in the near future.

Case 3: Host C observes the request from A to D. It will use it only if A’s mapping is in its cache AND it is different.

ARP topics:

•Arp command: CLI to access the arp cache •Gratuitous arp: A Gratuitous ARP is an ARP Response that was not prompted by an ARP Request. The Gratuitous ARP is sent as a broadcast, as a way for a node to announce or update its IP to MAC mapping to the entire network.

8 Address Resolution

Reverse Address Resolution Protocol

•Used when a diskless host boots to learn its IP address •There are other ways a Host can learn its Address: Bootp and DHCP

Host A R-ARP Server ------→ r arp req broadcast, supplies Host A’s mac addr ------If R-arp server sees Host A’s mac in its table, it returns a R-ARP reply supplying Host A an IP addr to us

Host B All other stations ignore the exchange9 DHCP

•Reverse ARP: used by a host at boot to map its physical address to its IP address to use. •Three drawbacks with RARP as a dynamic IP assignment protocol: •Operates at too low a level •Protocol is inefficient •Does not support dynamically assigned hardware addresses.

10 DHCP

•Two alternatives: •The Bootstrap protocol (BOOTP) •Dynamic Host Configuration Protocol (DHCP)

•BOOTP: •client / server model •client finds bootstrap information •defined by RFC 951 (year 1985) •Uses UDP as the transport (with checksum for error detection) •BOOTP adds reliability (timeouts and retransmission) •Uses a limited broadcast to find server

11 DHCP •BOOTP is a two step process – Assume Host A boots with Boot P. Requires a Boot P server on the network. And optionally requires a TFTP server holding OS images.

•Step 1: broadcast a request to the Bootp server asking for an IP and the IP addr of a TFTP server holding an image Host A will download and boot

•Step 2: If necessary, Host A uses an tiny FTP client to download an OS image from the TFTP server

Problems: •BOOTP is a static protocol •Requires a config file for each host •Can not dynamically change settings 12 DHCP •DHCP (RFC 2131 in year 1997) •Handles automated address assignment. •Allows a host to acquire all IP info needed (e.g., Subnet mask) in a single message. •DHCP server is supplied an address pool •Supports manual configuration or automatic

DHCP supports 3 modes: •manual configuration – DHCP server must have an entry that maps a specific Host MAC addr with an IP •automatic configuration: the DHCP server assigns to the client a permanent addr from the pool. •dynamic configuration: The DHCP server leases the client an IP address for a certain amount of time. 13 DHCP Message format:

DHCP Msg fields: OP: specifies req or reply

Options fields holds all other info: the first three fields of all options are: Byte 1: code; Byte 2: length of option Byte 3: Type The Type specifies the type of DHCP msg: DHCPDISCOVER, …. Over 200 options can be appended in the options field in a reply – The code/length specify the type of option (starting in octet 4) and how many octets are 14 in the option DHCP client state machine

DHCP client states: Init: Select: Bound: Renew: Rebind

15 DHCP Example: This is all that is in our ubuntu dhcp client conf file: send host-name = gethostname(); #send dhcp-lease-time 3600; request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, domain-search, host- name, dhcp6.name-servers, dhcp6.domain-search, netbios-name-servers, netbios-scope, interface-mtu, rfc3442-classless-static-routes, ntp-servers, dhcp6.fqdn, dhcp6.sntp-servers;

*It simply requests a number of configuration items…. 16