Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 497
  • Last Modified:

Linux dhcp and dhcp forwarding

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.


1 Solution
Gabriel OrozcoSolution ArchitectCommented:

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
RebelnorthAuthor Commented:
this is no longer required thanks for the help.

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now