再次:无法启动 LSB:DHCP 服务器

再次:无法启动 LSB:DHCP 服务器

我想用我的覆盆子创建这样的东西。


                        │ Uplink
           ┌────────────┴────────────┐
           │          wlan0          │
           │     192.168.1.65/24     │
           │                         │
           │        semplice         │
           │                         │
           │       10.10.1.1/24      │
           │          eth0           │
           └────────────┬────────────┘
 ┌──────────────┬───────┴────────┬──────────────┐
 │              │                │              │

主机 1 主机 2 主机 3 主机 4 10.10.1.21 10.10.1.22 10.10.1.23 10.10.1.24

我安装了

sudo apt-get install isc-dhcp-server

我的/etc/network/interfaces

    auto lo
    iface lo inet loopback

    iface eth0 inet static #// We want a static address
    address 172.16.20.21
    gateway 172.16.20.62 #//My router as this points to the internet
    netmask 255.255.255.0

                 
    # Include files from /etc/network/interfaces.d:
    source-directory /etc/network/interfaces.d

我的 /etc/default/isc-dhcp-server

INTERFACES="eth0"

最后是我的“/etc/dhcp/dhcpd.conf”

  subnet 172.16.20.0 netmask 255.255.255.0 {
  option subnet-mask 255.255.255.0;
  range 172.16.20.10 172.16.20.19;
  range 172.16.20.30 172.16.20.49;
  option domain-name-servers 172.16.20.62;
  option domain-name "home";
  option routers 172.16.20.62;
  option broadcast-address 172.16.20.255;
  option domain-name "home";
  default-lease-time 600;
  max-lease-time 7200;
}

ddns-update-style none;

当我想启动服务器时

sudo service isc-dhcp-server start

我得到:

Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details.

Journalctl -xe 给了我

    -- Support: https://www.debian.org/support
-- 
-- An ExecStart= process belonging to unit isc-dhcp-server.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Nov 26 17:59:26 raspberrypi systemd[1]: isc-dhcp-server.service: Failed with res
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- The unit isc-dhcp-server.service has entered the 'failed' state with result '
Nov 26 17:59:26 raspberrypi systemd[1]: Failed to start LSB: DHCP server.
-- Subject: A start job for unit isc-dhcp-server.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A start job for unit isc-dhcp-server.service has finished with a failure.
-- 
-- The job identifier is 1873 and the job result is failed.
Nov 26 17:59:26 raspberrypi sudo[3694]: pam_unix(sudo:session): session closed f
Nov 26 17:59:29 raspberrypi sudo[3736]:       pi : TTY=pts/0 ; PWD=/home/pi ; US
Nov 26 17:59:29 raspberrypi sudo[3736]: pam_unix(sudo:session): session opened f
Nov 26 18:00:06 raspberrypi sudo[3736]: pam_unix(sudo:session): session closed f
lines 1478-1500/1500 (END)
-- Support: https://www.debian.org/support
-- 
-- An ExecStart= process belonging to unit isc-dhcp-server.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Nov 26 17:59:26 raspberrypi systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- The unit isc-dhcp-server.service has entered the 'failed' state with result 'exit-code'.
Nov 26 17:59:26 raspberrypi systemd[1]: Failed to start LSB: DHCP server.
-- Subject: A start job for unit isc-dhcp-server.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A start job for unit isc-dhcp-server.service has finished with a failure.
-- 
-- The job identifier is 1873 and the job result is failed.
Nov 26 17:59:26 raspberrypi sudo[3694]: pam_unix(sudo:session): session closed for user root
Nov 26 17:59:29 raspberrypi sudo[3736]:       pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/nano /etc/dhcp/dhcpd.conf
Nov 26 17:59:29 raspberrypi sudo[3736]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 26 18:00:06 raspberrypi sudo[3736]: pam_unix(sudo:session): session closed for user root

systemctl 状态 isc-dhcp-server.service

   ● isc-dhcp-server.service - LSB: DHCP server
       Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
       Active: failed (Result: exit-code) since Thu 2020-11-26 17:59:26 CET; 45s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 3718 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status
    
    Nov 26 17:59:23 raspberrypi dhcpd[3732]: bugs on either our web page at www.isc.
    Nov 26 17:59:23 raspberrypi dhcpd[3732]: before submitting a bug.  These pages e
    Nov 26 17:59:23 raspberrypi dhcpd[3732]: process and the information we find hel
    Nov 26 17:59:23 raspberrypi dhcpd[3732]: 
    Nov 26 17:59:23 raspberrypi dhcpd[3732]: exiting.
    Nov 26 17:59:25 raspberrypi isc-dhcp-server[3718]: Starting ISC DHCPv4 server: d
    Nov 26 17:59:26 raspberrypi isc-dhcp-server[3718]:  failed!
    Nov 26 17:59:26 raspberrypi systemd[1]: isc-dhcp-server.service: Control process
    Nov 26 17:59:26 raspberrypi systemd[1]: isc-dhcp-server.service: Failed with res
    Nov 26 17:59:26 raspberrypi systemd[1]: Failed to start LSB: DHCP server.

知道出了什么问题。

谢谢您的帮助

答案1

我找到了解决方案。我正在关注错误的指示。他们将静态IP写入/etc/network/interfaces.然而,该文件指出:

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

有同样问题的用户,请关注这些说明

我刚刚给了我wlan0一个静态IP(不要忘记wpa-conf)。

相关内容