Assigning a different gateway address based on gi-addr

David W. Hankins dhankins at
Fri Oct 29 21:22:12 UTC 2010

On Fri, Oct 29, 2010 at 08:56:01PM +0100, Simon Hobson wrote:
> How about just using a conditional like this :
>      if packet(24, 4) = {
>        option routers ;
>      }
>      else
>      {
>        option routers ;
>      }

Some mild syntax problems, but there's a deeper issue;

The 'giaddr' will be zero when the client renews.  The most
straightforward workaround is to store the 'giaddr' in a 'binding
scope' on the dynamic lease when it is nonzero;

  if (packet(24, 4) != 00:00:00:00) {
    set last_giaddr = packet(24, 4);

  subnet netmask {
    # Default to for clients that haven't gone through the
    # relay yet.
    option routers = pick-first-value(last_giaddr, 0a:00:00:01);


This way the 'last_giaddr' value will be cached on the active
dynamic lease and reused when the client returns.

David W. Hankins	"If you don't do it right the first time,
Software Engineer		     you'll just have to do it again."
Internet Systems Consortium, Inc.		-- Jack T. Hankins
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <>

More information about the dhcp-users mailing list