因為要部署kickstart自動化系統分發,所以需要在上面配置dhcp服務器,之前也使用同樣的機器進行配置,沒是沒有問題的,但是這次在配置了dhcpd.conf文件后,重啟服務的時候卻一直提示
[root@localhost ~]# service dhcpd restart
Starting dhcpd: [FAILED]
首先是以為dhcpd.conf的問題,進行配置文件的檢查,並重點關注是否有標點的中英文格式問題,全部重新輸入后還是提示failed,配置如下
ddns-update-style interim; ignore client-updates; allow booting; allowbootp; subnet 172.16.10.0 netmask 255.255.255.0 { option routers 172.16.10.1; option domain-name "s.un"; option domain-name-servers 172.16.10.1; option subnet-mask 255.255.255.0; option time-offset -18000; default-lease-time 21600; max-lease-time 43200; range dynamic-bootp 172.16.10.200 172.16.10.250; filename "pxelinux.0"; next-server 172.16.10.11; }
查看/var/log/message日志文件,
Nov 25 18:42:41 localhost dhcpd: For info, please visit https://www.isc.org/software/dhcp/ Nov 25 18:42:41 localhost dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file Nov 25 18:42:41 localhost dhcpd: Can't chown new lease file: Operation not permitted
從這里應該可以確認是Can't chown new lease file: Operation not permitted這句的問題,應該是lease的權限問題,在這里我做了兩個操作
1.直接刪除/var/lib/dhcpd下的所有lease結尾的文件
2.直接把iptables關閉
不過都不生效,查資料才知道應該是linux的selinux造成的問題,把selinux關閉就可以了
1、臨時關閉(不用重啟機器): setenforce 0 ##設置SELinux 成為permissive模式 ##setenforce 1 設置SELinux 成為enforcing模式 2、修改配置文件需要重啟機器: 修改/etc/selinux/config 文件 將SELINUX=enforcing改為SELINUX=disabled 重啟機器即可