Freeing lease with omshell not working?

Alex Moen alexm at ndtel.com
Tue Apr 26 12:02:14 UTC 2011


Hi Maarten,


On Apr 26, 2011, at 6:24 AM, Maarten Carels wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi list,
>
> At work we use ISC-DHCP to provide ip addresses to DSL customers,  
> based on some kind of lineID. Only one ip is provided to every  
> customer. We use some kind of classing scheme for that.
>
> This causes a 2 hour wait (the lease time) when a new modem is  
> deployed.
>
> I made a script using omshell to clear an existing lease, by setting  
> the lease state to free (1).
>
> The script we use contains does this:
>
>> server xx.xx.xx.xx
>> connect
> obj: <null>
>> new lease
> obj: lease
>> set ip-address = aa.aa.aa.aa
> obj: lease
> ip-address = aa:aa:aa:aa
>> open
> obj: lease
> ip-address = aa:aa:aa:aa
> state = 00:00:00:02
> dhcp-client-identifier = 01:00:1c:4a:0b:af:9a
> client-hostname = "fritz.fonwlan.box"
> subnet = 00:00:00:02
> pool = 00:00:00:03
> hardware-address = 00:1c:4a:0b:af:9a
> hardware-type = 00:00:00:01
> ends = 4d:b6:bb:34
> starts = 4d:b6:9f:14
> tstp = 00:00:00:00
> tsfp = 00:00:00:00
> atsfp = 00:00:00:00
> cltt = 00:00:00:00
>> set state = 1
> obj: lease
> ip-address = aa:aa:aa:aa
> state = 1
> dhcp-client-identifier = 01:00:1c:4a:0b:af:9a
> client-hostname = "fritz.fonwlan.box"
> subnet = 00:00:00:02
> pool = 00:00:00:03
> hardware-address = 00:1c:4a:0b:af:9a
> hardware-type = 00:00:00:01
> ends = 4d:b6:bb:34
> starts = 4d:b6:9f:14
> tstp = 00:00:00:00
> tsfp = 00:00:00:00
> atsfp = 00:00:00:00
> cltt = 00:00:00:00
>> update
> obj: lease
> ip-address = aa:aa:aa:aa
> state = 1
> dhcp-client-identifier = 01:00:1c:4a:0b:af:9a
> client-hostname = "fritz.fonwlan.box"
> subnet = 00:00:00:02
> pool = 00:00:00:03
> hardware-address = 00:1c:4a:0b:af:9a
> hardware-type = 00:00:00:01
> ends = 4d:b6:bb:34
> starts = 4d:b6:9f:14
> tstp = 00:00:00:00
> tsfp = 00:00:00:00
> atsfp = 00:00:00:00
> cltt = 00:00:00:00
>
> Looking in the dhcp logs this seems to work well, the server reports  
> the change in the state of the lease from active to free, and in the  
> leases file a new entry is added with the binding state set to free.  
> And, if I ask in a new omshell session about the state of thie  
> lease, it's shown as state 1 (free)
>
> That part looks well, but during the remaining time of the old lease  
> the new modem is refused an address. Log entries show this:
>
> Last renewal by the olod modem:
> Apr 23 10:39:14 dhcp2 dhcpd: DHCPREQUEST for aa.aa.aa.aa from  
> 00:03:2f:17:17:1f (AP-Router) via em0
> Apr 23 10:39:14 dhcp2 dhcpd: DHCPACK on aa.aa.aa.aa to 00:03:2f: 
> 17:17:1f (AP-Router) via em0
>
> Then the new modem is connected. No lease is given, as the old one  
> is still not timed out:
>
> Apr 23 12:12:08 dhcp2 dhcpd: DHCPDISCOVER from 00:1c:4a:0b:af:9a  
> circuit-id this remote-id dr3.d12.atm at br1483 via bb.bb.bb.bb (giaddr  
> aa.aa.aa.1): network netname: no free leases
>
> At this point the lease is freed by the omapi script:
>
> Apr 23 12:13:29 dhcp2 dhcpd: lease aa.aa.aa.aa state changed from  
> active to free
>
> But the new modem is still refused
> Apr 23 12:14:02 dhcp2 dhcpd: DHCPDISCOVER from 00:1c:4a:0b:af:9a  
> circuit-id this remote-id dr3.d12.atm at br1483 via bb.bb.bb.bb (giaddr  
> aa.aa.aa.1): network netname: no free leases
>
> And this continues until the old lease has timed out two hours after  
> the last renewal:
>
> Apr 23 12:39:44 dhcp2 dhcpd: DHCPDISCOVER from 00:1c:4a:0b:af:9a  
> circuit-id this remote-id dr3.d12.atm at br1483 via bb.bb.bb.bb (giaddr  
> aa.aa.aa.1)
> Apr 23 12:39:45 dhcp2 dhcpd: DHCPOFFER on aa.aa.aa.aa to 00:1c:4a: 
> 0b:af:9a (fritz.fonwlan.box) via bb.bb.bb.bb
> Apr 23 12:39:45 dhcp2 dhcpd: DHCPREQUEST for aa.aa.aa.aa  
> (zz.zz.zz.zz) from 00:1c:4a:0b:af:9a (fritz.fonwlan.box) via  
> bb.bb.bb.bb (giaddr aa.aa.aa.1)
> Apr 23 12:39:45 dhcp2 dhcpd: DHCPACK on aa.aa.aa.aa to 00:1c:4a: 
> 0b:af:9a (fritz.fonwlan.box) via bb.bb.bb.bb
>
> Has anyone seen this behaviour before? Why is the lease reported as  
> free at all places (log, leases file etc) but in some way considered  
> as 'in-use' with the old MAC address?
>
> The server is freebsd 6.2 running isc-dhcp 3.0.5
> Leases are classed on option-82 stuff:
> class "dr3.d12" {
>    match if (substring(option agent.remote-id,0,7) = "dr3.d12");
>    spawn with option agent.circuit-id;
> }
>
> And the network is defined with an shared-network clause, containing  
> some subnets, each having some pools with an allow statement and a  
> range of 1 ip address, like this:
>        # package_id zzzzz
>        pool {
>          allow members of "dr3.d12" "this";
>          range aa.aa.aa.aa;
>        }
>
> (yes, completely configured in the dhcp config, but this is only for  
> some 22000 legacy clients using bridged configs)
>
> - --maarten


Rather than setting the state to 1, try changing the lease ending time  
to 0, with the line "set ends = 00:00:00:00".  We use this method for  
almost exactly the same problem, with FTTP ONTs rather than DSL modems.

HTH,

Alex




More information about the dhcp-users mailing list