安装DHCP服务配置了以后无法启动
查看状态
[root@localhost ~]# systemctl status dhcpd
● dhcpd.service - DHCPv4 Server Daemon
Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2018-03-01 17:19:40 CST; 12s ago
Docs: man:dhcpd(8)
man:dhcpd.conf(5)
Process: 4879 ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid (code=exited, status=1/FAILURE)
Main PID: 4879 (code=exited, status=1/FAILURE)
3月 01 17:19:40 bogon dhcpd[4879]: on ftp.isc.org. Features have been added and other changes
3月 01 17:19:40 bogon dhcpd[4879]: have been made to the base software release in order to make
3月 01 17:19:40 bogon dhcpd[4879]: it work better with this distribution.
3月 01 17:19:40 bogon dhcpd[4879]:
3月 01 17:19:40 bogon dhcpd[4879]: Please report for this software via the CentOS Bugs Database:
3月 01 17:19:40 bogon dhcpd[4879]: http://bugs.centos.org/
3月 01 17:19:40 bogon systemd[1]: dhcpd.service: main process exited, code=exited, status=1/FAILURE
3月 01 17:19:40 bogon systemd[1]: Failed to start DHCPv4 Server Daemon.
3月 01 17:19:40 bogon systemd[1]: Unit dhcpd.service entered failed state.
3月 01 17:19:40 bogon systemd[1]: dhcpd.service failed.
状态错误,查看dhcp配置文件
vim /etc/dhcp/dhcpd.conf
配置如下
subnet 192.168.15.0 netmask 255.255.255.0 {
range 192.168.15.100 192.168.15.199;
option routers 192.168.15.2;
option subnet-mask 255.255.255.0;
default-lease-time 21600;
max-lease-time 43200;
next server 192.168.15.201;
filename "/pxelinux.0";
}
配置next-server要带连字符“-”
修改后
subnet 192.168.15.0 netmask 255.255.255.0 {
range 192.168.15.100 192.168.15.199; #可分配起始IP-结束IP
option routers 192.168.15.2;
option subnet-mask 255.255.255.0;
default-lease-time 21600; #设置默认的IP租用期限
max-lease-time 43200; #设置最大IP租用期限
next-server 192.168.15.201; #告知客户端TFTP服务器的IP
filename "/pxelinux.0"; #告知客户端TFTP根目录下载pxlinux.0文件
}
保存后启动成功
[root@localhost ~]# systemctl status dhcpd
● dhcpd.service - DHCPv4 Server Daemon
Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; disabled; vendor preset: disabled)
Active: active (running) since 四 2018-03-01 17:37:39 CST; 6s ago
Docs: man:dhcpd(8)
man:dhcpd.conf(5)
Main PID: 5179 (dhcpd)
Status: "Dispatching packets..."
CGroup: /system.slice/dhcpd.service
└─5179 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
3月 01 17:37:39 bogon dhcpd[5179]: No subnet declaration for ens34 (no IPv4 addresses).
3月 01 17:37:39 bogon dhcpd[5179]: ** Ignoring requests on ens34. If this is not what
3月 01 17:37:39 bogon dhcpd[5179]: you want, please write a subnet declaration
3月 01 17:37:39 bogon dhcpd[5179]: in your dhcpd.conf file for the network segment
3月 01 17:37:39 bogon dhcpd[5179]: to which interface ens34 is attached. **
3月 01 17:37:39 bogon dhcpd[5179]:
3月 01 17:37:39 bogon dhcpd[5179]: Listening on LPF/ens33/00:0c:29:4b:71:eb/192.168.15.0/24
3月 01 17:37:39 bogon dhcpd[5179]: Sending on LPF/ens33/00:0c:29:4b:71:eb/192.168.15.0/24
3月 01 17:37:39 bogon systemd[1]: Started DHCPv4 Server Daemon.
3月 01 17:37:39 bogon dhcpd[5179]: Sending on Socket/fallback/fallback-net
低级错误