1

when a Linux Mint 20 virtualbox VM requests the network config to the home LAN router DHCP through isc-dhcp client with the stock /etc/dhcp/dhclient.conf config file everything runs fine:

(BTW 192.168.0.1 is the main router - Sercomm H500-s - with DHCP server enabled while 192.168.0.98 is another exact router acting as bridge and DHCP server disabled)

root@PC-a01-01:~# dhclient -v
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/enp0s3/08:00:27:f1:e3:2c
Sending on   LPF/enp0s3/08:00:27:f1:e3:2c
Sending on   Socket/fallback
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0xaf2ff163)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x63f12faf)
DHCPNAK from 192.168.0.98 (xid=0xaf2ff163)
DHCPACK of 192.168.0.123 from 192.168.0.1 (xid=0xaf2ff163)
cmp: EOF on /tmp/tmp.wezYhIRa8t which is empty
bound to 192.168.0.123 -- renewal in 41497 seconds.

But when I try to ask for a specific IP address, the dhclient gets stuck in an endless loop:

/etc/dhcp/dhclient.conf

interface "enp0s3" {
        send host-name = gethostname();
        send dhcp-requested-address 192.168.0.199;
}

dhclient -4 -v -cf /etc/dhcp/dhclient.conf

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/enp0s3/08:00:27:f1:e3:2c
Sending on   LPF/enp0s3/08:00:27:f1:e3:2c
Sending on   Socket/fallback
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x48fb1700)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 5 (xid=0x48fb1700)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x17fb48)
DHCPNAK from 192.168.0.98 (xid=0x48fb1700)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x17fb48)
DHCPNAK from 192.168.0.98 (xid=0x48fb1700)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x17fb48)
DHCPNAK from 192.168.0.98 (xid=0x48fb1700)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x43eff0c)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0xcff3e04)
DHCPNAK from 192.168.0.98 (xid=0x43eff0c)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0xcff3e04)
DHCPNAK from 192.168.0.98 (xid=0x43eff0c)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0xcff3e04)
DHCPNAK from 192.168.0.98 (xid=0x43eff0c)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x4ab08339)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x3983b04a)
DHCPNAK from 192.168.0.98 (xid=0x4ab08339)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x3983b04a)
DHCPNAK from 192.168.0.98 (xid=0x4ab08339)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x3983b04a)
DHCPNAK from 192.168.0.98 (xid=0x4ab08339)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x7e5bbe2b)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x2bbe5b7e)
DHCPNAK from 192.168.0.98 (xid=0x7e5bbe2b)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x2bbe5b7e)
DHCPNAK from 192.168.0.98 (xid=0x7e5bbe2b)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x2bbe5b7e)
DHCPNAK from 192.168.0.98 (xid=0x7e5bbe2b)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x2bbe5b7e)
DHCPNAK from 192.168.0.98 (xid=0x7e5bbe2b)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x32f5b011)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x32f5b011)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x11b0f532)
DHCPNAK from 192.168.0.98 (xid=0x32f5b011)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x11b0f532)
DHCPNAK from 192.168.0.98 (xid=0x32f5b011)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x11b0f532)
DHCPNAK from 192.168.0.98 (xid=0x32f5b011)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x77dca0a)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0xaca7d07)
DHCPNAK from 192.168.0.98 (xid=0x77dca0a)
^C

I've also tried the following procedure, while keeping /etc/dhcp/dhclient.conf in its stock/genuine state without luck:

rm -fr /var/lib/dhcp/dhclient.leases

nano -w /var/lib/dhcp/dhclient.leases

lease {
  interface "enp0s3";
  fixed-address 192.168.0.145;
  renew 0 2000/1/1 00:00:01;
  rebind 0 2000/01/01 00:00:01;
  expire 0 2038/1/1 00:00:01;
}


dhclient -4 -v -cf /etc/dhcp/dhclient.conf
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/enp0s3/08:00:27:f1:e3:2c
Sending on   LPF/enp0s3/08:00:27:f1:e3:2c
Sending on   Socket/fallback
DHCPREQUEST for 192.168.0.145 on enp0s3 to 255.255.255.255 port 67 (xid=0x1935a408)
DHCPNAK from 192.168.0.1 (xid=0x8a43519)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0xdf48dc0f)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0xfdc48df)
DHCPNAK from 192.168.0.98 (xid=0xdf48dc0f)
DHCPACK of 192.168.0.123 from 192.168.0.1 (xid=0xdf48dc0f)
cmp: EOF on /tmp/tmp.RmsqemfUfM which is empty
bound to 192.168.0.123 -- renewal in 39093 seconds.

nmap scan to probe a single DHCP server exists in the network:

nmap --script broadcast-dhcp-discover
Starting Nmap 7.80 ( https://nmap.org ) at 2020-09-18 21:38 CEST
Pre-scan script results:
| broadcast-dhcp-discover:
|   Response 1 of 1:
|     IP Offered: 192.168.0.124
|     DHCP Message Type: DHCPOFFER
|     Server Identifier: 192.168.0.1
|     IP Address Lease Time: 1d00h00m00s
|     Subnet Mask: 255.255.255.0
|     Router: 192.168.0.1
|     Domain Name Server: 176.103.130.130, 212.166.210.83, 212.166.132.96
|     Hostname: PWiFi
|     Domain Name: pperis.ddns.net
|     Renewal Time Value: 12h00m00s
|_    Rebinding Time Value: 21h00m00s
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 2.93 seconds

The following is the response I get after powering off the 192.168.0.98 router:

dhclient -4 -v -cf /etc/dhcp/dhclient.conf
rm -fr /var/lib/dhcp/dhclient.leases

# dhclient -4 -v -cf /etc/dhcp/dhclient.conf 
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/enp0s3/08:00:27:f1:e3:2c
Sending on   LPF/enp0s3/08:00:27:f1:e3:2c
Sending on   Socket/fallback
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0xe7d65802)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x258d6e7)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x258d6e7)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x258d6e7)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0x33d20f05)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x50fd233)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x50fd233)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x50fd233)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x50fd233)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0xf3558362)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x628355f3)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x628355f3)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x628355f3)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0xcd2ad06d)
DHCPOFFER of 192.168.0.123 from 192.168.0.1
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x6dd02acd)
DHCPREQUEST for 192.168.0.123 on enp0s3 to 255.255.255.255 port 67 (xid=0x6dd02acd)
^C

This is the /etc/dhcp/dhclient.conf config file for the previous output:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();
send dhcp-requested-address 192.168.0.189;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
timeout 300;

interface "enp0s3" {
        send host-name = gethostname();
       send dhcp-client-identifier 08:00:27:f1:e3:2c;
        send dhcp-requested-address 192.168.0.189;
}


Does anyone has the ability or an explanation to understand what's going on? I also would like to be able to ask for a specific IP address and if it's already in use get another one.

Thanks a lot in advanced!

peris
  • 488
  • 2
  • 9
  • 25

0 Answers0