Serving Multiple Subnets on one NIC, and two vNICs

Simon Hobson dhcp1 at thehobsons.co.uk
Wed Aug 1 09:52:55 UTC 2012


Adam Wolfe wrote:
>I am in the middle of setting up a new dhcp server between 3 
>subnets, using ubuntu 10.04.
>
>The subnet that eth0 is connected to is 10.8.35.0 and will not use 
>dhcp at all.
>
>The subnet that eth0:26 is connected to is 10.8.26.0, eth0:37 is on 10.8.37.0

OK, a couple of things you need to know here.
1) You **CANNOT** run a DHCP server on a virtual NIC like eth0:1. 
DHCP is a broadcast technology, and when a broadcast packet arrives 
on the physical interface, there is no way whatsoever to determine 
which of the interfaces it should be handled by.
Leading on from that, you cannot service only some subnets on an interface ...

2) What you have here is known as a shared network - multiple IP 
subnets on the same broadcast domain. Lookup shared-network in man 
dhcpd.conf


>I'm practically positive on my dhcp.conf, it was copied from 
>another, already working, server.  It just seems like it doesn't 
>know where it should be sending the info to, but it is trying.  It 
>also cannot ping other devices on the 26 and 37 subnets.

Well since you didn't post your dhcpd.conf we can't see what's in it. 
My guess is you don't have the right information.

>I was also wondering how to overcome the 'not configured to listen 
>on any interfaces' caused by adding "INTERFACES="eth0 eth0:26 
>eth0:37" " to /etc/default/dhcp-server.

Virtual NICs aren't valid.

What you will need in dhcpd.conf is :

shared-network "somename" {
   subnet 10.8.35.0 ...
   }
   subnet 10.8.26.0 ...
     option ...
     range ...
   }
   subnet 10.8.37.0 ...
     option ...
     range ...
   }
}

Not that there is a subnet declaration for 10.8.35.0, just nothing in 
it so no clients will be given an address in this subnet.

Anticipating the next question ... which I expect will be some 
variant of "why do clients get an address in the 'wrong' subnet ?"
As far as DHCP is concerned, all the available IPs in the 
shared-subnet are equal, and any address can be given to any client. 
If you need to have certain clients in certain subnets then you'll 
have to find some means of identifying them and explicitly telling 
DHCPD how to treat them. This may be by listing all of one class with 
host declarations and then using [allow|deny]-known clients; or you 
may need to use classes.

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.


More information about the dhcp-users mailing list