DHCP 未在 Ubuntu 18.04 中启动

DHCP 未在 Ubuntu 18.04 中启动

我在 ubuntu 18.04 上(也尝试过 ubuntu 20.04)....但我无法运行 isc-dhcp-server

osboxes@osboxes:~$ sudo systemctl status isc-dhcp-server
● 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 Wed 2021-11-10 17:06:48 CET; 13min ago
       Docs: man:dhcpd(8)
    Process: 9991 ExecStart=/bin/sh -ec      CONFIG_FILE=/etc/dhcp/dhcpd.conf;      if [ -f /etc/ltsp/>
   Main PID: 9991 (code=exited, status=1/FAILURE)

nov 10 17:06:48 osboxes dhcpd[9991]: 
nov 10 17:06:48 osboxes dhcpd[9991]: If you think you have received this message due to a bug rather
nov 10 17:06:48 osboxes dhcpd[9991]: than a configuration issue please read the section on submitting
nov 10 17:06:48 osboxes dhcpd[9991]: bugs on either our web page at www.isc.org or in the README file
nov 10 17:06:48 osboxes dhcpd[9991]: before submitting a bug.  These pages explain the proper
nov 10 17:06:48 osboxes dhcpd[9991]: process and the information we find helpful for debugging.
nov 10 17:06:48 osboxes dhcpd[9991]: 
nov 10 17:06:48 osboxes dhcpd[9991]: exiting.
nov 10 17:06:48 osboxes systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=>
nov 10 17:06:48 osboxes systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'

还得到:

osboxes@osboxes:~$ /usr/sbin/dhcpd -f
Internet Systems Consortium DHCP Server 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
unable to create icmp socket: Operation not permitted
Config file: /etc/dhcp/dhcpd.conf
Database file: /var/lib/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
Can't open /var/lib/dhcp/dhcpd.leases for append.

If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug.  These pages explain the proper
process and the information we find helpful for debugging.

exiting.

也许并不重要,但是当 isc-dhcp-server 启动时,/var/lib/dh​​cp/dhcp.leases 会改变其权限:

osboxes@osboxes:~$ ls /var/lib/dhcp/dhcpd.leases -l
-rw-r--r-- 1 dhcpd dhcpd 219 nov 10 17:06 /var/lib/dhcp/dhcpd.leases
osboxes@osboxes:~$ sudo chmod -R 777 /var/lib/dhcp/
osboxes@osboxes:~$ ls /var/lib/dhcp/dhcpd.leases -l
-rwxrwxrwx 1 dhcpd dhcpd 219 nov 10 17:06 /var/lib/dhcp/dhcpd.leases
osboxes@osboxes:~$ sudo systemctl start isc-dhcp-server
osboxes@osboxes:~$ ls /var/lib/dhcp/dhcpd.leases -l
-rw-r--r-- 1 dhcpd dhcpd 219 nov 10 17:32 /var/lib/dhcp/dhcpd.leases

我的 /etc/dhcp/dhcpd.conf:

# dhcpd.conf
#

default-lease-time 60;
max-lease-time 60;
authoriative;                                                                                                                                             
                                                                                    
subnet 192.168.0.0 netmask 255.255.255.0 {
    range 192.168.0.10 192.168.0.30;
    #option domain-name-servers ns1.your_domain.com;
    #option domain-name "local.your_domain.com";
    option subnet-mask 255.255.255.0;
    option routers 192.168.0.1;
    option broadcast-address 192.168.0.255;

}

host VM1 {                                                                                                                                                      
  hardware ethernet 08:00:27:24:41:79;                                                                                                                          
  fixed-address 192.168.0.10;                                                                                                                                    
}

任何帮助或想法都将不胜感激

答案1

仅针对可能遇到同样问题的人

感谢@DougSmythies

我必须删除 /var/lib/dh​​cp 中的所有文件。

重新启动 DHCP 服务。

更改权限无效

相关内容