Leases, renewals, and options
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.
Before you start
Section titled “Before you start”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.
Read the time left
Section titled “Read the time left”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.
Wait for a direct renewal
Section titled “Wait for a direct renewal”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.
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:~$ Steps (22)
- Type
sudo dhcpcd -4 eth0 - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- 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 - Type
ip -4 address show eth0 - Press Enter
- 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 - Type
sudo dhcpcd -4 -k eth0 - Press Enter
- Output:
sending signal ALRM to pid 178 waiting for pid 178 to exit - Type
sudo tcpdump -n -v -i eth0 udp src port 67 - Press Enter
- Output:
tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes - The second terminal finished. Return here and press Ctrl+C to stop listening.
- 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 - Press Ctrl + C
- Output:
3 packets captured 3 packets received by filter 0 packets dropped by kernel - Type
sudo dhcpcd -4 -k eth0 - Press Enter
- Output:
sending signal ALRM to pid 209 waiting for pid 209 to exit
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:~$ Steps (23)
- Type
sudo dhcpcd -4 -l 120 eth0 - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- 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 - Type
ip -4 address show eth0 - Press Enter
- 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 - Type
sudo tcpdump -n -i eth0 port 67 or port 68 - Press Enter
- 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 - Press Ctrl + C
- Output:
2 packets captured 2 packets received by filter 0 packets dropped by kernel - Type
ip -4 address show eth0 # after renewal - Press Enter
- 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 - Type
ip route - Press Enter
- 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 - Type
cat /etc/resolv.conf - Press Enter
- 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.
Match options with applied settings
Section titled “Match options with applied settings”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.
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.
Mistakes to recognize
Section titled “Mistakes to recognize”“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.
Good to know
Section titled “Good to know”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.
Try it yourself
Section titled “Try it yourself”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.
Further reading
Section titled “Further reading”- Ubuntu dhcpcd manual, for requested lease times.
- Ubuntu ip-address manual, for valid and preferred lifetimes.
- RFC 2132, for DHCP options.