Much of the time though, we don't have a DHCP server that "touches" every LAN in our network. Sometimes the DHCP servers will actually be in a completely different location. So more magic comes into play here.
There are DHCP forwarding agents that can be involved. This piece of code will see the 255.255.255.255 UDP broadcast to the DHCP port and forward it on as a unicast packet (through the network) to a pre- determined address. Routers have this function called an "ip helper-address."
So let's put our DHCP server on a 192.168.66.254 address, which is in some other location physically. When a workstation on VLAN1 powers up, it doesn't know what its IP is, so it sends out the DHCP Discover packet to 255.255.255.255. The forwarding agent (router) receives this broadcast and activates the helper-address code. This resends the message as a unicast packet to 192.168.66.254. So the DHCP server receives it.
The next catchy part here is to work backwards to figure out what's going on. The DHCP server receives the packet now, which is one step, but the next part is to try to determine which scope the IP needs to be assigned from. Remember, the workstation that was booting doesn't know who it is, and only has its MAC address already assigned. So unless you have a reservation by MAC address set up, this won't help much in narrowing things down.
There are two options though. First, when the router or forwarding agent resends the DHCP Discover packet as a unicast, it not only rewrites the destination address to 192.168.66.254, but also rewrites the source address to its own received interface (192.168.1.253). The DHCP server can match the pool of the IP source.
Another option is that the DHCP forwarding agent (a.k.a. relay agent) can also insert a field within the DHCP information called a "giaddr" field, or "Gateway Interface Address" which allows the DHCP process to figure out what the original receiving interface was in order to select a pool of addresses.
No comments:
Post a Comment