Linux dhcp and dhcp forwarding

Posted on 2006-04-05
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.


Question by:Rebelnorth
    LVL 19

    Accepted Solution


    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

    Author Comment

    this is no longer required thanks for the help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now