On Thu, 12 May 2005 18:50:07 +0200, H. S. wrote: > Hi,
Hi. > I am supposed to configure a laptop so that is can be connected to a > CAT5 cable on either a home LAN or a university LAN. Currently, the > laptop is configured as a dhcp client in the home network and has a > fixed IP address in the university network. I'm in exactly the same situation and after some fiddling I've arrived at a setup that works very well. The packages I use are ifplugd - automatically configure/deconfigure interfaces when the link status changes guessnet - tools for checking which network you're on resolvconf - notify libc etc of changes in current DNS servers nscd - cache DNS information (not really necessary, but useful if your ISP has flaky name servers) iputils-arping - useful for setting up your /etc/network/interfaces dhcp3-client - ISC DHCP client The contents of (relevant parts of) the most important config files are as follows, with some additional comments interspersed: /etc/network/interfaces ------------------------------- auto lo iface lo inet loopback mapping eth0 script /usr/sbin/guessnet-ifupdown map ubc home map default: home iface ubc inet static address A.B.C.D # Substitute your assigned static IP for A.B.C.D netmask 255.255.255.0 # Or whichever netmask you should have gateway X.Y.Z.W # Your default gw IP goes here dns-nameservers 1.2.3.4 5.6.7.8 # IP's of your nameservers go here test-peer address X.Y.Z.W mac e:f:g:h:i:j source A.B.C.D # The line just above checks the mac address of your default gateway # You should already know what "X.Y.Z.W" and "A.B.C.D" are # To find "e:f:g:h:i:j", type "arping X.Y.Z.W" in a terminal window iface home inet dhcp # No tests or anything else needed here. If the above test-peer # fails, the home interface should be brought up by default and # everything set up via DHCP. -------------------------------- /etc/default/ifplugd ----------------------------------- INTERFACES="eth0" HOTPLUG_INTERFACES="" ARGS="-q -f -u0 -d10 -w -I" SUSPEND_ACTION="stop" ---------------------------------- /etc/default/hotplug -------------------------------- # Some lines before this # NET_AGENT_POLICY # - how to manage network interfaces with ifupdown? 'all', 'auto' or 'hotplug' NET_AGENT_POLICY=hotplug # and some lines after this ------------------------------- Regards, Johan