我正在尝试设置我的家庭服务器(Ubuntu 16.04 LTS - 服务器)以包含 DHCP 角色,但它无法启动。
我查看了大量文档和帮助页面,但每当我查看 DHCP 服务器的状态时,它都会显示错误消息,而当我启动 DHCP 服务器时,它却返回 OK。我知道它没有运行(尽管在启动时已启用),因为 Webmin 显示情况确实如此,而且我无法使用 DHCP 获取 IP 地址。
我有一台路由器,我已禁用其 DHCP 服务器,因此这并不是与它冲突,并且当我在我的任何一台机器上分配一个静态 IP(总共 4 台,有许多移动设备)时,机器都能正常工作。
我对 Ubuntu 还很陌生,但我的专业是 Windows IT 支持,所以并不是说我没有技术头脑。
我已经附加了我的 dhcp.conf 文件,如果有人能看一下并看看我是否做错了什么,我将不胜感激。
此外,如果您能给我一些指点,以便我可以“调试”错误消息,我将不胜感激。
/etc/dhcp/dhcp.conf 如下:
ddns-update-style none;
default-lease-time 300;
max-lease-time 84000;
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
range 192.168.1.150 192.168.1.175;
# Chromecast
host Chromecast {
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
hardware ethernet a4:77:33:d1:c0:f8;
fixed-address 192.168.1.5;
}
# Vonage (XXXXXXXXX - oops)
host Vonage {
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
hardware ethernet c0:cb:38:49:81:6f;
fixed-address 192.168.1.34;
}
# Synology NAS
host DiskStation {
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
hardware ethernet 00:11:32:02:c9:da;
fixed-address 192.168.1.202;
}
# Grandstream GXP2130 Phone
host GXP2130 {
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
hardware ethernet 00:0b:82:7e:d4:64;
fixed-address 192.168.1.96;
}
# Epson Photosmart PX820FWD Printer
host Epson-PX820FWD {
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
hardware ethernet 00:26:ab:c2:13:f2;
fixed-address 192.168.1.50;
}
# Home Theatre PC
host HTPC {
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
hardware ethernet d0:50:99:1b:3e:fa;
fixed-address 192.168.1.102;
}
# My Business Server
host mybusinessserver {
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
hardware ethernet 00:21:86:f0:e5:4e;
fixed-address 192.1682.1.201;
}
}
我收到的错误消息(对于状态报告)有点含糊不清,因为它没有告诉我为什么失败,只是失败了,如下所示:
â isc-dhcp-server.service - ISC DHCP IPv4 server
Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2017-02-12 14:52:21 WET; 39min ago
Docs: man:dhcpd(8)
Process: 3219 ExecStart=/bin/sh -ec CONFIG_FILE=/etc/dhcp/dhcpd.conf; if [ -f /etc/ltsp/dhcpd.conf ]; then CONFIG_FILE=/etc/ltsp/dhcpd.conf; fi; [ -e /var/lib/dhcp/dhcpd.leases ] || touch /var/lib/dhcp/dhcpd.leases; chown root:dhcpd /var/lib/dhcp /var/lib/dhcp/dhcpd.leases; chmod 775 /var/lib/dhcp ; chmod 664 /var/lib/dhcp/dhcpd.leases; exec dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf $CONFIG_FILE $INTERFACES (code=exited, status=1/FAILURE)
Main PID: 3219 (code=exited, status=1/FAILURE)
Feb 12 14:52:21 mybusinessserver dhcpd[3219]: before submitting a bug. These pages explain the proper
Feb 12 14:52:21 mybusinessserver sh[3219]: before submitting a bug. These pages explain the proper
Feb 12 14:52:21 mybusinessserver dhcpd[3219]: process and the information we find helpful for debugging..
Feb 12 14:52:21 mybusinessserver sh[3219]: process and the information we find helpful for debugging..
Feb 12 14:52:21 mybusinessserver dhcpd[3219]:
Feb 12 14:52:21 mybusinessserver dhcpd[3219]: exiting.
Feb 12 14:52:21 mybusinessserver sh[3219]: exiting.
Feb 12 14:52:21 mybusinessserver systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE
Feb 12 14:52:21 mybusinessserver systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Feb 12 14:52:21 mybusinessserver systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
我注意到用户和组被指定为“dhcp”。这是在安装时实例化的东西吗?我不记得在任何地方设置过它们。
希望有人能帮助我,因为我不知道下一步该怎么做,而且现在我的所有设备都无法获取 DHCP 的 IP,因此所有东西都是静态分配的,这不是我真正想要做的。
期望您的帮助和支持。
克里斯
附言:我已经完成了 apt-get update、apt-get upgrade 和(只是为了确保)apt-get dist-upgrade,但都返回无需采取任何措施/一切都是最新的。
答案1
您的池和您的专用任务重叠。建议改为:
ddns-update-style none;
default-lease-time 300;
max-lease-time 84000;
authoritative;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.150 192.168.1.175;
}
# Chromecast
host Chromecast {
hardware ethernet a4:77:33:d1:c0:f8;
fixed-address 192.168.1.5;
}
# Vonage (XXXXXXXXX - oops)
host Vonage {
hardware ethernet c0:cb:38:49:81:6f;
fixed-address 192.168.1.34;
}
# Synology NAS
host DiskStation {
hardware ethernet 00:11:32:02:c9:da;
fixed-address 192.168.1.202;
}
# Grandstream GXP2130 Phone
host GXP2130 {
hardware ethernet 00:0b:82:7e:d4:64;
fixed-address 192.168.1.96;
}
# Epson Photosmart PX820FWD Printer
host Epson-PX820FWD {
hardware ethernet 00:26:ab:c2:13:f2;
fixed-address 192.168.1.50;
}
# Home Theatre PC
host HTPC {
hardware ethernet d0:50:99:1b:3e:fa;
fixed-address 192.168.1.102;
}
# My Business Server
host mybusinessserver {
hardware ethernet 00:21:86:f0:e5:4e;
fixed-address 192.168.1.201;
}
答案2
配置有错误
fixed-address 192.1682.1.201;
不确定这是否存在于磁盘上或只是在写入过程中发生。如果不是原因,请运行journalctl
并查找dhcpd
错误。