0

I'm trying to configure a DHCP server with udhcpd.conf at the address 192.168.100.30. Here is the content of the file:

# Sample udhcpd configuration file (/etc/udhcpd.conf)

# The start and end of the IP lease block

start       192.168.100.25  #default: 192.168.0.20
end         192.168.100.29  #default: 192.168.0.254


# The interface that udhcpd will use

interface   eth0        #default: eth0


# The maximim number of leases (includes addressesd reserved
# by OFFER's, DECLINE's, and ARP conficts

#max_leases 254     #default: 254


#Examles
opt dns 8.8.8.8
option  subnet  255.255.255.240
opt router  192.168.100.30
option  dns 8.8.8.4     # appened to above DNS servers for a total of 3
option  domain  local
option  lease   864000      # 10 days of seconds

Then if on another machine I run

dhclient -v -d -s 192.168.100.30 eth0

The result is

/# dhclient -v -d -s 192.168.100.30 eth0
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/b6:60:eb:02:f7:c1
Sending on   LPF/eth0/b6:60:eb:02:f7:c1
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 192.168.100.30 port 67 interval 8
DHCPDISCOVER on eth0 to 192.168.100.30 port 67 interval 9
DHCPDISCOVER on eth0 to 192.168.100.30 port 67 interval 13

Using tcpdump on the server I was able to see that it receives the requests, so the client appears to work. Anyway, the server does not reply to the request. Any idea of how I can fix it?

2
  • 1
    Why do you put -s <ip> as dhclient option? It works this way - a client does not have any IP, it sends request (discovery) to broadcast... IMO as your client does not have an IP yet it cannot work. Omit -s <ip>.
    – Jiri B
    Mar 7, 2021 at 19:02
  • @JiriB it worked! Thank you. Add this as an answer, so I can accept it
    – Francesco
    Mar 7, 2021 at 19:05

1 Answer 1

2

As your client doesn't have any IPv4 yet, putting -s <ip> as dhclient option cannot work.

1
  • Reading the man page of the command, I would have expected the -s to work. Anyway, removing the option (as @JiriB suggested) worked.
    – Francesco
    Mar 7, 2021 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.