Dhcp

為什麼 udhcpd 不響應 DHCP 請求?

  • March 7, 2021

我正在嘗試配置udhcpd.conf地址為 192.168.100.30 的 DHCP 伺服器。這是文件的內容:

# 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

然後,如果在另一台機器上我執行

dhclient -v -d -s 192.168.100.30 eth0

結果是

/# 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

在伺服器上使用 tcpdump 我能夠看到它接收到請求,因此客戶端似乎可以工作。無論如何,伺服器不會回復請求。知道如何解決嗎?

由於您的客戶端還沒有任何 IPv4,-s <ip>因此作為dhclient選項無法正常工作。

引用自:https://unix.stackexchange.com/questions/638046