|
I am moving my linux laptop between three locations: two LANs at work,
and my home LAN, connected to the internet via a cable modem.
The laptop is a Dell Inspiron 3500, and the linux installation started out as SuSE 6.2 (with ISC dhclient as the DHCP client). Ever since I got my laptop, and rebuilt the kernel (2.2.10) to have APM suppord, I have used suspend/resume rather than shutdown and reboot when moving between networks, but I had to use some scripts run as root to do so (basically "ifconfig eth0 down", and killing the dhclient before suspend, and "/sbin/dhclient start" when resuming). I finally got the finger out and started trying to automate this. After a kernel upgrade, upgrading to pcmcia-3.1.14, and hacking the /etc/network/pcmcia script, things seemed to work fairly stably The hacking to the /etc/pcmcia/network script consists of making 'resume' behave as 'start', and 'suspend' behave like 'stop'. I also copied what the SuSE /sbin/init.d/dhclient script does when starting the demon: give the device an IP number. From the logs it looks like dhclient needs to have an IP number set to be able to get a response from the server. Why this is, I have no idea. - Steinar The changes to the network script is given as a diff: *** /usr/src/pcmcia-cs-3.1.14/etc/network Sat Apr 8 00:18:39 2000 --- /etc/pcmcia/network Tue May 2 18:12:10 2000 *************** *** 50,56 ****
case "$ACTION" in ! 'start')
test "$IF_PORT" && /sbin/ifport $DEVICE $IF_PORT --- 50,56 ----
case "$ACTION" in ! 'start'|'resume')
test "$IF_PORT" && /sbin/ifport $DEVICE $IF_PORT
***************
*** 94,99 ****
--- 94,102 ----
fi
fi
elif [ -x /sbin/dhclient ] ; then
+ ifconfig $DEVICE down > /dev/null 2>&1
+ ifconfig $DEVICE 192.168.1.254 broadcast 192.168.1.255 netmask 255.255.255.0 up
+ /sbin/route add -host 255.255.255.255 dev $DEVICE
/sbin/dhclient $DEVICE >/dev/null 2>&1 || exit 1
elif [ -x /sbin/pump ] ; then
/sbin/pump $HN -i $DEVICE
***************
*** 142,148 ****
start_fn $DEVICE
;;
! 'stop')
stop_fn $DEVICE
--- 145,151 ----
start_fn $DEVICE
;;
! 'stop'|'suspend')
stop_fn $DEVICE
***************
*** 226,233 ****
test "$IPADDR" && /sbin/ifconfig $DEVICE down up
;;
- 'suspend'|'resume') - ;;
*)
usage
--- 229,234 ----
|