# dhcp binding wrong address after lease expires

## Tanj

for a few months now when the lease on my ip expires and eth0 goes to get a new address the address keeps coming back as 66.0.0.234

my local network is 192.168.3.1 so whenever this happens my connections drop until I restart net.eth0

I can't seem to find any reference to 66.0.0.234 in any of my config files.

I'd appreciate any suggestions on where to look, or what to do.

----------

## UberLord

What dhcp client are you using?

----------

## Tanj

dhcpcd

and here are the settings from /etc/net

```

config_eth0=( "dhcp" )

dhcpcd_eth0="-s 192.168.3.100"

```

----------

## UberLord

What version of dhcpcd? If 2.x try upgrading to 3.0.16

----------

## Tanj

[ebuild   R   ] net-misc/dhcpcd-3.0.16

I would be using that version then.

----------

## UberLord

Interesting.

Could you capture a wireshark trace of the dhcp traffic and email it to me please?

You can force dhcpcd to renew it's lease by doing

dhcpcd -n eth0

which should simulate what's happening

----------

## Tanj

well I just had another complication to the mix. I was going to come check on this thread but my internet was down yet again. So I go /etc/init.d/net.eth0 restart and nothing happens. So I go and take a look at the router. It seems to be up and working just fine but I can't seem to get on the inet. I viewed the DHCP Active IP table and my ip is showing up just fine. I then delete it from the list and restart eth0. Comes back up no problem but I still don't have a connection.

So I give up tinkering and just cold boot the router. As soon as my connection comes back up, my system locks up HARD or atleast to the point where I can't do anything because it isn't responding to keypresses or mouse clicks. The mouse cursor would still move and my music was still playing. I had to use the reset button to shutdown....

Should the dhcpcd -n eth0 get a new ip from the router if I clear the active DHCP table?

how would i go about doing the wireshark trace?

ok I answered that myself by taking a look in portage...emerging it as I type this up.

I'll email you the trace is you supply me with an email  :Smile: 

----------

## UberLord

 *Tanj wrote:*   

> Should the dhcpcd -n eth0 get a new ip from the router if I clear the active DHCP table?

 

Maybe. It will request the same IP though. Whether that's the one the server gives you is another matter entirely.

----------

## Tanj

 *UberLord wrote:*   

>  *Tanj wrote:*   Should the dhcpcd -n eth0 get a new ip from the router if I clear the active DHCP table? 
> 
> Maybe. It will request the same IP though. Whether that's the one the server gives you is another matter entirely.

 

would you be able to see what is happening if you had the trace files?

I did them up but I have nowhere to send them too...if you PM me your email address I'll send them via email

----------

## UberLord

uberlord@gentoo.org

----------

## Tanj

email sent

----------

## UberLord

Nothing wrong in those traces, and no mention of 66.0.0.234.

Are you sure it's dhcpcd that's setting 66.0.0.234? Post up the logs that show this  :Smile: 

----------

## Tanj

Well I'm not sure where it is getting 66.0.0.234 from

```

Mar 26 20:33:17 [dhcpcd] eth0: waiting on select for 35359 seconds

Mar 26 20:33:17 [dhcpcd] eth0: received SIGTERM, stopping

Mar 26 20:33:17 [dhcpcd] eth0: removing default route via 192.168.3.1 metric 0

Mar 26 20:33:17 [dhcpcd] eth0: deleting IP address 192.168.3.101/24

Mar 26 20:33:17 [dhcpcd] eth0: exiting

Mar 26 20:33:18 [dhcpcd] eth0: dhcpcd 3.0.16 starting

Mar 26 20:33:18 [dhcpcd] eth0: hardware address = 00:17:9a:b6:67:cc

Mar 26 20:33:18 [dhcpcd] eth0: broadcasting for a lease of 192.168.3.100

Mar 26 20:33:18 [dhcpcd] eth0: received NAK: (null)

Mar 26 20:33:18 [dhcpcd] eth0: broadcasting for a lease

Mar 26 20:33:19 [dhcpcd] eth0: offered 192.168.3.101 from 192.168.3.1

Mar 26 20:33:19 [dhcpcd] eth0: leased 192.168.3.101 for 86400 seconds

Mar 26 20:33:19 [dhcpcd] eth0: no renewal time supplied, assuming 43200 seconds

Mar 26 20:33:19 [dhcpcd] eth0: no rebind time supplied, assuming 75600 seconds

Mar 26 20:33:19 [dhcpcd] eth0: adding IP address 192.168.3.101/24

Mar 26 20:33:19 [dhcpcd] eth0: adding default route via 192.168.3.1 metric 0

Mar 26 21:23:07 [dhcpcd] eth0: received SIGTERM, stopping

Mar 26 21:23:07 [dhcpcd] eth0: removing default route via 192.168.3.1 metric 0

Mar 26 21:23:07 [dhcpcd] eth0: deleting IP address 192.168.3.101/24

Mar 26 21:23:07 [dhcpcd] eth0: exiting

Mar 26 21:23:07 [dhcpcd] eth0: dhcpcd 3.0.16 starting

Mar 26 21:23:07 [dhcpcd] eth0: hardware address = 00:17:9a:b6:67:cc

Mar 26 21:23:07 [dhcpcd] eth0: broadcasting for a lease of 192.168.3.100

Mar 26 21:23:07 [dhcpcd] eth0: received NAK: (null)

Mar 26 21:23:07 [dhcpcd] eth0: broadcasting for a lease

Mar 26 21:23:08 [dhcpcd] eth0: offered 192.168.3.101 from 192.168.3.1

Mar 26 21:23:08 [dhcpcd] eth0: leased 192.168.3.101 for 86400 seconds

Mar 26 21:23:08 [dhcpcd] eth0: no renewal time supplied, assuming 43200 seconds

Mar 26 21:23:08 [dhcpcd] eth0: no rebind time supplied, assuming 75600 seconds

Mar 26 21:23:08 [dhcpcd] eth0: adding IP address 192.168.3.101/24

Mar 26 21:23:08 [dhcpcd] eth0: adding default route via 192.168.3.1 metric 0

Mar 27 09:23:08 [dhcpcd] eth0: renewing lease of 192.168.3.101

Mar 27 18:23:08 [dhcpcd] eth0: lost lease, attemping to rebind

Mar 27 18:23:09 [dhcpcd] eth0: offered 192.168.3.102 from 192.168.3.1

Mar 27 18:23:09 [dhcpcd] eth0: leased 66.0.0.234 for 86400 seconds

Mar 27 18:23:09 [dhcpcd] eth0: no renewal time supplied, assuming 43200 seconds

Mar 27 18:23:09 [dhcpcd] eth0: no rebind time supplied, assuming 75600 seconds

Mar 27 18:23:09 [dhcpcd] eth0: adding IP address 66.0.0.234/24

Mar 27 18:23:09 [dhcpcd] eth0: deleting IP address 192.168.3.101/24

Mar 27 18:23:09 [dhcpcd] eth0: adding default route via 192.168.3.1 metric 0

Mar 27 18:23:09 [dhcpcd] eth0: netlink: Network is unreachable

```

```

Mar 27 22:03:55 [dhcpcd] eth0: received SIGTERM, stopping

Mar 27 22:03:55 [dhcpcd] eth0: removing default route via 192.168.3.1 metric 0

Mar 27 22:03:55 [dhcpcd] eth0: deleting IP address 66.0.0.234/24

Mar 27 22:03:55 [dhcpcd] eth0: exiting

Mar 27 22:03:56 [dhcpcd] eth0: dhcpcd 3.0.16 starting

Mar 27 22:03:56 [dhcpcd] eth0: hardware address = 00:17:9a:b6:67:cc

Mar 27 22:03:56 [dhcpcd] eth0: broadcasting for a lease of 192.168.3.100

Mar 27 22:03:56 [dhcpcd] eth0: received NAK: (null)

Mar 27 22:03:56 [dhcpcd] eth0: broadcasting for a lease

Mar 27 22:03:57 [dhcpcd] eth0: offered 192.168.3.102 from 192.168.3.1

Mar 27 22:03:57 [dhcpcd] eth0: leased 192.168.3.102 for 86400 seconds

Mar 27 22:03:57 [dhcpcd] eth0: no renewal time supplied, assuming 43200 seconds

Mar 27 22:03:57 [dhcpcd] eth0: no rebind time supplied, assuming 75600 seconds

Mar 27 22:03:57 [dhcpcd] eth0: adding IP address 192.168.3.102/24

Mar 27 22:03:57 [dhcpcd] eth0: adding default route via 192.168.3.1 metric 0

Mar 28 10:03:47 [dhcpcd] eth0: renewing lease of 192.168.3.102

Mar 28 18:23:59 [dhcpcd] eth0: ignoring packet with xid 290327817 as it's not ours (1724118985)

Mar 28 18:23:59 [dhcpcd] eth0: ignoring packet with xid 290327817 as it's not ours (1724118985)

                - Last output repeated twice -

Mar 28 19:03:50 [dhcpcd] eth0: lost lease, attemping to rebind

Mar 28 19:03:51 [dhcpcd] eth0: offered 192.168.3.100 from 192.168.3.1

Mar 28 19:03:51 [dhcpcd] eth0: leased 66.0.0.234 for 86400 seconds

Mar 28 19:03:51 [dhcpcd] eth0: no renewal time supplied, assuming 43200 seconds

Mar 28 19:03:51 [dhcpcd] eth0: no rebind time supplied, assuming 75600 seconds

Mar 28 19:03:51 [dhcpcd] eth0: adding IP address 66.0.0.234/24

Mar 28 19:03:51 [dhcpcd] eth0: deleting IP address 192.168.3.102/24

Mar 28 19:03:51 [dhcpcd] eth0: adding default route via 192.168.3.1 metric 0

Mar 28 19:03:51 [dhcpcd] eth0: netlink: Network is unreachable

Mar 28 19:04:48 [dhcpcd] no interface specified

Mar 28 19:04:56 [dhcpcd] eth0: sending signal 14 to pid 604

Mar 28 19:04:56 [dhcpcd] eth0: received SIGALRM, renewing lease

Mar 28 19:04:56 [dhcpcd] eth0: renewing lease of 66.0.0.234

Mar 28 19:04:56 [dhcpcd] eth0: received NAK: (null)

Mar 28 19:04:56 [dhcpcd] eth0: removing default route via 192.168.3.1 metric 0

Mar 28 19:04:56 [dhcpcd] eth0: deleting IP address 66.0.0.234/24

Mar 28 19:04:56 [dhcpcd] eth0: broadcasting for a lease

Mar 28 19:04:57 [dhcpcd] eth0: offered 192.168.3.100 from 192.168.3.1

Mar 28 19:04:57 [dhcpcd] eth0: leased 192.168.3.100 for 86400 seconds

Mar 28 19:04:57 [dhcpcd] eth0: no renewal time supplied, assuming 43200 seconds

Mar 28 19:04:57 [dhcpcd] eth0: no rebind time supplied, assuming 75600 seconds

Mar 28 19:04:57 [dhcpcd] eth0: adding IP address 192.168.3.100/24

Mar 28 19:04:57 [dhcpcd] eth0: adding default route via 192.168.3.1 metric 0

Mar 28 19:05:58 [dhcpcd] eth0: received SIGTERM, stopping

Mar 28 19:05:58 [dhcpcd] eth0: removing default route via 192.168.3.1 metric 0

Mar 28 19:05:58 [dhcpcd] eth0: deleting IP address 192.168.3.100/24

Mar 28 19:05:58 [dhcpcd] eth0: exiting

Mar 28 19:05:58 [dhcpcd] eth0: dhcpcd 3.0.16 starting

Mar 28 19:05:58 [dhcpcd] eth0: hardware address = 00:17:9a:b6:67:cc

Mar 28 19:05:58 [dhcpcd] eth0: broadcasting for a lease of 192.168.3.100

Mar 28 19:05:59 [dhcpcd] eth0: leased 192.168.3.100 for 86400 seconds

Mar 28 19:05:59 [dhcpcd] eth0: no renewal time supplied, assuming 43200 seconds

Mar 28 19:05:59 [dhcpcd] eth0: no rebind time supplied, assuming 75600 seconds

Mar 28 19:05:59 [dhcpcd] eth0: adding IP address 192.168.3.100/24

Mar 28 19:05:59 [dhcpcd] eth0: adding default route via 192.168.3.1 metric 0

```

By taking alook through the trace I found a few more interesting packets where it switched to 66.0.0.234 I'll email them to you so you can take a look.

----------

## deface

What device are you using for your dhcp server? What is your normal ip range given to you by your isp?

----------

## Tanj

normal ip range given by my router is 192.168.3.100-149

Bell Canada BELLCANADA-5 (NET-64-228-0-0-1) 

                                  64.228.0.0 - 64.231.255.255

Sympatico HSE SYMN060704-CA (NET-64-231-204-0-1) 

                                  64.231.204.0 - 64.231.207.255

my dhcp is from my router.

----------

## deface

Hmm, thats odd. I actually happen to work with the company who owns the ip range your getting a dhcp offer from. - ITC Deltacom - but they are based in south eastern US .. not Canada.

What type of router do you have? Can you verify the firmware is up to date? This honestly sounds like faulty hardware (router) to me. Possibly a used router? whose settings are flaky and falling back to its original config?

----------

## UberLord

OK, I think there is a bug in dhcpcd. There is also a bug in your router I suspect.

The clue was that we sent out one packet where we requested an IP of 0.0.0.0 - which is obviously wrong.

Anyway, I've tweaked things a little and whacked up a tarball for you to test.

http://dev.gentoo.org/~uberlord/dhcpcd-3.0.17_pre1.tar.bz2

Let me know if it works either way  :Smile: 

----------

## Tanj

ok, I installed your tar ball.

now we have to play the waiting game and see if it trips out again. I have started a wireshark trace again so we shall see what we see.

If it stays steady for more then 3days I'll post to say it is fine. If it craps out before I'll email you the relevant trace sections.

----------

## UberLord

Today is day 3, so we are working fine still? Can you check to see if a renew worked in your logs?

Thanks

----------

## Tanj

```

Apr  3 00:48:50 [dhcpcd] eth0: renewing lease of 192.168.3.100

Apr  3 09:48:50 [dhcpcd] eth0: lost lease, attemping to rebind

Apr  3 12:48:50 [dhcpcd] eth0: lost lease

Apr  3 12:48:50 [dhcpcd] eth0: removing default route via 192.168.3.1 metric 0

Apr  3 12:48:50 [dhcpcd] eth0: deleting IP address 192.168.3.100/24

Apr  3 12:48:50 [dhcpcd] eth0: broadcasting for a lease

Apr  3 12:48:51 [dhcpcd] eth0: offered 192.168.3.100 from 192.168.3.1

Apr  3 12:48:51 [dhcpcd] eth0: leased 192.168.3.100 for 86400 seconds

Apr  3 12:48:51 [dhcpcd] eth0: no renewal time supplied, assuming 43200 seconds

Apr  3 12:48:51 [dhcpcd] eth0: no rebind time supplied, assuming 75600 seconds

Apr  3 12:48:51 [dhcpcd] eth0: adding IP address 192.168.3.100/24

Apr  3 12:48:51 [dhcpcd] eth0: adding default route via 192.168.3.1 metric 0

```

well it seems to have kept the right ip so far.

Thanks for your help.

----------

## UberLord

Great!

dhcpcd-3.0.16 just went stable, so I'll hold off on releasing 3.0.17 until I know i I need to do any more urgent fixes.

----------

## UberLord

 *Tanj wrote:*   

> 
> 
> ```
> 
> Apr  3 00:48:50 [dhcpcd] eth0: renewing lease of 192.168.3.100
> ...

 

Still that does show that your router is NOT responding to the renew request correctly :/

----------

