Score:0

Difference between ifup and dhclient - different result?

sd flag

On Debian 10 (buster), I configured the DHCP with the MAC address but it does not work.
When i use "ifup" command, the result is wrong.

I need to configure this IP: 192.168.251.11
but DHCP attributes this IP : 192.168.251.143

Example with ifup

# ifup eno1
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eno1/b8:cb:29:dd:b2:1e
Sending on   LPF/eno1/b8:cb:29:dd:b2:1e
Sending on   Socket/fallback
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 12
DHCPOFFER of 192.168.251.143 from 192.168.251.2
DHCPREQUEST for 192.168.251.143 on eno1 to 255.255.255.255 port 67
DHCPACK of 192.168.251.143 from 192.168.251.2
bound to 192.168.251.143 -- renewal in 1512 seconds.

Example with dhclient
IP is correct.

# dhclient -v eno1
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eno1/b8:cb:29:dd:b2:1e
Sending on   LPF/eno1/b8:cb:29:dd:b2:1e
Sending on   Socket/fallback
DHCPREQUEST for 192.168.251.11 on eno1 to 255.255.255.255 port 67
DHCPREQUEST for 192.168.251.11 on eno1 to 255.255.255.255 port 67
DHCPACK of 192.168.251.11 from 192.168.251.2
bound to 192.168.251.11 -- renewal in 8182 seconds.

I would like to understand the difference and resolve the problem. When the server reboot, the wrong IP is attributed.

Thank for your help and explanation.

A.B avatar
cl flag
A.B
use ifup -v (like you used dhclient -v): it might show the actual dhclient command run. I guess the lease file used isn't the same, and your DHCP server (especially if it loses memory in some virtual environment) might not react the same. Notice how there's no DHCPDISCOVER in the 2nd case: address already known by the client, submitted to the server and accepted. The real fix is probably on the DHCP server rather than client.
Score:0
sd flag

I found a solution but not the answer.
→ Original solution and more explanations here : https://superuser.com/a/1517961/863534

In /etc/dhcp/dhclient.conf file, add this line:

send dhcp-client-identifier = hardware;

(optionnal) Release old IP:

ifdown interface1
dhcp -r interface1

Delete for all interfaces (or specific interfaces) (not sure it's useful)

rm /var/lib/dhcp/dhclient.*

After reboot, server client will get the correct IP.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.