為什麼在子介面上啟動 ISC DHCP 伺服器時會出現「無子網路聲明」?

為什麼在子介面上啟動 ISC DHCP 伺服器時會出現「無子網路聲明」?

我在以下位置創建了兩個子介面eth0

  • eth0:0有IP192.168.10.1/24
  • eth0:1有IP192.168.11.1/24

/etc/dhcp/dhcpd.conf像這樣配置:

option domain-name-server 194.204.159.1;

subnet 192.168.10.0 netmask 255.255.255.0 {
   option routers 192.168.10.1;
   option subnet-mask 255.255.255.0;
   range 192.168.10.10 192.168.10.100;
}

subnet 192.168.11.0 netmask 255.255.255.0 {
   option routers 192.168.11.1;
   option subnet-mask 255.255.255.0;
   range 192.168.11.10 192.168.11.100;
}

但是當我嘗試啟動 DHCP 伺服器時,我得到:

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

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

配置在/etc/default/isc-dhcp-server

INTERFACES="eth0:0 eth0:1"

這有什麼問題嗎?

更新:

忘記提及我正在嘗試在子介面(別名?)上設定路由器。我設定了 2 台主機,192.168.10.2192.168.11.2在配置了具有子介面的第三台主機後eth0:0eth0:1在這 2 台主機之間轉送封包。但現在我正在嘗試設定 DHCP 伺服器,它可以動態地將 IP 指派給 2 個子網路中的 2 台主機。

答案1

這不起作用,因為 IP 別名只是將位址新增至現有介面的一種方法。您可能應該在這裡做的是 VLAN。

答案2

您不需要有子介面來為這些網路的 DHCP 請求提供服務。 http://manpages.ubuntu.com/manpages/hardy/man5/dhcpd.conf.5.html

DHCP 是一個像 TCP/IP 一樣的協議,因此它在機器擁有 IP 位址之前的層級上工作,因此您不需要在子介面上偵聽 DHCP 請求,您需要偵聽實際的實體接口,在您的情況下可能是e​​th0 來滿足這些請求。

然後,您需要定義向這些群組出租 IP 位址的規則 - 透過靜態 MAC 位址映射,或任何(我猜 ubuntu)會讓您做的事情。

eth0:1 和 eth0:0 介面僅是 NAT 路由所必需的,不應出現在 DHCP 設定中的任何位置。

相關內容