-   Linux - Networking (
-   -   Gateway assignment and DHCP+DHRELAY Question (

Lord_Devi 06-22-2010 01:56 PM

Gateway assignment and DHCP+DHRELAY Question
I am having some difficulties comprehending some networking concepts relating to multiple subnets and dhcp servers, or dhcp relay servers.

I have built home networks many times before, and they have all followed a very simple formula. A single subnet, let's say which is fairly typical for me. My network's DNS server is always also my networks DHCP server. Typically at When a DHCP client broadcasts for an IP over the subnet, DNS/DHCP server) will not only tell the client what it's new IP is to be, but will also tell the client what it's Gateway server is. This is ALSO for me typically.

In this manner, a client broadcasts for networking information and is given a usable IP, and told to use for most other functionality. Very simple. However, I am uncertain how to expand this to other subnets. Say..

A: I can use a separate DHCP server for each subnet.
B: I can use a DHCP Relay agent for to pass the DHCP requests to the primary DHCP server on the subnet.

Option A: is fairly straight forward and have had it functioning fine, but it is really B: I want to know more about. It seems somehow much cleaner to me. I prefer to centralize as much of my network provisioning services as possible. It makes it easier to manage TYPICALLY.

My question though is related to Gateways and the use of DHCP Relay Agents.

Given a network with the two subnets, Subnet-A: and Subnet-B: - each with it's own Gateway server to route the network traffic. Make these and respectively. Further, the DHCP Server is located on, while is a DHCP Relay Agent which passes requests from the subnet to for provisioning.

Now the question!!: How does one ensure that clients on the subnet are given the right gateway? That is... Client machines on should be given a Gateway of, NOT of

However I have no idea how to do this. The DHCP Server at is configured to tell clients is their gateway - this won't do for clients.

I am not particularly looking for exact instructions.. Just to have some of this networking fog cleared from my head. It really sounds like a very simple thing, but I have almost no practical experience in dealing with multiple subnets, and would just love to have this issue clarified a bit for me.

I have googled to quite some extent on the subject of DHCP servers, Relays and Gateway provisioning.. but have met with little success in increasing my understanding of this issue.

Please, someone with Network know how help explain this to me in very simple terms!

p.s. Again, please.. I thank anyone to take the time to help me, but no suggestions for the creation of a separate DHCP server for each subnet. DHCP Relays are what's confusing me.

- Lord_Devi

SteveK1979 07-12-2010 05:29 PM


Normally the DHCP server that you are fowarding to would have a configuration so it knows what to do with clients on the network i.e. so it knows to give them an IP address in the 192.168.2.x range and the correct gateway etc. to assign to clients in this network range. Take a look at this documentation and see the section Options for DHCPd. You should just (no guarantees, it's been a while since I did this on a UNIX system!) need to add a config block for the range.

From what you've said, I guess this is home kit. Doesn't usually support relaying the dhcp requests from my experience. I've only ever done this part on things like Cisco/Extreme/FortiNet devices. It's possible to set up on linux gateway/router it seems, see dhcrelay.

Hope that gives you an idea of what's needed!


All times are GMT -5. The time now is 10:26 PM.