Skip to content

Leases, renewals, and options

Module
Getting Network Settings Automatically
Difficulty
Easy
Updated
Tested on
Ubuntu 24.04.5 LTS, netlab 1.0, GNU Bash 5.2.21, dhcpcd 10.0.6, tcpdump 4.99.4
On this page

The address is lent, not given. For how long, and what happens then? Tablet’s address display includes a lifetime. Read it, then leave the client running long enough to see it ask for more time. The second agreement needs fewer messages than the first.

Finish The initial lease exchange. Leave old machine shells and run netlab reset from the VM if needed. Keep dhcp on and other modes off. Open two tablet shells with netlab shell tablet. Follow the listener replay’s preparation first.

First obtain an ordinary lease with sudo dhcpcd -4 eth0. Run ip -4 address show eth0 in the same terminal. The word dynamic marks an address whose lifetime is managed dynamically. valid_lft is the remaining time the address is valid. preferred_lft is the remaining time it is preferred for starting communication.

Between renewals these counters fall each time you look. A renewal can raise them again. Your number will differ, especially if you pause between commands.

In the first reading, valid_lft 43200sec means 12 hours remain, while preferred_lft 37800sec means 10.5 hours remain preferred. Both describe the same address, but answer different lifetime questions.

The lease time is the period the server allows. A renewal requests more time before permission ends. In terminal 1 stop the IPv4 client with sudo dhcpcd -4 -k eth0, then start sudo tcpdump -n -v -i eth0 udp src port 67. This filter keeps server replies; -v prints their options.

The lab normally lends for 12 hours. Ask for two minutes with sudo dhcpcd -4 -l 120 eth0 in terminal 2, so renewal comes after about one minute instead of six hours. The -l option requests a lease time in seconds. The server chooses whether to grant it; here it grants 120 seconds.

Predict: Is the renewal sent to everyone, like the first request?

After the client obtains its short lease, run sudo tcpdump -n -i eth0 port 67 or port 68 in terminal 2. This listener records both directions without verbose details. Leave it running for about 70 seconds. Stop it with Ctrl+C before reading settings there, then stop terminal 1’s listener.

Watch a short lease renew — listener
learner@tablet:~$ sudo dhcpcd -4 eth0[sudo] password for learner: dhcpcd-10.0.6 starting
network namespace: tablet
eth0: soliciting a DHCP lease
eth0: offered 10.77.10.105 from 10.77.10.1
eth0: probing address 10.77.10.105/24
eth0: leased 10.77.10.105 for 43200 seconds
eth0: adding route to 10.77.10.0/24
eth0: adding default route via 10.77.10.1learner@tablet:~$ ip -4 address show eth08: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netns sw-home
    inet 10.77.10.105/24 brd 10.77.10.255 scope global dynamic noprefixroute eth0
       valid_lft 43200sec preferred_lft 37800seclearner@tablet:~$ sudo dhcpcd -4 -k eth0sending signal ALRM to pid 178
waiting for pid 178 to exitlearner@tablet:~$ sudo tcpdump -n -v -i eth0 udp src port 67tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes12:22:22.071721 IP (tos 0xc0, ttl 64, id 43798, offset 0, flags [none], proto UDP (17), length 330)
    10.77.10.1.67 > 10.77.10.105.68: BOOTP/DHCP, Reply, length 302, xid 0x8c6b4603, Flags [none]
	  Your-IP 10.77.10.105
	  Server-IP 10.77.10.1
	  Client-Ethernet-Address 02:77:10:00:01:00
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message (53), length 1: Offer
	    Server-ID (54), length 4: 10.77.10.1
	    Lease-Time (51), length 4: 120
	    RN (58), length 4: 60
	    RB (59), length 4: 105
	    Subnet-Mask (1), length 4: 255.255.255.0
	    BR (28), length 4: 10.77.10.255
	    Domain-Name (15), length 8: "lab.test"
	    Domain-Name-Server (6), length 4: 10.77.20.53
	    Default-Gateway (3), length 4: 10.77.10.1
12:22:22.077900 IP (tos 0xc0, ttl 64, id 43799, offset 0, flags [none], proto UDP (17), length 330)
    10.77.10.1.67 > 10.77.10.105.68: BOOTP/DHCP, Reply, length 302, xid 0x8c6b4603, Flags [none]
	  Your-IP 10.77.10.105
	  Server-IP 10.77.10.1
	  Client-Ethernet-Address 02:77:10:00:01:00
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message (53), length 1: ACK
	    Server-ID (54), length 4: 10.77.10.1
	    Lease-Time (51), length 4: 120
	    RN (58), length 4: 60
	    RB (59), length 4: 105
	    Subnet-Mask (1), length 4: 255.255.255.0
	    BR (28), length 4: 10.77.10.255
	    Domain-Name (15), length 8: "lab.test"
	    Domain-Name-Server (6), length 4: 10.77.20.53
	    Default-Gateway (3), length 4: 10.77.10.1
12:23:27.414035 IP (tos 0xc0, ttl 64, id 50533, offset 0, flags [none], proto UDP (17), length 330)
    10.77.10.1.67 > 10.77.10.105.68: BOOTP/DHCP, Reply, length 302, xid 0x3bff7c50, secs 65, Flags [none]
	  Client-IP 10.77.10.105
	  Your-IP 10.77.10.105
	  Server-IP 10.77.10.1
	  Client-Ethernet-Address 02:77:10:00:01:00
	  Vendor-rfc1048 Extensions
	    Magic Cookie 0x63825363
	    DHCP-Message (53), length 1: ACK
	    Server-ID (54), length 4: 10.77.10.1
	    Lease-Time (51), length 4: 120
	    RN (58), length 4: 56
	    RB (59), length 4: 101
	    Subnet-Mask (1), length 4: 255.255.255.0
	    BR (28), length 4: 10.77.10.255
	    Domain-Name (15), length 8: "lab.test"
	    Domain-Name-Server (6), length 4: 10.77.20.53
	    Default-Gateway (3), length 4: 10.77.10.1^C3 packets captured
3 packets received by filter
0 packets dropped by kernellearner@tablet:~$ sudo dhcpcd -4 -k eth0sending signal ALRM to pid 209
waiting for pid 209 to exitlearner@tablet:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. Terminal 1 prints the server's options, including both initial and renewal acknowledgments, then releases the client after listening.
Steps (22)
  1. Type sudo dhcpcd -4 eth0
  2. Press Enter
  3. Output: [sudo] password for learner:
  4. Type the password (the terminal shows nothing)
  5. Press Enter
  6. Output: dhcpcd-10.0.6 starting network namespace: tablet eth0: soliciting a DHCP lease eth0: offered 10.77.10.105 from 10.77.10.1 eth0: probing address 10.77.10.105/24 eth0: leased 10.77.10.105 for 43200 seconds eth0: adding route to 10.77.10.0/24 eth0: adding default route via 10.77.10.1
  7. Type ip -4 address show eth0
  8. Press Enter
  9. Output: 8: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netns sw-home inet 10.77.10.105/24 brd 10.77.10.255 scope global dynamic noprefixroute eth0 valid_lft 43200sec preferred_lft 37800sec
  10. Type sudo dhcpcd -4 -k eth0
  11. Press Enter
  12. Output: sending signal ALRM to pid 178 waiting for pid 178 to exit
  13. Type sudo tcpdump -n -v -i eth0 udp src port 67
  14. Press Enter
  15. Output: tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
  16. The second terminal finished. Return here and press Ctrl+C to stop listening.
  17. Output: 12:22:22.071721 IP (tos 0xc0, ttl 64, id 43798, offset 0, flags [none], proto UDP (17), length 330) 10.77.10.1.67 > 10.77.10.105.68: BOOTP/DHCP, Reply, length 302, xid 0x8c6b4603, Flags [none] Your-IP 10.77.10.105 Server-IP 10.77.10.1 Client-Ethernet-Address 02:77:10:00:01:00 Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message (53), length 1: Offer Server-ID (54), length 4: 10.77.10.1 Lease-Time (51), length 4: 120 RN (58), length 4: 60 RB (59), length 4: 105 Subnet-Mask (1), length 4: 255.255.255.0 BR (28), length 4: 10.77.10.255 Domain-Name (15), length 8: "lab.test" Domain-Name-Server (6), length 4: 10.77.20.53 Default-Gateway (3), length 4: 10.77.10.1 12:22:22.077900 IP (tos 0xc0, ttl 64, id 43799, offset 0, flags [none], proto UDP (17), length 330) 10.77.10.1.67 > 10.77.10.105.68: BOOTP/DHCP, Reply, length 302, xid 0x8c6b4603, Flags [none] Your-IP 10.77.10.105 Server-IP 10.77.10.1 Client-Ethernet-Address 02:77:10:00:01:00 Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message (53), length 1: ACK Server-ID (54), length 4: 10.77.10.1 Lease-Time (51), length 4: 120 RN (58), length 4: 60 RB (59), length 4: 105 Subnet-Mask (1), length 4: 255.255.255.0 BR (28), length 4: 10.77.10.255 Domain-Name (15), length 8: "lab.test" Domain-Name-Server (6), length 4: 10.77.20.53 Default-Gateway (3), length 4: 10.77.10.1 12:23:27.414035 IP (tos 0xc0, ttl 64, id 50533, offset 0, flags [none], proto UDP (17), length 330) 10.77.10.1.67 > 10.77.10.105.68: BOOTP/DHCP, Reply, length 302, xid 0x3bff7c50, secs 65, Flags [none] Client-IP 10.77.10.105 Your-IP 10.77.10.105 Server-IP 10.77.10.1 Client-Ethernet-Address 02:77:10:00:01:00 Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message (53), length 1: ACK Server-ID (54), length 4: 10.77.10.1 Lease-Time (51), length 4: 120 RN (58), length 4: 56 RB (59), length 4: 101 Subnet-Mask (1), length 4: 255.255.255.0 BR (28), length 4: 10.77.10.255 Domain-Name (15), length 8: "lab.test" Domain-Name-Server (6), length 4: 10.77.20.53 Default-Gateway (3), length 4: 10.77.10.1
  18. Press Ctrl + C
  19. Output: 3 packets captured 3 packets received by filter 0 packets dropped by kernel
  20. Type sudo dhcpcd -4 -k eth0
  21. Press Enter
  22. Output: sending signal ALRM to pid 209 waiting for pid 209 to exit
Watch a short lease renew — client
learner@tablet:~$ sudo dhcpcd -4 -l 120 eth0[sudo] password for learner: dhcpcd-10.0.6 starting
network namespace: tablet
eth0: soliciting a DHCP lease
eth0: offered 10.77.10.105 from 10.77.10.1
eth0: probing address 10.77.10.105/24
eth0: leased 10.77.10.105 for 120 seconds
eth0: adding route to 10.77.10.0/24
eth0: adding default route via 10.77.10.1learner@tablet:~$ ip -4 address show eth08: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netns sw-home
    inet 10.77.10.105/24 brd 10.77.10.255 scope global dynamic noprefixroute eth0
       valid_lft 120sec preferred_lft 105seclearner@tablet:~$ sudo tcpdump -n -i eth0 port 67 or port 68tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
12:23:27.405141 IP 10.77.10.105.68 > 10.77.10.1.67: BOOTP/DHCP, Request from 02:77:10:00:01:00, length 346
12:23:27.414035 IP 10.77.10.1.67 > 10.77.10.105.68: BOOTP/DHCP, Reply, length 302^C2 packets captured
2 packets received by filter
0 packets dropped by kernellearner@tablet:~$ ip -4 address show eth0 # after renewal8: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netns sw-home
    inet 10.77.10.105/24 brd 10.77.10.255 scope global dynamic noprefixroute eth0
       valid_lft 109sec preferred_lft 90seclearner@tablet:~$ ip routedefault via 10.77.10.1 dev eth0 proto dhcp src 10.77.10.105 metric 1008 
10.77.10.0/24 dev eth0 proto dhcp scope link src 10.77.10.105 metric 1008 learner@tablet:~$ cat /etc/resolv.conf# Written by dhcpcd on tablet (netlab) from the DHCP lease.
search lab.test
nameserver 10.77.20.53learner@tablet:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. Terminal 2 obtains the short lease, listens to the direct renewal pair, then reads the renewed settings.
Steps (23)
  1. Type sudo dhcpcd -4 -l 120 eth0
  2. Press Enter
  3. Output: [sudo] password for learner:
  4. Type the password (the terminal shows nothing)
  5. Press Enter
  6. Output: dhcpcd-10.0.6 starting network namespace: tablet eth0: soliciting a DHCP lease eth0: offered 10.77.10.105 from 10.77.10.1 eth0: probing address 10.77.10.105/24 eth0: leased 10.77.10.105 for 120 seconds eth0: adding route to 10.77.10.0/24 eth0: adding default route via 10.77.10.1
  7. Type ip -4 address show eth0
  8. Press Enter
  9. Output: 8: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netns sw-home inet 10.77.10.105/24 brd 10.77.10.255 scope global dynamic noprefixroute eth0 valid_lft 120sec preferred_lft 105sec
  10. Type sudo tcpdump -n -i eth0 port 67 or port 68
  11. Press Enter
  12. Output: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes 12:23:27.405141 IP 10.77.10.105.68 > 10.77.10.1.67: BOOTP/DHCP, Request from 02:77:10:00:01:00, length 346 12:23:27.414035 IP 10.77.10.1.67 > 10.77.10.105.68: BOOTP/DHCP, Reply, length 302
  13. Press Ctrl + C
  14. Output: 2 packets captured 2 packets received by filter 0 packets dropped by kernel
  15. Type ip -4 address show eth0 # after renewal
  16. Press Enter
  17. Output: 8: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netns sw-home inet 10.77.10.105/24 brd 10.77.10.255 scope global dynamic noprefixroute eth0 valid_lft 109sec preferred_lft 90sec
  18. Type ip route
  19. Press Enter
  20. Output: default via 10.77.10.1 dev eth0 proto dhcp src 10.77.10.105 metric 1008 10.77.10.0/24 dev eth0 proto dhcp scope link src 10.77.10.105 metric 1008
  21. Type cat /etc/resolv.conf
  22. Press Enter
  23. Output: # Written by dhcpcd on tablet (netlab) from the DHCP lease. search lab.test nameserver 10.77.20.53
Check your answer

No. The renewal Request goes from 10.77.10.105 directly to 10.77.10.1. The ACK returns directly, with Client-IP set. This pair is unicast, rather than another discovery broadcast.

Terminal 2’s listener starts after the initial agreement, so it shows only the renewal pair. Compare the initial ACK and renewal ACK timestamps in terminal 1: about 65 seconds pass in this capture. The renewal also prints secs 65. Your number will differ.

An option is a named item of configuration carried in a DHCP message. Read the first short-lease ACK’s options in the listener. Then compare the address, route, and file readings in terminal 2.

ACK item Captured value Tablet setting or meaning
Your-IP field 10.77.10.105 Interface address; this field is not an option
Subnet-Mask, option 1 255.255.255.0 Prefix /24
Default-Gateway, option 3 10.77.10.1 Default route
Domain-Name-Server, option 6 10.77.20.53 nameserver in /etc/resolv.conf
Lease-Time, option 51 120 seconds Lease duration
RN, option 58 60 seconds Renewal timer
RB, option 59 105 seconds Rebinding timer

The lab’s client hook writes the offered name server into tablet’s own /etc/resolv.conf. cat reads that file. Receiving a name-server address does not start the lab’s name service; that comes in How DNS Finds Services.

Rebinding means asking any available server if the original server has not renewed the lease. This timeline uses the timers in the initial ACK; a successful renewal starts another lease period.

A renewal starts another lease period A proportional time axis shows the original lease from 0 to 120 seconds, renewal due at 60, and rebinding due at 105. A nominal renewal at 60 starts another 120-second period ending at 180. Obtained 0 seconds Renewal 60 seconds Rebinding 105 seconds Expiry 120 seconds A renewal starts 120 more seconds 60 seconds 180 seconds
A renewal starts another lease period A proportional time axis shows the original lease from 0 to 120 seconds, renewal due at 60, and rebinding due at 105. A nominal renewal at 60 starts another 120-second period ending at 180. Obtained 0 seconds Renewal 60 seconds Rebinding 105 seconds Expiry 120 seconds A renewal starts 120 more seconds 60 seconds 180 seconds
Simplified model. Proportional lease times: the original period ends at 120 seconds; a nominal renewal at 60 seconds starts another 120-second period, ending at 180 seconds.

The half-time timer is 60 seconds; the observed exchange occurs about a minute after the first ACK. The normal 12-hour lease would put its half-time renewal at six hours, computed from the lab’s configured duration. Do not wait six hours for this exercise.

Different networks can supply different addresses, prefixes, gateways, name servers, and durations. Read the answer you received before deciding it is correct for your network. Automatic entry prevents some typing mistakes; it cannot judge an administrator’s intended values.

“An address is yours forever once given.” The valid lifetime is limited. Permission must be extended or the address stops being valid.

“Renewing gives a new address.” This capture extends the same address. Renewal does not require a change of address.

Returning to the prompt leaves dhcpcd running. The listener replay’s final release stops it. A VM-side netlab reset also stops programs inside the removed lab machines, then rebuilds the network.

Decide whether two address readings alone can prove that a renewal happened. Run sudo dhcpcd -4 -l 120 eth0, read ip -4 address show eth0, wait a few seconds, and read it again. Compare what those readings establish with what the listener established. Release the client when finished using sudo dhcpcd -4 -k eth0.

Solution

Falling counters show time passing. Rising counters suggest an extension, but address readings do not show who sent it or how. The captured Request and ACK establish the exchange and its direction. The first Request starts without an assigned source address; renewal uses the leased address.

  • Lifetimes show time left, and renewals extend permission.
  • The captured renewal uses a direct Request and ACK.
  • ACK options explain the applied prefix, route, name server, and timers.

Next, When configuration fails separates three faults by their evidence.