在我的Raspberry Pi上的/etc/dhcpcd.conf中,我有:
# fallback to static profile on eth0
profile static_eth0
static ip_address=192.168.60.100/24
static routers=192.168.60.250
static domain_name_servers=192.168.60.250
interface eth0
fallback static_eth0但是,即使DHCP地址可用,我也始终收到回退地址。
手动运行dhcpcd,这是我看到的:
$sudo dhcpcd -B -d -w -4 eth0
dhcpcd-8.1.2 starting
eth0: executing `/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
eth0: executing `/lib/dhcpcd/dhcpcd-run-hooks' CARRIER
eth0: delaying IPv4 for 0.8 seconds
eth0: using ClientID 01:b8:27:eb:22:1c:05
eth0: soliciting a DHCP lease
eth0: sending DISCOVER (xid 0x274915b3), next in 3.4 seconds
eth0: sending DISCOVER (xid 0x274915b3), next in 7.7 seconds
eth0: offered 192.168.10.220 from 192.168.10.1
eth0: sending REQUEST (xid 0x274915b3), next in 3.3 seconds
eth0: selected profile static_eth0
eth0: using ClientID 01:b8:27:eb:22:1c:05
eth0: using static address 192.168.60.100/24
eth0: adding IP address 192.168.60.100/24 broadcast 192.168.60.255
eth0: adding route to 192.168.60.0/24
eth0: adding default route via 192.168.60.250
eth0: ARP announcing 192.168.60.100 (1 of 2), next in 2.0 seconds
eth0: executing `/lib/dhcpcd/dhcpcd-run-hooks' STATIC
eth0: ARP announcing 192.168.60.100 (2 of 2)请注意,192.168.10.1提供了DHCP地址,但仍选择了回退。
这里发生什么事情?那我怎么阻止它呢?
如果我从dhcpcd.conf中删除了回退行,那么所提供的DHCP地址就会被毫无问题地接受。
发布于 2020-10-21 21:58:09
我遇到过类似的问题(dhcpcd在向DHCP服务器请求IP后回退到静态配置文件),虽然我还没有解决方案,但我找到了原因:
我的系统时间在关闭时不会被维护(它通常从NTP服务器获取时间)。如果上一次DHCP租约在关闭时过期,则在下次重新启动时,系统时间会滞后,并直接回退到静态配置文件。由于没有可通过静态IP访问的NTP服务器,因此系统将停留在此状态。
https://stackoverflow.com/questions/62191940
复制相似问题