Networking / Intermediate: lifecycle, trust, and application protocols / Lesson 10
Trace DHCP leases, relays, and address lifecycle
Model renewal, rebinding, configuration application, and dual-stack differences without treating address assignment as a complete connectivity test.
On this page
Lesson goals
- Distinguish lease timers and client states.
- Explain relay-based subnet selection and option consistency.
- Separate DHCPv4, DHCPv6, router discovery, and conflict handling.
A lease is a timed protocol agreement
A DHCP client moves through protocol states rather than simply receiving a permanent address. Initial acquisition, renewal with a known server, rebinding more broadly, and expiry have different message and configuration implications. Supplied timers and lease duration must be interpreted under the applicable protocol. A successful exchange at one time does not guarantee later renewals or continued ownership after expiry. Record the client identity, server identity, selected subnet, address, options, and timing. Distinguish protocol completion from the operating system actually applying the intended configuration and the application selecting it.
Renewal and rebinding are separate phases
In DHCPv4, T1 and T2 describe transition timing within a lease. The protocol defines defaults when appropriate, but deployments can supply values, so do not hardcode a universal schedule into a diagnosis. Check their relationship to the actual lease and observation time. An offline state model can test a documented timeline without sending requests. It must not pretend to implement retransmission, server selection, or every client state. An expired lease is not the same as a temporarily unreachable renewal server while the lease remains valid. Preserve that distinction in user-visible explanations.
t1, t2, expiry = 1800, 3150, 3600
for elapsed in (1000, 2000, 3300, 3600):
state = 'expired' if elapsed >= expiry else ('rebinding' if elapsed >= t2 else ('renewing' if elapsed >= t1 else 'bound'))
print(f'{elapsed}:{state}')
1000:bound
2000:renewing
3300:rebinding
3600:expired
The timer values are explicit synthetic input, not a recommendation. The four printed phases model boundaries only and generate no discovery or renewal traffic.
A relay carries context across a routing boundary
A DHCP server can serve a subnet through a relay rather than sharing the client’s broadcast domain. Relay-provided context helps select the appropriate allocation and options under the protocol and deployment design. A wrong subnet association can therefore produce an apparently successful lease with unusable gateway or resolver settings. Do not diagnose only by whether an offer appeared. Review the expected relay path, server scope, pool boundaries, and option values using an authorized configuration inventory. This course supplies no relay commands and never broadcasts or modifies DHCP infrastructure.
Check the full configuration, not only the address
A plausible address can coexist with an incorrect prefix, gateway, DNS list, or domain-search setting. Offline validation can check that a conventional on-link gateway belongs to the intended subnet and that pool entries do not overlap reservations. Such checks support a plan; they do not detect every duplicate on a live link or prove policy reachability. Address conflict detection has its own mechanisms and evidence. Preserve whether a client uses static configuration, a reservation, or a dynamic lease, because changing the server’s pool does not necessarily change every client’s installed state immediately.
from ipaddress import ip_network, ip_address
subnet = ip_network('192.0.2.64/27')
options = {'router': '192.0.2.65', 'address': '192.0.2.70'}
for key, value in options.items():
print(key + '_in_subnet=' + str(ip_address(value) in subnet))
router_in_subnet=True
address_in_subnet=True
Both declared values belong to the /27. This is a consistency check only; it neither assigns them nor proves that the router exists or that the address is conflict-free.
IPv6 configuration combines independent mechanisms
DHCPv6 can provide addresses, delegated prefixes, and other parameters, while IPv6 router discovery and SLAAC contribute different information. Client identifiers and state models differ from DHCPv4, so a MAC-only inventory or a four-message IPv4 diagram is not a universal DHCPv6 explanation. A delegated prefix for a downstream network is also different from one host address. Record which mechanism supplies each setting and its lifetime. A dual-stack incident may affect only one family’s renewal or routing behavior. Compare that family explicitly rather than renewing or reconfiguring everything without a demonstrated cause.
Common errors and fixes
A valid address is called a valid complete lease setup
- Why it happens
- Prefix, router, resolver, and applied state were omitted.
- How to fix it
- Validate every required setting and its source.
- Prevent it next time
- Keep a complete option inventory.
One IPv4 exchange diagram is applied to DHCPv6
- Why it happens
- Different identities, states, and router-discovery roles were ignored.
- How to fix it
- Use the family-specific protocol model.
- Prevent it next time
- Document which mechanism supplies each parameter.
Server pool edits are assumed instantly applied
- Why it happens
- Client lease and installed-state lifecycle were ignored.
- How to fix it
- Track acknowledgement, application, and renewal separately.
- Prevent it next time
- Plan changes with existing lease state.
Check your understanding
1. A relay selects the wrong scope but the client receives an ACK. Why can connectivity fail?
Show worked solution
The acknowledged options can describe the wrong local network, gateway, or resolver. Protocol completion does not establish configuration correctness. Compare the intended subnet and all supplied options before attributing the failure to application code.
2. Why is a delegated IPv6 prefix not equivalent to one leased host address?
Show worked solution
The prefix represents an address block intended for downstream allocation or routing, with its own lifecycle. A host address is one endpoint assignment. Inventory and validation must preserve the role so a downstream network is not configured as though it were one interface address.
Key takeaways
- Track protocol state, option consistency, and installed state.
- Keep IPv4 and IPv6 configuration responsibilities distinct.