Re: /etc/interfaces for logical interfaces

2005-12-27 Thread L.V.Gandhi
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



Re: /etc/interfaces for logical interfaces

2005-12-27 Thread Felix C. Stegerman
On 2005-12-27 11:54:08, Joachim Fahnenmüller wrote:
> Hi everybody,
> 
> I read man interfaces but didn't understand completely.
> 
> I have a laptop with 1 interface eth0, and I want 2 setups: at work with inet
> dhcp, at home (to exchange data with my PC) inet static with a certain IP. 
> (If I
> understand correctly that is what they call 'logical interfaces'.)
> 
> What must I write in /etc/interfaces so that I can do e. g. 
> ifup eth0-home (eth0=home ?)
> to start eth0 with the desired settings?

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).


Felix

-- 
Felix C. Stegerman <[EMAIL PROTECTED]>

"Any sufficiently advanced bug is indistinguishable from a feature."
 -- R. Kulawiec


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



/etc/interfaces for logical interfaces

2005-12-27 Thread Joachim Fahnenmüller
Hi everybody,

I read man interfaces but didn't understand completely.

I have a laptop with 1 interface eth0, and I want 2 setups: at work with inet
dhcp, at home (to exchange data with my PC) inet static with a certain IP. (If I
understand correctly that is what they call 'logical interfaces'.)

What must I write in /etc/interfaces so that I can do e. g. 
ifup eth0-home (eth0=home ?)
to start eth0 with the desired settings?

THX
-- 
Joachim Fahnenmüller


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]