Identifying DHCP Relay Agent

Simon Hobson dhcp1 at
Wed Jul 12 15:23:23 UTC 2006

William Lindén wrote:

>I'd like to set a different router depending on 
>via which router the request gets in. Idea would 
>be to use one bigger subnet instead of several 
>smaller, and with vrrp/hsrp etc etc, but thats a 
>different problem.. ;)

You mean, have several physically different 
networks sharing an IP subnet ? I'll be polite 
and just say - very inadvisable !

If you mean you have multiple routers on one 
subnet/one network, then use vrrp/hsrp and server 
up the virtual address to all the clients.

>Here's my config, but it just tells me no free 
>leases when I try to get an IP from the dhcp..
>shared-network vrrp-test
>  class "via_router1" {
>   match if packet (24,4) = "";

You are comparing four bytes to an 11 character string !

You could convert the bytes to a string, or just 
specify the address as four bytes - eg :

match if packet (24,4) = c0:a8:1:2 ;

>   option routers;
>   }
>  class "via_router2" {
>   match if packet (24,4) = "";
>   option routers;
>   }
>  subnet netmask
>  {
>   pool
>   {
>   allow members of "via_router1";
>   allow members of "via_router2";
>   range;
>   option subnet-mask;
>   }
>  }

Also, don't forget that in the general case, 
every broadcast packet from every client will 
come through BOTH routers - the server will get 
two packets, and make two replies. In theory the 
client can choose between the offers, in 
practice, clients generally just take the first 

Which will be the first offer ? It's 
indeterminate, but you will probably find that 
one router will be just a tad faster than the 
other and will get the forwarded packet to the 
server first.

If you just want to load-share across the two 
routers, a simpler way would be to do :

subnet netmask {
     pool {
       option routers
     pool {
       option routers

At first, clients will all get addresses from one 
pool, but once everything has been used once and 
addresses are being re-used then things will 
settle down to a pseudo-random selection between 
address pools.


More information about the dhcp-users mailing list