📄 ip-up
字号:
#!/bin/sh# ip-up <interface> <myaddr> <daemon-pid> <local> <remote> <arg># Sample of the ip-up script.# This is called when the CIPE interface is opened.# Arguments:# $1 interface the CIPE interface# $2 myaddr our UDP address# $3 daemon-pid the daemon's process ID# $4 local IP address of our CIPE device# $5 remote IP address of the remote CIPE device# $6 arg argument supplied via options# Purposes for this script: set up routes, set up proxy-arps, etc.# start daemons, logging...umask 022PATH=/sbin:/bin:/usr/sbin:/usr/bincase `uname -r` in2.0*) # Under Linux 2.0, a minimal route to the remote CIPE is needed. # 2.1 and later sets this one by itself. route add -host $5 dev $1 ;;esac# If this becomes our default route...#route add default gw $5# just a logging examplenow=`date "+%b %d %T"`echo "$now UP $*" >> /var/log/cipe.log# Create/update PID file. Note: PKCIPE needs this.# You can instead use the piddir option with the right path.echo "$3 $1" >/var/run/cipe/${6:-$1}.pid# Trigger the key exchange procedure, useful when we're using SOCKS# This _must_ run delayed and in the background#(sleep 10; ping -c5 $5) &# If the system runs gated, tell it what has happened#gdc interface# The following are just ideas for further consideration# Interconnect two 10. subnets through the Internet!# Assuming $4 is in 10.1 and $5 in 10.2#route add -net 10.2.0.0 netmask 255.255.0.0 gw $5# Proxy-ARP the peer's address on eth0#arp -i eth0 -Ds $5 eth0 pub# For Linux 2.4: Prox-ARP the whole network behind the peer.# Do this after setting up the route.#echo 1 >/proc/sys/net/ipv4/conf/$1/proxy_arp# Evil tricks department: masquerade the CIPE peer's /24 network to our IP# (shown here in ipfwadm syntax for 2.0)#NA=`expr $5 : '\([0-9]*\.[0-9]*\.[0-9]*\.\)'`#ipfwadm -F -a accept -m -b -S $NA.0/24 -D 0.0.0.0/0# the usual way for this would be a case selection on $5 or $6, howeverexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -