Determining gateway ip in dhcp server in case of relay agent existence

dhcp

I've got a situation where i have two subnets. (Say subnet 1 and subnet 2).

`

    My DHCP Client is configured inside subnet 1 (net id : network id 10.1.1.0)

    My DHCP Server is configured inside subnet 2 (net id : newtork id 10.1.2.0)

    Both has a subnet mask of 255.255.255.0 

    My Router is acting as the DHCP relay agent

`

Now, If my DHCP server has to lease out an IP address from a pool.

On the basis of which gateway IP (subnet 1 or 2) will it lease out an IP address ?
`

Best Answer

http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol#DHCP_relaying

In small networks, where only one IP subnet is being managed, DHCP clients communicate directly with DHCP servers. However, DHCP servers can also provide IP addresses for multiple subnets. In this case, a DHCP client that has not yet acquired an IP address cannot communicate directly with the DHCP server using IP routing, because it doesn't have a routable IP address, nor does it know the IP address of a router. In order to allow DHCP clients on subnets not directly served by DHCP servers to communicate with DHCP servers, DHCP relay agents can be installed on these subnets. The DHCP client broadcasts on the local link; the relay agent receives the broadcast and transmits it to one or more DHCP servers using unicast. The relay agent stores its own IP address in the GIADDR field of the DHCP packet. The DHCP server uses the GIADDR to determine the subnet on which the relay agent received the broadcast, and allocates an IP address on that subnet. When the DHCP server replies to the client, it sends the reply to the GIADDR address, again using unicast. The relay agent then retransmits the response on the local network.

(Meaning: it adds the gateway interface address facing the client, obviously, otherwise it couldn't work.)

Related Topic