On 12/27/05, Felix C. Stegerman <[EMAIL PROTECTED]> wrote: > I would recommend using laptop-net. It can automagically detect > whether you're at home or at work and adjust the network settings > accordingly. > > With my setup, it looks for ip 192.168.1.1 (my router at home) and > if it is found uses ip 192.168.1.104. Otherwise it uses DHCP > (at university). Above is also good. However even for above, you need to set the static IP of Home PC. See what IP your office net dhcp offers. If it is 192.168.1.x as mentioned above, then set home pc as 192.168.0.1. If you don't want to install additional package, use the following script(taken from this list and modified) as getting host ip at home. Else default will be dhcp at office. Script ======================== #!/bin/sh
#if [ `id -u` -ne 0 ] || [ "$1" = "" ]; then exit 1; fi ARPING="/usr/sbin/arping -fqc5" iface="$1" which="" while read addr pingme scheme; do if [ "$which" ]; then continue; fi if [ $scheme = nolink ];then which=nolink;echo $which;exit 0;fi #echo " Trying $addr & $pingme ($scheme)" >&2 ip addr add $addr dev $iface >/dev/null 2>&1 ip link set $iface up >/dev/null 2>&1 if $ARPING $pingme >/dev/null 2>&1; then which="$scheme" fi ip link set $iface down >/dev/null 2>&1 ip addr del $addr dev $iface >/dev/null 2>&1 done if [ "$which" ]; then echo $which; else exit 1;fi ========================================= put the above script in /usr/local/bin.(of course with chmod +x) Then use following /etc/network/interfaces ======================= iface lo inet loopback mapping eth0 script /usr/local/bin/arpip.sh map 192.168.0.2 192.168.0.1 home # Home network configuration iface home inet static address 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255 gateway 192.168.0.1 //if you use you home pc for coonecting to net # If not is found, try DHCP iface none inet dhcp ========================= regards -- L.V.Gandhi http://lvgandhi.tripod.com/ linux user No.205042