正在尝试设置新的服务器来运行多雾路段开启。我已将服务器设置为仅在 eth1 上提供 DHCP 地址,而不在 eth0 上提供。我在服务器上安装了 isc-dhcp 和 bind9。
我无法为客户端分配 DHCP 地址。在 /var/log/syslog 文件中,我反复看到以下内容:
Sep 14 08:10:03 fog dhcpd: DHCPDISCOVER from (mac address here) (N049) via eth1
Sep 14 08:10:03 fog dhcpd: DHCPOFFER on 192.168.10.20 to (mac address here) (N049) via eth1
Sep 14 08:10:19 fog dhcpd: DHCPDISCOVER from (mac address here) (N049) via eth1
Sep 14 08:10:19 fog dhcpd: DHCPOFFER on 192.168.10.20 to (mac address here) (N049) via eth1
我的 /etc/dhcp/dhcpd.conf 文件如下所示:
ddns-update-style interim;
ddns-domainname "chcfog.local";
ddns-rev-domainname "10.168.192.in-addr.arpa";
#include "/etc/bind/rndc.key";
key "rndc-key" {
algorithm hmac-md5;
secret "my key here";
};
zone theapartment.lan. {
primary 127.0.0.1;
key "rndc-key";
}
# option definitions common to all supported networks...
option domain-name "chcfog.local";
option domain-name-servers 192.168.1.11, 208.67.222.222, 208.67.220.220;
#option domain-name-servers 192.168.1.1;
#default-lease-time 600;
#max-lease-time 7200;
default-lease-time 86400;
max-lease-time 86400;
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.10 192.168.10.150;
zone 10.168.192.in-addr.arpa. {
primary 192.168.10.1;
key "rndc-key";
}
}
我的/etc/bind/named.conf.local:
key "rndc-key" {
algorithm hmac-md5;
secret "my key here";
};
zone "chcfog.local" {
type master;
file "/var/lib/bind/chcfog.local.hosts";
allow-update { key rndc-key; };
};
zone "10.168.192.in-addr.arpa" {
type master;
file "/var/lib/bind/10.168.192.rev";
allow-update { key rndc-key; };
};
我的 10.168.192.rev 文件:
$ORIGIN .
$TTL 86400 ; 1 day
10.168.192.in-addr.arpa IN SOA ns.chcfog.local. email.address.here. (
1263187366 ; serial
10800 ; refresh (3 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
38400 ; minimum (10 hours 40 minutes)
)
NS ns.chcfog.local.
1 PTR ns.chcfog.local.
我的 chcfog.local.hosts 文件:
$ORIGIN .
$TTL 86400 ; 1 day
chcfog.local IN SOA ns.chcfog.local. dkassner.centerforhospice.org. (
1263527838 ; serial
10800 ; refresh (3 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
38400 ; minimum (10 hours 40 minutes)
)
NS ns.chcfog.local.
A 192.168.10.1
ns.chcfog.local A 192.168.10.1
ns A 192.168.10.1
/etc/network/interfaces 的 eht1 部分
auto eth1
iface eth1 inet static
address 192.168.10.1
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
知道为什么这个 DHCP 服务器无法工作吗?
答案1
DHCP 服务器确实在工作(它发送DHCPOFFER
响应客户端的DHCPDISCOVER
)。但是,服务器从未收到DHCPREQUEST
客户端发送的 ,以实际请求提供的地址。
在服务器和客户端上运行tcpdump -n udp port 68
或,然后在客户端上运行。 两端的转储应显示客户端是否未从服务器接收到或服务器是否未从客户端接收到。dhcpdump -i INTERFACE
dhclient -1
DHCPOFFER
DHCPREQUEST