[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dhclient & switching networks



On Thu, 2005-09-08 at 09:59 -0300, Derek Broughton wrote:
> When I connect to my network at home through the lan (wired) connection of a
> Linksys WRT54G router, I get an address in the 192.168.1.* range, assigned
> by the DHCP server in the router.  Next morning when I connect at work,
> dhclient immediately gives me the same IP.
> 
> 
> Sep  8 08:44:18 othello dhclient: DHCPDISCOVER on eth0 to 255.255.255.255
> port 67 interval 4
> Sep  8 08:44:18 othello dhclient: DHCPOFFER from 192.168.1.1
> Sep  8 08:44:18 othello dhclient: DHCPREQUEST on eth0 to 255.255.255.255
> port 67
> Sep  8 08:44:18 othello dhclient: DHCPACK from 192.168.1.1
> 
> 
> What I should be getting is:
> 
> Sep  8 08:46:12 othello dhclient: DHCPDISCOVER on eth0 to 255.255.255.255
> port 67 interval 3
> Sep  8 08:46:12 othello dhclient: DHCPOFFER from 142.2.5.254
> Sep  8 08:46:12 othello dhclient: DHCPREQUEST on eth0 to 255.255.255.255
> port 67
> Sep  8 08:46:12 othello dhclient: DHCPACK from 142.2.5.254
> 
> It would seem somebody's got a rogue DHCP server on our network, but what
> confuses me is that if I simply delete the /var/run/dhclient.eth0.leases
> file (which _only_ contains the address from the home DHCP server, nothing
> from previous connections to this subnet), the next time I run dhclient it
> finds the right DHCP server and assigns the right address.

DHCP3 (at least) maintains a record of what your last lease and server
was.  It tries to get _that_ lease back, and normally there won't be a
rogue server at the same IP serving out the same IP address to you, and
that will all be fine and dandy.

A rogue, however, often _will_ be on either 192.168.1.1 or 192.168.0.1
as a default configuration.  I would recommend you change your home
network to not get bitten by this again.  For myself, the only time I
leave a router in such a default configuration is if there are only two
devices on that network.

In receiving a DHCP response, DHCP3 may not be just taking the _first_
server to respond - it can be waiting a little longer to see if it can't
get the same IP again from a different server.  See the comment around
"select-timeout" in the dhclient.conf manpage - in my config it is set
to 2 seconds, but I'm not sure if that's the default, or if I fiddled
with it :-)

Regards,
					Andrew McMillan.

-------------------------------------------------------------------------
Andrew @ Catalyst .Net .NZ  Ltd,  PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/            PHYS: Level 2, 150-154 Willis St
DDI: +64(4)803-2201      MOB: +64(272)DEBIAN      OFFICE: +64(4)499-2267
Pray to God, but keep rowing to shore.
                -- Russian Proverb
-------------------------------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: