我在 Debian 8 中准备了 dhcpd 配置,它成功运行,但后来我添加了 bridge,dhcpd 失败了。
桥:
root@remote:/home/s# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00224dad5ddf no eth0
eth1
root@remote:/home/s# cat /etc/network/interfaces
auto lo br0
iface lo inet loopback
iface ppp0 inet wvdial
provider orange
iface eth0 inet manual
iface eth1 inet manual
allow-hotplug br0
iface br0 inet static
bridge_ports eth0 eth1
address 192.168.0.1
netmask 255.255.255.0
root@remote:/home/s#
dhcpd:
root@remote:/home/s# systemctl -l status isc-dhcp-server.service
● isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server)
Active: failed (Result: exit-code) since Sun 2018-07-01 21:51:43 CEST; 24min ago
Process: 1037 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
Jul 01 21:51:41 remote dhcpd[1076]: No subnet declaration for eth0 (no IPv4 addresses).
Jul 01 21:51:41 remote dhcpd[1076]: ** Ignoring requests on eth0. If this is not what
Jul 01 21:51:41 remote dhcpd[1076]: you want, please write a subnet declaration
Jul 01 21:51:41 remote dhcpd[1076]: in your dhcpd.conf file for the network segment
Jul 01 21:51:41 remote dhcpd[1076]: to which interface eth0 is attached. **
Jul 01 21:51:43 remote isc-dhcp-server[1037]: Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed!
Jul 01 21:51:43 remote isc-dhcp-server[1037]: failed!
Jul 01 21:51:43 remote systemd[1]: isc-dhcp-server.service: control process exited, code=exited status=1
Jul 01 21:51:43 remote systemd[1]: Failed to start LSB: DHCP server.
Jul 01 21:51:43 remote systemd[1]: Unit isc-dhcp-server.service entered failed state.
root@remote:/home/s# cat /etc/dhcp/dhcpd.conf
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.2 192.168.0.6;
option domain-name-servers 8.8.8.8,8.8.4.4;
option routers 192.168.0.1;}
root@remote:/home/s#
如何添加"subnet declaration for eth0"
并修复 dhcpd 服务?
您原来的 DHCP 服务器配置使用了 eth0。您现在已经用 br0 替换了网络定义中的那个,因此您需要相应地更新您的 DHCP 服务器配置。