Docsity

Understanding DHCP and ARP: Communication between Hosts and Routers, Slides of Computer Networks

Partial preview of the text

Download Understanding DHCP and ARP: Communication between Hosts and Routers and more Slides Computer Networks in PDF only on Docsity!

Missing Pieces

Putting the pieces together

Today

  • Missing pieces
    • DHCP
    • ARP
  • Putting the pieces together
  • “What happens when I click on a link?”
  • More missing pieces

Discovery

  • A host is “born” knowing only its MAC address
  • Must discover lots of information before it can communicate with a

remote host B

  • what is my IP address?
  • what is B’s IP address? (remote)
  • what is B’s MAC address? (if B is local)
  • what is my first-hop router’s address? (if B is not local)
  • …

ARP and DHCP

  • Link layer discovery protocols
    • “Address Resolution Protocol”, “Dynamic Host Configuration Protocol”
    • confined to a single local-area network (LAN)
    • rely on broadcast capability of a LAN Hosts
Router

ARP and DHCP

  • Link layer discovery protocols
  • Serve two functions
    • Discovery of local end-hosts
    • Bootstrap communication with remote hosts
      • what’s my IP address?
      • who/where is my local DNS server?
      • who/where is my first hop router?

DHCP

  • “Dynamic Host Configuration Protocol”
    • defined in RFC 2131
  • A host uses DHCP to discover
    • its own IP address
    • its netmask
    • IP address(es) for its DNS name server(s)
    • IP address(es) for its first-hop “default” router(s)

DHCP: operation

1. One or more local DHCP servers maintain required information

2. Client broadcasts a DHCP discovery message

  • L2 broadcast, to MAC address FF:FF:FF:FF:FF:FF

DHCP: operation

1. One or more local DHCP servers maintain required information

2. Client broadcasts a DHCP discovery message

3. One or more DHCP servers responds with a DHCP “offer” message

  • proposed IP address for client, lease time
  • other parameters

DHCP: operation

1. One or more local DHCP servers maintain required information

2. Client broadcasts a DHCP discovery message

3. One or more DHCP servers responds with a DHCP “offer” message

4. Client broadcasts a DHCP request message

5. Selected DHCP server responds with an ACK

(DHCP “relay agents” used when the DHCP server isn’t on the same

broadcast domain -- see text)

DHCP uses “soft state”

  • Soft state: if not refreshed, state is forgotten
    • hard state: allocation is deliberately returned/withdrawn
    • used to track address allocation in DHCP
  • Implementation
    • address allocations are associated with a lease period
    • server: sets a timer associated with the record of allocation
    • client: must request a refresh before lease period expires
    • server: resets timer when a refresh arrives; sends ACK
    • server: reclaims allocated address when timer expires
  • Simple, yet robust under failure
    • state always fixes itself in (small constant of) lease time

Soft state under failure

  • What happens when server fails?
    • ACKs from server stop
    • XYZ releases address after O(lease period); send new request
    • A new DHCP server can come up from a `cold start’ and we’re back on track in ~lease time
Router

XYZ DHCP Server

a.b.c.d is mine from
(now, now+lease)
a.b.c.d is XYZ’s from
(now, now+c.lease)

Soft state under failure

  • What happens if the network fails?
    • refreshes and ACKs don’t get through
    • XYZ release address; DHCP server reclaims it
Router

XYZ DHCP Server

a.b.c.d is mine from
(now, now+lease)
a.b.c.d is XYZ’s from
(now, now+c.lease)

Sending Packets Over Link-Layer

  • Link layer only understands MAC addresses
    • Translate the destination IP address to MAC address
    • Encapsulate the IP packet inside a link-level frame
Router

Host (^) Host Host Host DNS 1.2.3.48 (^) 1.2.3. 90 - E2-A1- 09 - 66 - 1B 58 - 23 - D7-FA- 20 - B 1.2.3. 1.2.3. IP packet

ARP: Address Resolution Protocol

  • Every host maintains an ARP table
    • list of (IP address  MAC address) pairs
  • Consult the table when sending a packet
    • Map destination IP address to destination MAC address
    • Encapsulate the (IP) data packet with MAC header; transmit
  • But: what if IP address not in the table?
    • Sender broadcasts: “ Who has IP address 1.2.3.156 ?”
    • Receiver responds: “ MAC address 58- 23 - D7-FA- 20 - B0 ”
    • Sender caches result in its ARP table