Linux 双线自动切换脚本
touch /var/lock/subsys/local
#!/bin/sh
/sbin/modprobe _tables
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_conntrack_ftp
/sbin/iptables -F
/sbin/iptables -F -t nat
/sbin/iptables -X
/sbin/iptables -Z
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
/sbin/iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
/sbin/iptables -A FORWARD -s 0/0 -d 0/0 -j ACCEPT
echo "1"> /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT
iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
iptables -N syn-flood
iptables -A INPUT -p tcp --syn -j syn-flood
iptables -I syn-flood -p tcp -m limit --limit 3/s --limit-burst 6 -j RETURN
iptables -A syn-flood -j REJECT
sysctl -w net.ipv4.icmp_echo_ignore_all=1
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
## 默认路由表。和创建网通策略
ip rule add pref 10 from 221.2.175.203 table 10
ip route replace default via 221.2.175.193 dev eth2 table 10
ip rule add pref 20 from 222.274.219.130 table 20
ip route replace default via 222.274.219.129 dev eth1 table 20
ip route replace default via 221.2.175.193 table 11
## IP 伪装
iptables -t nat -I POSTROUTING -s 192.168.0.0/24 -d 222.274.219.130 -j SNAT --to 222.274.219.130
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to 221.2.175.203
#CNC ip rule
ip rule add to 58.14.0.0/15 table 11
ip rule add to 58.16.0.0/16 table 11
ip rule add to 58.17.128.0/17 table 11
ip rule add to 58.18.0.0/16 table 11
ip rule add to 58.21.0.0/16 table 11
ip rule add to 58.30.0.0/15 table 11
ip rule add to 58.42.0.0/16 table 11
ip rule add to 58.43.0.0/16 table 11
ip rule add to 58.44.0.0/14 table 11
ip rule add to 58.58.0.0/16 table 11
ip rule add to 58.59.0.0/17 table 11
ip rule add to 58.60.0.0/14 table 11
ip rule add to 58.87.64.0/18 table 11
ip rule add to 58.100.0.0/15 table 11
ip rule add to 58.116.0.0/14 table 11
ip rule add to 58.128.0.0/13 table 11
ip rule add to 58.144.0.0/16 table 11
ip rule add to 58.192.0.0/15 table 11
ip rule add to 58.194.0.0/15 table 11
ip rule add to 58.196.0.0/15 table 11
ip rule add to 58.200.0.0/13 table 11
ip rule add to 58.240.0.0/15 table 11
ip rule add to 58.242.0.0/15 table 11
ip rule add to 58.244.0.0/15 table 11
ip rule add to 58.248.0.0/13 table 11
ip rule add to 59.51.0.0/17 table 11
ip rule add to 59.68.0.0/14 table 11
ip rule add to 59.72.0.0/15 table 11
ip rule add to 59.74.0.0/15 table 11
ip rule add to 59.76.0.0/16 table 11
ip rule add to 59.77.0.0/16 table 11
ip rule add to 59.78.0.0/15 table 11
ip rule add to 59.108.0.0/15 table 11
ip rule add to 59.192.0.0/10 table 11
ip rule add to 60.0.0.0/13 table 11
ip rule add to 60.8.0.0/15 table 11
ip rule add to 60.10.0.0/16 table 11
ip rule add to 60.11.0.0/16 table 11
ip rule add to 60.12.0.0/16 table 11
ip rule add to 60.13.0.0/18 table 11
ip rule add to 60.13.128.0/17 table
ip rule add to 60.14.0.0/15 table 11
ip rule add to 60.16.0.0/13 table 11
ip rule add to 60.24.0.0/14 table 11
ip rule add to 60.28.0.0/15 table 11
ip rule add to 60.30.0.0/16 table 11
ip rule add to 60.31.0.0/16 table 11
ip rule add to 60.200.0.0/14 table 11
ip rule add to 60.204.0.0/16 table 11
ip rule add to 60.208.0.0/13 table 11
ip rule add to 60.216.0.0/15 table 11
ip rule add to 60.218.0.0/15 table 11
ip rule add to 60.220.0.0/14 table 11
ip rule add to 60.232.0.0/15 table 11
ip rule add to 60.255.0.0/16 table 11
ip rule add to 61.45.128.0/18 table 11
ip rule add to 61.48.0.0/13 table 11
ip rule add to 61.133.0.0/17 table 11
ip rule add to 61.134.96.0/19 table 11
ip rule add to 61.134.128.0/17 table 11
ip rule add to 61.135.0.0/16 table 11
ip rule add to 61.136.0.0/17 table 11
ip rule add to 61.137.128.0/17 table 11
ip rule add to 61.138.0.0/17 table 11
ip rule add to 61.138.128.0/18 table 11
ip rule add to 61.139.128.0/18 table 11
ip rule add to 61.148.0.0/15 table 11
ip rule add to 61.156.0.0/16 table 11
ip rule add to 61.158.0.0/16 table 11
ip rule add to 61.159.0.0/18 table 11
ip rule add to 61.161.0.0/18 table 11
ip rule add to 61.161.128.0/17 table 11
ip rule add to 61.162.0.0/16 table 11
ip rule add to 61.163.0.0/16 table 11
ip rule add to 61.167.0.0/16 table 11
ip rule add to 61.168.0.0/16 table 11
ip rule add to 61.176.0.0/16 table 11
ip rule add to 61.179.0.0/16 table 11
ip rule add to 61.180.128.0/17 table 11
ip rule add to 61.181.0.0/16 table 11
ip rule add to 61.182.0.0/16 table 11
ip rule add to 61.189.0.0/17 table 11
ip rule add to 125.32.0.0/16 table 11
ip rule add to 125.80.0.0/13 table 11
ip rule add to 125.88.0.0/13 table 11
ip rule add to 134.196.0.0/16 table 11
ip rule add to 162.105.0.0/16 table 11
ip rule add to 166.111.0.0/16 table 11
ip rule add to 192.83.122.0/24 table 11
ip rule add to 192.83.169.0/24 table 11
ip rule add to 192.124.154.0/24 table 11
ip rule add to 192.188.170.0/24 table 11
ip rule add to 198.17.7.0/24 table 11
ip rule add to 202.0.110.0/24 table 11
ip rule add to 202.0.160.0/20 table 11
ip rule add to 202.0.176.0/22 table 11
ip rule add to 202.3.77.0/24 table 11
ip rule add to 202.4.128.0/19 table 11
ip rule add to 202.4.252.0/22 table 11
ip rule add to 202.14.88.0/24 table 11
ip rule add to 202.14.235.0/24 table 11
ip rule add to 202.14.236.0/23 table 11
ip rule add to 202.14.238.0/24 table 11
ip rule add to 202.20.120.0/24 table 11
ip rule add to 202.38.0.0/23 table 11
ip rule add to 202.38.2.0/23 table 11
ip rule add to 202.38.4.0/22 table 11
ip rule add to 202.38.8.0/21 table 11
ip rule add to 202.38.64.0/19 table 11
ip rule add to 202.38.96.0/19 table 11
ip rule add to 202.38.130.0/23 table 11
ip rule add to 202.38.135.0/24 table 11
ip rule add to 202.38.136.0/24 table 11
ip rule add to 202.38.137.0/24 table 11
ip rule add to 202.38.138.0/24 table 11
ip rule add to 202.38.140.0/23 table 11
ip rule add to 202.38.142.0/24 table 11
ip rule add to 202.38.143.0/24 table 11
ip rule add to 202.38.144.0/23 table 11
ip rule add to 202.38.146.0/23 table 11
ip rule add to 202.38.149.0/24 table 11
ip rule add to 202.38.150.0/23 table 11
ip rule add to 202.38.152.0/23 table 11
ip rule add to 202.38.154.0/23 table 11
ip rule add to 202.38.156.0/24 table 11
ip rule add to 202.38.158.0/23 table 11
ip rule add to 202.38.160.0/23 table 11
ip rule add to 202.38.164.0/22 table 11
ip rule add to 202.38.168.0/24 table 11
ip rule add to 202.38.169.0/24 table 11
ip rule add to 202.38.170.0/24 table 11
ip rule add to 202.38.171.0/24 table 11
ip rule add to 202.38.172.0/24 table 11
ip rule add to 202.38.173.0/24 table 11
ip rule add to 202.38.175.0/24 table 11
ip rule add to 202.38.184.0/21 table 11
ip rule add to 202.38.192.0/18 table 11
ip rule add to 202.41.152.0/21 table 11
ip rule add to 202.43.144.0/20 table 11
ip rule add to 202.46.32.0/19 table 11
ip rule add to 202.46.224.0/20 table 11
ip rule add to 202.60.112.0/20 table 11
ip rule add to 202.63.248.0/22 table 11
ip rule add to 202.70.0.0/19 table 11
ip rule add to 202.75.208.0/20 table 11
ip rule add to 202.90.0.0/22 table 11
ip rule add to 202.90.224.0/20 table 11
ip rule add to 202.90.252.0/22 table 11
ip rule add to 202.91.0.0/22 table 11
ip rule add to 202.91.128.0/22 table 11
ip rule add to 202.92.0.0/22 table 11
ip rule add to 202.92.252.0/22 table 11
ip rule add to 202.94.0.0/19 table 11
ip rule add to 202.95.0.0/22 table 11
ip rule add to 202.95.4.0/22 table 11
ip rule add to 202.95.8.0/21 table 11
ip rule add to 202.95.16.0/20 table 11
ip rule add to 202.95.252.0/22 table 11
ip rule add to 202.96.0.0/18 table 11
ip rule add to 202.96.64.0/21 table 11
ip rule add to 202.96.72.0/21 table 11
ip rule add to 202.96.80.0/20 table 11
ip rule add to 202.97.96.0/20 table 11
ip rule add to 202.97.112.0/20 table 11
ip rule add to 202.97.128.0/18 table 11
ip rule add to 202.97.192.0/19 table 11
ip rule add to 202.97.224.0/21 table 11
ip rule add to 202.97.232.0/21 table 11
ip rule add to 202.97.240.0/20 table 11
ip rule add to 202.98.0.0/21 table 11
ip rule add to 202.98.8.0/21 table 11
ip rule add to 202.98.16.0/20 table 11
ip rule add to 202.99.0.0/18 table 11
ip rule add to 202.99.64.0/19 table 11
ip rule add to 202.99.96.0/21 table 11
ip rule add to 202.99.104.0/21 table 11
ip rule add to 202.99.112.0/20 table 11
ip rule add to 202.99.128.0/19 table 11
ip rule add to 202.99.160.0/21 table 11
ip rule add to 202.99.168.0/21 table 11
ip rule add to 202.99.176.0/20 table 11
ip rule add to 202.99.192.0/21 table 11
ip rule add to 202.99.200.0/21 table 11
ip rule add to 202.99.208.0/20 table 11
ip rule add to 202.99.224.0/21 table 11
ip rule add to 202.99.232.0/21 table 11
ip rule add to 202.99.240.0/20 table 11
ip rule add to 202.102.128.0/21 table 11
ip rule add to 202.102.136.0/21 table 11
ip rule add to 202.102.144.0/20 table 11
ip rule add to 202.102.160.0/19 table 11
ip rule add to 202.102.224.0/21 table 11
ip rule add to 202.102.232.0/21 table 11
ip rule add to 202.102.240.0/20 table 11
ip rule add to 202.106.0.0/16 table 11
ip rule add to 202.107.0.0/17 table 11
ip rule add to 202.108.0.0/16 table 11
ip rule add to 202.110.0.0/17 table 11
ip rule add to 202.110.192.0/18 table 11
ip rule add to 202.111.128.0/18 table 11
ip rule add to 202.111.192.0/18 table 11
ip rule add to 202.112.0.0/16 table 11
ip rule add to 202.113.16.0/20 table 11
ip rule add to 202.113.32.0/19 table 11
ip rule add to 202.113.64.0/18 table 11
ip rule add to 202.113.128.0/18 table 11
ip rule add to 202.113.192.0/19 table 11
ip rule add to 202.113.224.0/20 table 11
ip rule add to 202.113.240.0/20 table 11
ip rule add to 202.114.0.0/19 table 11
ip rule add to 202.114.32.0/19 table 11
ip rule add to 202.114.64.0/18 table 11
ip rule add to 202.114.128.0/17 table 11
ip rule add to 202.115.0.0/19 table 11
ip rule add to 202.115.32.0/19 table 11
ip rule add to 202.115.128.0/17 table 11
ip rule add to 202.116.0.0/19 table 11
ip rule add to 202.116.32.0/20 table 11
ip rule add to 202.116.48.0/20 table 11
ip rule add to 202.116.64.0/19 table 11
ip rule add to 202.116.96.0/19 table 11
ip rule add to 202.116.128.0/17 table 11
ip rule add to 202.117.0.0/18 table 11
ip rule add to 202.117.64.0/18 table 11
ip rule add to 202.117.128.0/17 table 11
ip rule add to 202.118.0.0/19 table 11
ip rule add to 202.118.32.0/19 table 11
ip rule add to 202.118.64.0/18 table 11
ip rule add to 202.118.128.0/17 table 11
ip rule add to 202.119.0.0/19 table 11
ip rule add to 202.119.64.0/20 table 11
ip rule add to 202.119.80.0/20 table 11
ip rule add to 202.119.96.0/19 table 11
ip rule add to 202.119.128.0/17 table 11
ip rule add to 202.120.0.0/18 table 11
ip rule add to 202.120.64.0/18 table 11
ip rule add to 202.120.128.0/17 table 11
ip rule add to 202.121.0.0/16 table 11
ip rule add to 202.122.0.0/21 table 11
ip rule add to 202.122.112.0/21 table 11
ip rule add to 202.122.128.0/24 table 11
ip rule add to 202.123.96.0/20 table 11
ip rule add to 202.127.2.0/24 table 11
ip rule add to 202.127.4.0/24 table 11
ip rule add to 202.127.5.0/24 table 11
ip rule add to 202.127.6.0/23 table 11
ip rule add to 202.127.40.0/21 table 11
ip rule add to 202.127.128.0/20 table 11
ip rule add to 202.127.192.0/23 table 11
ip rule add to 202.127.194.0/23 table 11
ip rule add to 202.127.196.0/22 table 11
ip rule add to 202.127.208.0/24 table 11
ip rule add to 202.127.209.0/24 table 11
ip rule add to 202.127.212.0/22 table 11
ip rule add to 202.127.216.0/21 table 11
ip rule add to 202.127.224.0/19 table 11
ip rule add to 202.130.0.0/19 table 11
ip rule add to 202.130.224.0/19 table 11
ip rule add to 202.131.48.0/20 table 11
ip rule add to 202.136.48.0/20 table 11
ip rule add to 202.136.208.0/20 table 11
ip rule add to 202.136.224.0/20 table 11
ip rule add to 202.136.252.0/22 table 11
ip rule add to 202.142.16.0/20 table 11
ip rule add to 202.149.224.0/19 table 11
ip rule add to 202.150.16.0/20 table 11
ip rule add to 202.152.176.0/20 table 11
ip rule add to 202.158.160.0/19 table 11
ip rule add to 202.165.96.0/20 table 11
ip rule add to 202.168.160.0/20 table 11
ip rule add to 202.168.176.0/20 table 11
ip rule add to 202.170.128.0/19 table 11
ip rule add to 202.173.8.0/21 table 11
ip rule add to 202.180.128.0/19 table 11
ip rule add to 202.192.0.0/13 table 11
ip rule add to 202.200.0.0/14 table 11
ip rule add to 202.204.0.0/14 table 11
ip rule add to 203.79.0.0/20 table 11
ip rule add to 203.81.16.0/20 table 11
ip rule add to 203.86.64.0/20 table 11
ip rule add to 203.86.80.0/20 table 11
ip rule add to 203.88.32.0/19 table 11
ip rule add to 203.89.0.0/22 table 11
ip rule add to 203.90.0.0/22 table 11
ip rule add to 203.91.32.0/19 table 11
ip rule add to 203.91.96.0/20 table 11
ip rule add to 203.92.0.0/22 table 11
ip rule add to 203.94.0.0/22 table 11
ip rule add to 203.94.4.0/22 table 11
ip rule add to 203.94.8.0/21 table 11
ip rule add to 203.94.16.0/20 table 11
ip rule add to 203.95.96.0/20 table 11
ip rule add to 203.100.32.0/20 table 11
ip rule add to 203.100.96.0/19 table 11
ip rule add to 203.119.24.0/21 table 11
ip rule add to 203.128.32.0/19 table 11
ip rule add to 203.130.32.0/19 table 11
ip rule add to 203.132.32.0/19 table 11
ip rule add to 203.134.240.0/21 table 11
ip rule add to 203.135.96.0/20 table 11
- 最新评论