Wiki DE Start in the browser

Wiki › Protocols

DHCP

Handing out addresses automatically: discover, offer, request, ack, lease time, fixed assignments and DHCP relay across routers.

Layer
7 (Anwendung, über UDP 67/68)
Standard
RFC 2131, RFC 2132, RFC 1542
See an example
See demo

What for

Configuring a hundred devices by hand is tedious and error-prone. A DHCP server hands out address, mask, gateway and DNS server automatically, for a limited time (lease).

DORA

Stepfrom → toContent
Discoverclient → broadcast“Is there a DHCP server here?” (the client has no address yet: 0.0.0.0)
Offerserver → clientoffer: address, mask, gateway, DNS, lease time
Requestclient → broadcast“I take this server’s offer”
Ackserver → clientconfirmation; from now on the address is valid

After half the lease time the client renews. With ipconfig /release it returns the address, with /renew it gets a new one. Without an answer it repeats the discover and reports “no server” after three attempts.

DHCP in the simulation: discover, offer, request, acknowledgeDHCP in the simulation: discover, offer, request, acknowledge
DHCP in the simulation: discover, offer, request, acknowledge

Fixed assignments and relay

  • Reservation: a device with a certain MAC address always gets the same address, e.g. a printer.
  • DHCP relay: DHCP requests are broadcasts and do not cross routers. A router or layer 3 switch with ip helper-address forwards them to a central server and enters the network of the request (GIADDR). The server then chooses the matching range.
  • Pools on the router: routers and layer 3 switches can also be DHCP servers themselves (ip dhcp pool).

Typical mistakes

The range is too small (client groups!), overlaps with static addresses, or the gateway handed out is wrong. Clients without an answer show no valid address in ipconfig.

How to do it in leyoNET

The same text as in the app’s help (F1 key).

DHCP

A DHCP server hands out addresses in four steps: Discover (client broadcasts), Offer, Request, Ack. The server supplies address, mask, gateway and DNS. If the server is in another network, a router with DHCP relay forwards the requests. With a fixed assignment (reservation), a specific device, recognised by its MAC address, always gets the same address, e.g. a printer or a workstation; it may also lie outside the range. DHCP pools on a router or layer 3 switch (“DHCP” tab, “ip dhcp pool”): one pool per network with network, gateway and DNS; excluded addresses (“ip dhcp excluded-address”) are never handed out.

Private and public addresses

  • Private (10/8, 172.16/12, 192.168/16): local only, to the Internet via NAT/PAT
  • CGNAT (100.64/10): assigned by the provider, who translates again (Carrier-grade NAT)
  • Public: globally unique

Press A to show all addresses in colour. A «Public network» area marks networks with public addresses, e.g. a DMZ.

See an example

  • DHCP (DORA)

    A server assigns addresses to three clients.

    Discover, offer, request, ack for each client; then «ipconfig /all» shows the leased address.

    Watch live Project file

“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.

Practise

  • ★★★☆☆ Assign addresses via DHCP · 4 goals · Worksheet (German)
  • ★★★☆☆ UE01 network services: Watch SA company network with DHCP · 18 goals · Worksheet (German)
  • ★★★☆☆ UE08 DHCP on the layer 3 switch · 5 goals · Worksheet (German)
  • ★★★★☆ UE09 External DHCP: central server with relay · 6 goals · Worksheet (German)
  • ★★★☆☆ Protocol analysis – Task 2: DHCP · 5 goals · Worksheet (German)

In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.

What leyoNET simplifies

ProtocolLayerSimplification in the simulation
DHCP7Discover/offer/request/ack, relay (giaddr); without an answer the client repeats the discover after 4 s and 8 s (doubling, RFC 2131 section 4.1) and reports “no server” after the third attempt; renewal at half the lease time; fixed assignments (reservation by MAC address, also outside the range); pools on router and layer 3 switch (“ip dhcp pool”, excluded addresses); offer and ack as broadcast (client without address)

Standards

  • RFC 2131 – Dynamic Host Configuration Protocol
  • RFC 2132 – DHCP Options and BOOTP Vendor Extensions
  • RFC 1542 – Clarifications and Extensions for the Bootstrap Protocol

Read on

Found a mistake or have an idea? Source of this page on GitHub.