Debian

Debian dhcpd“沒有 eth0 的子網聲明”

  • March 28, 2021

我正在嘗試在提供 PLoP Linux 映像的 Debian 6.0.3 Squeeze 機器上設置 pxe 引導伺服器。我正在關注教程。

當我嘗試啟動 dhcpd(來自包 dhcp3-server)時,我得到以下資訊:

No subnet declaration for eth0 (10.0.0.0).
**Ignoring requests on eth0. If this is not what
 you want, please write a subnet delclaration
 in your dhcpd.conf file for the network segment 
 to which interface eth0 is attached. **



Not configured to listen on any interfaces!

/etc/dhcpd.conf的與教程中的相同,只是做了一些更改:

host testpc {
       hardware ethernet 00:0C:6E:A6:1A:E6;
       fixed-address 10.0.0.250;
}

而是

host tablet {
       hardware ethernet 00:02:3F:FB:E2:6F;
       fixed-address 10.0.0.249;
}

/etc/network/interfaces的是:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
       address 10.0.0.0
       netmask 255.255.255.0

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

# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth0"

我也複製到/etc/default/dhcp3-server其中,不確定它會檢查哪個。

我還嘗試將 ip 設置/etc/network/interfaces為 10.0.0.1 和 10.0.0.2,但結果相同。

由於 dhcpd 必須將 IP 地址分發給客戶端,因此它需要知道它負責的地址範圍。子網聲明為 dhcpd 提供了該資訊以及更多資訊。假設您使用的是 10.0.0/24,以下內容應該可以幫助您開始並克服錯誤消息,但您確實需要閱讀文件才能更進一步。將此添加到您的 dhcpd.conf 中:

subnet 10.0.0.0 netmask 255.255.255.0 { 
  authoritative; 
  range 10.0.0.1 10.0.0.254; 
  default-lease-time 3600; 
  max-lease-time 3600; 
  option subnet-mask 255.255.255.0; 
  option broadcast-address 10.0.0.255; 
  option routers 10.0.0.0; 
  option domain-name-servers 8.8.8.8; 
  option domain-name "example.com"; 
} 

我在上面插入的 IP 地址是猜測。您必須為您的設置正確設置這些。

引用自:https://unix.stackexchange.com/questions/33376