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

我在eth0上创build了两个子接口:

  • eth0:0 ,IP为192.168.10.1/24
  • eth0:1 ,IP为192.168.11.1/24

像这样configuration/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"

那有什么问题?

更新:

忘了提及,我试图在子接口上configuration路由器(别名?)。 我使用192.168.10.2192.168.11.2设置了2个主机,configuration完成后,第3个主机的子接口eth0:0eth0:1在这两个主机之间转发数据包。 但现在我试图configurationDHCP服务器,它可以dynamic分配2个子网中的2台主机的IP。

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

您不需要有子接口来为这些networking提供DHCP请求。 http://manpages.ubuntu.com/manpages/hardy/man5/dhcpd.conf.5.html

DHCP是TCP / IP协议,所以它在一个级别上工作,甚至有IP地址,所以你不需要在子接口上监听DHCP请求,你想听实际的物理接口这些请求可能是eth0。

然后,您将需要定义租用IP地址的规则 – 通过静态MAC地址映射,或任何(我猜ubuntu)会让你做的。

eth0:1和eth0:0接口仅用于NAT路由,不应出现在DHCPconfiguration中的任何位置。