Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 192.168.1.0 which is fairly typical for me. My network's DNS server is always also my networks DHCP server. Typically at 192.168.1.1. When a DHCP client broadcasts for an IP over the subnet, 192.168.1.1(My 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 192.168.1.1 for me typically.
In this manner, a client broadcasts for networking information and is given a usable IP, and told to use 192.168.1.1 for most other functionality. Very simple. However, I am uncertain how to expand this to other subnets. Say.. 192.168.2.0.
A: I can use a separate DHCP server for each subnet.
or
B: I can use a DHCP Relay agent for 192.168.2.0 to pass the DHCP requests to the primary DHCP server on the 192.168.1.0 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: 192.168.1.0 and Subnet-B: 192.168.2.0 - each with it's own Gateway server to route the network traffic. Make these 192.168.1.1 and 192.168.2.1 respectively. Further, the DHCP Server is located on 192.168.1.1, while 192.168.2.1 is a DHCP Relay Agent which passes requests from the 192.168.2.0 subnet to 192.168.1.1 for provisioning.
Now the question!!: How does one ensure that clients on the 192.168.2.0 subnet are given the right gateway? That is... Client machines on 192.168.2.0 should be given a Gateway of 192.168.2.1, NOT of 192.168.1.1.
However I have no idea how to do this. The DHCP Server at 192.168.1.1 is configured to tell clients 192.168.1.1 is their gateway - this won't do for 192.168.2.0 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.
Distribution: RHEL, Ubuntu, Solaris 11, NetBSD, OpenBSD
Posts: 225
Rep:
Hi,
Normally the DHCP server that you are fowarding to would have a configuration so it knows what to do with clients on the 192.168.2.0 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 192.168.2.0 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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.