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 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.
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.