我最近用 ubuntu 服务器替换了我的 windows 服务器,并且在设置 dhcp 时尝试添加“保留”客户端时遇到此错误。
expecting IP address or hostname
Jun 6 01:47:27 xee dhcpd: fixed-address:
Jun 6 01:47:27 xee dhcpd: ^
Jun 6 01:47:27 xee dhcpd: Configuration file errors encountered -- exiting
这是配置的部分:
host temple {
hardware ethernet BC:5F:F4:A2:29:96;
fixed-address: 10.1.1.12;
}
从我在网上找到的材料来看,这些都应该可以工作,所以我不太确定发生了什么。
编辑:这是我的全部配置:
ddns-update-style none;
option domain-name "lan";
option domain-name-servers xee.home.lan;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.3 10.1.1.253;
option routers 10.1.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 10.1.1.254;
option domain-name-servers 10.1.1.2, 8.8.8.8;
}
#host temple {
#hardware ethernet BC:5F:F4:A2:29:96;
#fixed-address 10.1.1.12;
#}
当取消注释时,注释部分会引发上述错误。
答案1
后面不应该有冒号fixed-address
。
这:
host temple {
hardware ethernet BC:5F:F4:A2:29:96;
fixed-address: 10.1.1.12;
}
应该是这样的:
host temple {
hardware ethernet BC:5F:F4:A2:29:96;
fixed-address 10.1.1.12;
}
根据整个dhcpd.conf
文件的更大背景进行编辑:
不要从动态地址保留池中分配固定地址。将选项移至全局,以便包含固定地址。我建议这样做:
ddns-update-style none;
option routers 10.1.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 10.1.1.254;
option domain-name "home.lan";
option domain-name-servers 10.1.1.2, 8.8.8.8;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.13 10.1.1.253;
}
host temple {
hardware ethernet BC:5F:F4:A2:29:96;
fixed-address 10.1.1.12;
}