Get “No subnet declaration” starting ISC DHCP server on subinterfaces

dhcpdhcp-serverisc-dhcpnetworking

I have created two subinterfaces on eth0 :

  • eth0:0 with IP 192.168.10.1/24
  • eth0:1 with IP 192.168.11.1/24

Configured /etc/dhcp/dhcpd.conf like that:

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;
}

But when I try to start DHCP server I'm getting:

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. **

Config in /etc/default/isc-dhcp-server:

INTERFACES="eth0:0 eth0:1"

What is wrong with that?

UPDATE:

Forgot to mention that I'm trying to configure router-on-a-stick on subinterfaces(aliases?). I set up 2 hosts with 192.168.10.2 and 192.168.11.2 and after configuration the 3rd host with subinterfaces eth0:0 and eth0:1 is forwarding packets between these 2 host. But now I'm trying to configure DHCP server which can dynamically assign IPs to 2 hosts in 2 subnets.

Best Answer

This will not work, as IP aliasing is just a method to add an address to an existing interface. What you probably should do here is VLANs.