Assigning a different gateway address based on gi-addr
Nicolas De Cristofaro
nicolas.de.cristofaro at ericsson.com
Sat Oct 30 01:57:07 UTC 2010
Hi David,
I'll have to test that as well actually, I didn't check for the RENEW condition. The other option I see is we pass the router's hostname in option 82, so I guess we could match on substring from the agent circuit.id as well?
Thanks,
Nick
-----Original Message-----
From: dhcp-users-bounces+nicolas.de.cristofaro=ericsson.com at lists.isc.org [mailto:dhcp-users-bounces+nicolas.de.cristofaro=ericsson.com at lists.isc.org] On Behalf Of David W. Hankins
Sent: October-29-10 5:22 PM
To: Users of ISC DHCP
Subject: Re: Assigning a different gateway address based on gi-addr
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
More information about the dhcp-users
mailing list