We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Linux dhcp and dhcp forwarding

Rebelnorth asked
Medium Priority
Last Modified: 2012-05-05
I have a question concerning the configuration of dhcp in a situation where there will need to be multiple subnets and dhcp forwarders.

Lets say I have a network  I place a linux based dhcp server at IP  It needs to be set up to deliver ip addresses in the range.  The clients will all be part of the same class a domain, but this is just an example.  

However an additional situation applies.  Another device, which acts as a dhcp forwarder is sitting on the network at  Currently lets say that device is forwarding its dhcp packets to the gateway router which is acting as a dhcp server.  I want to change it so that the device forwards the linux dhcp server.  (I know you cant run two dhcp servers at the same time... so the gateway router dhcp service will be shut off before the Linux DHCP service is started.) Changing the forwarding device's settings  is simple.  The problem (at least for me) is that the devices behind the dhcp forwarder need their ips assigned in a specific stretch of the class b range.  

It may be simple but how would I configure the dhcp server to meet this situation... I've seen situations where the linux dhcp is acting as the router for both subnets, but this is not the case, and its not actually sending the dhcp info to a subnet in the second case, its sending the dhcp info to the single ip address.


Watch Question

Solution Architect

I haven't found in that situation yet. but let me try to help

linux dhcpd (BIND is it's name) can only send ip addresses for ranges where the NIC has an ip address. So if you need to be DNS for network while yor linux has only, it will not work. will not work neither for range.

So, what to do?
The simplest method is to connect these devices to a different NIC so named will recognize requests from each nick and respond with the range of ip's it has for the ip on that nic.

say eth1 has 10.0.2.x ip address. any broadcast asking for a dhcp server on such interfase will be served with an ip address in the same address space.

so if eth2 has 172.16.0.x ip address, you can connect the device for that network on it and every dhcp broadcast will be served correctly. you can then enable routing for your linux box and packets will be trasversing your linux to/from both networks.

Of course you will need to define three zones inside dhcpd.conf, but that's the only configuration you need.


If you cannot do this, then config is more trikier since you will need to know all MAC addresses and assign an ip for them in the dhcpd.conf file. What to do in this case? well:
ad ip aliases to your LAN card (maybe it is eth0?) this is the "by hand" method:

ifconfig eth0:1 netmask up
ifconfig eth0:2 netmask up  (or whatever your mask is)

and then your named will be able to answer with ip's in such ranges also.

now, for dhcpd to know what ip address to serve, you will need to respond with a fixed ip to each mac address from these networks. this is an extra overhead since you need to collect these addresses first, but it still can work fine.

hope this helps

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


this is no longer required thanks for the help.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.