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

Re: dhclient & switching networks



On Thursday 08 September 2005 16:18, Andrew McMillan wrote:
> 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.

OK.  That's good - because that's exactly what seems to be happening, but
the man page implied that it only uses the lease file as a _last_ resort,
not a first one.
>
> 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.

OK, makes sense.  I think I can find a reasonable private IP range that
isn't likely to come up more than once a millenium :-)

> 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 :-)

Excellent.  Thank you Andrew.  You're the Man :-)
-- 
derek



Reply to: