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

Re: different networks, same computer (map mapping ?)

On Monday 01 November 2004 03:19 pm, H. S. wrote:
> I would like a laptop to work in two kinds of networks automatically if
> possible. At home, I am running a DHCP server and if the laptop is
> connected to my switch(CAT5 cable to eth0) and booted up, it looks for
> and gets an IP address (it is running a dhcp client). Now when that
> laptop is taken to the university, the user needs to change the
> /etc/network/interfaces file to give the machine a static address. I am
> looking for a way that this choice between dhcp/static happens
> automatically.
> I have been reading manpages of interfaces and learned we can map a
> physical device as logical devices and make it work in different modes.
> I am looking for examples where this is already done, the documentation
> in man interfaces is, well,  not very clear about all the nuts and
> bolts, or so I believe. All help is appreciated.
> Thanks,
> ->HS

I have a similar setup.  I used ifplugd and guessnet.  You have to modify 
slightly /etc/network/interfaces.  I supposed you don't need ifplugd, but it 
is nice to be able to start up my laptop quickly without having any type of 
network cable installed.  Once you plug a cable in, ifplugd will configure 
things for you. 

Anyway, here are some snippets from my /etc/network/interfaces file:

# The primary network interface
# turn off since ifplugd is controlling things
#auto eth0

mapping eth0
        script /usr/sbin/guessnet-ifupdown
        map default: none
        map timeout: 3
        map verbose: true

iface work inet dhcp
        test-peer address x.x.x.x MAC.address

iface home inet static
        test-peer address MAC.address


x.x.x.x is the IP address of a known computer on the network that should be 
always there.  The MAC.address is the hardware MAC address of this computer.

Pretty simple setup but works nicely.


Reply to: