Certopolis

CompTIA A+ Core 1

DHCP leases, scopes and APIPA 169.254 addresses for A+

A DHCP client gets its address through a broadcast exchange over UDP, server port 67 and client port 68, and renews by default at half the lease time. If no DHCP server answers, a host can give itself a 169.254.x.x link-local address. That address reaches only the local link, because routers must not forward it.

Getting and renewing a lease

RFC 2131 describes the exchange: the client broadcasts DHCPDISCOVER, servers reply with DHCPOFFER, the client broadcasts DHCPREQUEST for the offer it chose, and that server confirms with DHCPACK.

DHCP runs over UDP. Client messages go to the DHCP server port, 67. Server messages go to the DHCP client port, 68. A firewall rule that allows TCP 67 and 68 blocks DHCP.

The client keeps two timers. T1 defaults to 0.5 times the lease duration, and at T1 the client asks the server that issued the address to extend it. T2 defaults to 0.875 times the lease. If no DHCPACK has arrived by T2, the client broadcasts its request to any server.

169.254.x.x (APIPA, link-local)

RFC 3927 lets a host configure itself with an address in 169.254/16 when no address configuration is available, such as when no DHCP server answers. Microsoft calls this feature Automatic Private IP Addressing (APIPA): a Windows computer set to use DHCP assigns itself an address in 169.254.0.0-169.254.255.255 if no DHCP server is available.

These addresses work only with devices on the same physical or logical link. RFC 3927 says a router must not forward a packet with a link-local source or destination address, whatever its routes. Adding a default gateway does not help.

Two self-addressed PCs on the same switch can reach each other. Neither can reach a server on another subnet. While DHCP is down, the way to get a routable address is to configure a static IP address by hand.

Serving several subnets

Microsoft's DHCP deployment guide says DHCP messages are broadcasts, so routers do not forward them between subnets by default. To serve several subnets, either install a DHCP server on each subnet, or have routers forward DHCP broadcasts and create one scope per subnet on the server.

A scope is the range of addresses for one subnet, with options such as DNS servers and the default gateway. If a router already forwards a new subnet's requests but clients get no address, the server is missing a scope for that subnet.

Exclusion ranges keep addresses in a scope from being leased, for devices you configure statically.

Where the exam catches people

  • Believing a lease is renewed only when it expires: by default the client first tries at half the lease time (T1).
  • Believing DHCP uses TCP: RFC 2131 says it uses UDP on ports 67 and 68.
  • Believing a 169.254 address works once a gateway is set: routers must not forward link-local packets, so the host needs a routable address.
  • Believing forwarding DHCP broadcasts is enough for a new subnet: the server also needs a scope for that subnet.

Written from CompTIA's documentation

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. An office's DHCP server has failed, and a workstation has assigned itself a 169.254.x.x address. It reaches another self-addressed workstation on its switch, but not a file server on another subnet, even after the technician enters the router as its gateway. Which of the following should the technician configure until the server is repaired?

    Right. In the game that’s Renown for your Networking building.

    Not that one: B is right. In the game your Networking building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The workstation therefore needs a routable address, and with DHCP down the RFC's other way to get one is manual configuration: a static IP address on the office subnet.

    Written from www.rfc-editor.org/rfc/rfc3927.html

  2. A laptop that stays powered on and connected all day receives an IPv4 address from the office's DHCP server, which uses default renewal timing. A technician captures the laptop's traffic to see when it first tries to extend that lease. Which of the following describes when this happens?

    Right. In the game that’s Renown for your Networking building.

    Not that one: B is right. In the game your Networking building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    At T1 the client first sends a request to the server that issued the address, so with default timing the first attempt comes after half of the lease.

    Written from www.rfc-editor.org/rfc/rfc2131.html

  3. An office's DHCP server leases addresses to clients on the first-floor subnet. A router now forwards DHCP broadcasts from a new second-floor subnet to that server, but second-floor laptops still receive no addresses. Which of the following should the administrator do?

    Right. In the game that’s Renown for your Networking building.

    Not that one: D is right. In the game your Networking building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The router already forwards the second floor's requests, so the missing piece is a scope for that subnet; the guide adds that forwarding is in most cases more cost effective than a server on each segment.

    Written from learn.microsoft.com/en-us/windows-server/networking/technologies/dhcp/dhcp-deploy-wps