为什么在子接口上启动 ISC DHCP 服务器时会出现“无子网声明”?

som*_*HOW 5 networking dhcp isc-dhcp dhcp-server

我在 上创建了两个子接口eth0

  • eth0:0 带IP 192.168.10.1/24
  • eth0:1 带IP 192.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;
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试启动 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. **
Run Code Online (Sandbox Code Playgroud)

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

INTERFACES="eth0:0 eth0:1"

这有什么问题?

更新:

忘了提及我正在尝试在子接口(别名?)上配置单臂路由器。我设置了 2 台主机,192.168.10.2192.168.11.2在配置了带有子接口的第 3 台主机之后,eth0:0eth0:1在这 2 台主机之间转发数据包。但是现在我正在尝试配置 DHCP 服务器,它可以将 IP 动态分配给 2 个子网中的 2 个主机。

Kon*_*ski 1

这不起作用,因为 IP 别名只是将地址添加到现有接口的一种方法。您可能应该在这里做的是 VLAN。