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

Re: Current recommended automatic laptop network configuration tools?



Brian Flaherty wrote:
> Like many, I have a laptop that I use in multiple settings:
> - home wired
> - home wireless
> - work wired
> - work wireless
> - roaming around (hotels, coffee shops, airports etc.)

Me too.

> Right now, I used wicd, but I get different IPs at home whether I'm on wired
> or wireless. 

Each interface will have a different and unique ethernet MAC address.
The DHCP server will see each of those interfaces as a different
identity based upon the different ethernet address.  This is as per
standard practice for dhcp servers.  This is why your different
interfaces are getting different IP address assignments.  And if you
had both wired and wifi connected at the same time with the same
ethernet address it would cause routing confusion.  So this is all
good and by design.

> I'd like to set a static wired IP at home, but use dhcp wired
> at work.

> What do others do now with these sort of use patterns? Is whereami what I
> should learn to use? All the files refer to old kernels, APM, etc. Does it
> matter that it is not new?

As others have suggested you should instruct your dhcp server to
allocate the desired address.  Keep your interface using dhcp both
places.  At your home configure a static address for that dhcp
ethernet address.  Different dhcp servers call it different things.
Some home routers call it a dhcp reservation.  Others call it
different things.  But they should all have a way to configure that a
particular ethernet address is always allocated the same IP address.

If you do that then you will always get the same IP address at home
and will get a dynamic address at work and other places.  Easy.

If you want the same IP address on both wifi and wired that is a
little more interesting because they will have different ethernet
addresses.  If you promise not to connect both of them at the same
time then I would set the same ethernet address on both of them.  I
didn't test this so no guarantee but I think it would be worth a try
to try this:

$ cat /etc/network/if-pre-up.d/set-ethernet-mac-address
#!/bin/sh
address=so:me:ad:dr:es:sh:ere
ip link set $IFACE up address $address

That will set the ethernet address when the device comes up.  If you
set the same ethernet address for both eth0 and wlan0 then both of
those should negotiate the same address from your home router.

Note again that I didn't test the above so beware of problems that I
didn't anticipate.

> I found this page about netscheme.py:
> 
> http://www.shallowsky.com/linux/networkSchemes.html
> 
> I have to type with this one, whereas whereami sounds like it works in the
> background.
> 
> I did also page through many months of debian-laptop, looking for threads
> about this, but nothing jumped out at me.

There are many different strategies all quite different all with the
same goal.

What I do is I set up OpenVPN on my laptop.  On the VPN network I
assign a static IP address.  My laptop always has a static address on
my VPN network and therefore the dynamically assigned IP address no
longer matters to me.  My router is also a Debian system and both it
and my mobile devices can easily run OpenVPN.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: