55 lines
1.2 KiB
Bash
55 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $Id$
|
|
#
|
|
# Simple example how you can missuse kip to provide "mobile-ip".
|
|
# This is since there is no way to tunnel ip over udp or any other
|
|
# protocol. There is also problems to get thru firewalls and NATs
|
|
# with mobile-ip since (today) they usully doesn't support IPIP or
|
|
# GRE.
|
|
#
|
|
# All commands are for linux (redhat6.1) but it should be quite
|
|
# simple to fix it to support other OS.
|
|
#
|
|
|
|
PATH=/sbin:/usr/sbin:/usr/bin:/bin
|
|
|
|
# arguments are: [up|down] dev remote-peer-addr user
|
|
|
|
state=$1
|
|
dev=$2
|
|
remote=$3
|
|
user=$4
|
|
|
|
outdevice=eth0
|
|
|
|
case "$state" in
|
|
up)
|
|
case "$user" in
|
|
lha.root@E.KTH.SE)
|
|
ifconfig $dev 10.0.0.1 pointopoint 130.237.43.17
|
|
route add -host 130.237.43.17 gw 10.0.0.1
|
|
arp -H ether -i $outdevice \
|
|
-s 130.237.43.17 00:80:c8:82:83:61 pub
|
|
;;
|
|
esac
|
|
;;
|
|
down)
|
|
case "$user" in
|
|
lha.root@E.KTH.SE)
|
|
ifconfig $dev 0.0.0.0
|
|
ifconfig $dev down
|
|
arp -i $outdevice -d 130.237.43.17
|
|
arp -d 130.237.43.17
|
|
true
|
|
;;
|
|
*)
|
|
ifconfig $dev down
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
exit 17
|
|
;;
|
|
esac
|