Assigning a different gateway address based on gi-addr

David W. Hankins dhankins at isc.org
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) = 88.88.88.33 {
>        option routers 88.88.88.33 ;
>      }
>      else
>      {
>        option routers 88.88.88.34 ;
>      }

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 10.0.0.0 netmask 255.255.255.0 {
    # Default to 10.0.0.1 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: <https://lists.isc.org/pipermail/dhcp-users/attachments/20101029/f28b3b27/attachment.bin>


More information about the dhcp-users mailing list