我遇到了 dhclient 的一个常见问题。但我无法找到该问题的明确解决方案。
系统:
- ReadyNas RN104
- armhf 的原装 Debian
- 刚刚升级到 Debian Jessie
- 自建整体式(即无模块)内核 4.0.5
如果我手动调用,sudo dhclient eth0
一切都正常。
我如何告诉 dhclient 自动使用 eth0?
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 72:84:91:48:ff:51
inet6 addr: fe80::7084:91ff:fe48:ff51/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:63 errors:0 dropped:0 overruns:0 frame:0
TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:532
RX bytes:6743 (6.5 KiB) TX bytes:26010 (25.4 KiB)
Interrupt:26
$ sudo dhclient -v
Internet Systems Consortium DHCP Client 4.3.1
...
No broadcast interfaces found - exiting.
$ cat /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
# max address from uboot printenv ethaddr, eth1addr
pre-up ip link set dev eth0 address 28:XX:XX:XX:XX:X4
pre-up ip link set dev eth1 address 28:XX:XX:XX:XX:X5
$ dmesg |grep eth
mvneta d0070000.ethernet eth0: Using random mac address 72:84:91:48:XX:XX
mvneta d0074000.ethernet eth1: Using random mac address f2:0c:25:7d:XX:XX
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
mvneta d0070000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
mvneta d0070000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
$cat ./devices/platform/soc/soc:internal-regs/d0070000.ethernet/net/eth0/flags
0x1003
答案1
我遇到了同样的问题,我最近将 Raspberry PI 1 Model B 从 Raspian Wheezy 升级到了 Jessie。启动后,接口 eth0 已启动,但没有分配 DHCP 地址。运行dhclient
不带参数会导致No broadcast interfaces found - exiting
运行dhclient eth0
正常。
对我来说,解决方案是添加auto eth0
到/etc/网络/接口(但不确定为什么):
auto lo
auto eth0
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp