我该如何修复“没有重新启动的子网声明(0.0.0.0)”?

我该如何修复“没有重新启动的子网声明(0.0.0.0)”?

我的发行版 Backtrack 5 R2(ubuntu 10.04)上安装了 DHCP 服务,并且它运行良好,但是当我开始配置 DNS 时它突然停止工作,我该如何让它再次工作??

dhcp.conf 文件:

ddns-update-style none;
option domain-name "admin.servers.net";

default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;

subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.50 192.168.0.100;
  option domain-name-servers 192.168.0.2, 8.8.4.4;
  option routers 192.168.0.254;
  option broadcast-address 192.168.0.255;
  default-lease-time 600;
  max-lease-time 7200;
}

当我重新启动服务时,它显示:

Internet Systems Consortium DHCP Server V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 4 leases to leases file.

No subnet declaration for restart (0.0.0.0).
** Ignoring requests on restart.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface restart is attached. **


Not configured to listen on any interfaces!

dhcp3-server 具有:

INTERFACES="eth0"

IP地址:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 04:7d:7b:15:29:6b brd ff:ff:ff:ff:ff:ff
inet 192.168.0.2/24 brd 192.168.0.255 scope global eth0
inet6 fe80::67d:7bff:fe15:296b/64 scope link 
   valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 74:e5:0b:57:b4:82 brd ff:ff:ff:ff:ff:ff

IP路由:

default via 192.168.0.254 dev eth0 
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.8 

在 /etc/网络/接口:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.2
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.254

路线-n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.254   0.0.0.0         UG    100    0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

答案1

您的 dhcpd.conf 看起来有点可疑。示例:

  • “选项路由器”:路由器网关 192.168.0.254 似乎不太可能,正常应该是“.1”。
  • “默认租用时间”:10 分钟太短了。

我建议阅读以下教程:Linux DHCP 服务器配置并根据开头的示例编写 dhcpd.conf,输入您的值(在“option time-offset”处停止)。

如果问题仍然存在,请更新您的帖子,并添加输出route -n

答案2

您使用哪种“DNS 服务”?通常,Bind 不会成为问题,但 dnsmasq 包含其自己的 DHCP 服务器。

需要澄清的是:如果在尝试重新启动 DHCP 服务器时 dnsmasq 已在运行,则 DHCP 服务器将无法绑定到端口 53。虽然我希望它输出稍微更合理的错误消息,但从技术上讲,它不会配置为监听任何接口。

答案3

您的配置看起来可以接受。看来您可能错误地重启了服务。

使用您问题中的确切配置:

root@bt:~# service dhcp3-server restart
* Stopping DHCP server dhcpd3 [fail]
* Starting DHCP server dhcpd3 [ OK ]

但是这个(错误的)命令给了我您发布的输出:

root@bt:~# dhcpd3 restart
Internet Systems Consortium DHCP Server V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 0 leases to leases file.

No subnet declaration for restart (0.0.0.0).
** Ignoring requests on restart.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface restart is attached. **


Not configured to listen on any interfaces!

如果这不起作用,请尝试重新配置包:

dpkg-reconfigure dhcp3-server

如果这不起作用,请重新安装该包(保存配置):

apt-get install --reinstall dhcp3-server

相关内容