linux下建立ipip隧道的脚本
#!/bin/bash
inet_ip="$1"
ipip_rmt_ip="$2"
ipip_num="$3"
modprobe ipip
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
ip tunnel add tun$ipip_num mode ipip remote $ipip_rmt_ip local $inet_ip ttl 64
ip link set tun$ipip_num mtu 1480 up
ip address add 172.16.$ipip_num.1 brd 255.255.255.255 peer 172.16.$ipip_num.2 dev tun$ipip_num
iptables -t mangle -o tun$ipip_num --insert FORWARD 1 -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:65495 -
j TCPMSS --clamp-mss-to-pmtu
#add tun
ipip.sh 118.122.117.134 76.74.154.100 100 >> $log
ipip.sh 118.122.117.134 180.92.185.70 101 >> $log
ipip.sh 118.122.117.134 66.55.88.48 105 >> $log
ipip.sh 118.122.117.134 103.246.244.174 104 >> $log
ipip.sh 118.122.117.134 180.92.185.67 106 >> $log
ipip.sh 182.151.212.242 50.97.237.130 102 >> $log
ipip.sh 182.151.212.242 216.12.198.98 103 >> $log
转载于:https://blog.51cto.com/luoguoling/1017998