📄 rcv.sh
字号:
#!/bin/shTZ=GMT export TZipsec spi --clearipsec eroute --clearenckey1=0x4043434545464649494a4a4c4c4f4f515152525454575758enckey2=0x5464649494a4a4c4c4f4f515152525454575758404343454authkey1=0x87658765876587658765876587658765authkey2=0x65876587658765876587658765876587: set up SPI 1sa1=`ipsec spi --af inet --edst 192.1.2.45 --spi 0x88447755 --proto esp --src 192.1.2.23 --esp 3des-md5-96 --enckey $enckey1 --authkey $authkey1 --saref | cut -d '=' -f2`echo SA1 $sa1sa2=`ipsec spi --af inet --edst 192.1.2.45 --spi 0x88447755 --proto tun --src 192.1.2.23 --dst 192.1.2.45 --ip4 --saref | cut -d '=' -f2`echo SA2 $sa2ipsec spigrp inet 192.1.2.45 0x88447755 tun inet 192.1.2.45 0x88447755 esp : set up SPI 2sa3=`ipsec spi --af inet --edst 192.1.2.45 --spi 0x12345678 --proto esp --src 192.1.2.23 --esp 3des-md5-96 --enckey $enckey2 --authkey $authkey2 --saref | cut -d '=' -f2`echo SA3 $sa3sa4=`ipsec spi --af inet --edst 192.1.2.45 --spi 0x12345678 --proto tun --src 192.1.2.23 --dst 192.1.2.45 --ip4 --saref | cut -d '=' -f2`echo SA4 $sa4ipsec spigrp inet 192.1.2.45 0x12345678 tun inet 192.1.2.45 0x12345678 esp ipsec looksa1=$(printf "0x%08x" $(expr $sa1 '*' 65536))sa2=$(printf "0x%08x" $(expr $sa2 '*' 65536))sa3=$(printf "0x%08x" $(expr $sa3 '*' 65536))sa4=$(printf "0x%08x" $(expr $sa4 '*' 65536))echo SA1 $sa1echo SA2 $sa2echo SA3 $sa3echo SA4 $sa4: now setup of the nfmark based switchingmkdir -p /etc/iproute2echo '11 sa1' >>/etc/iproute2/rt_tablesecho '12 sa2' >>/etc/iproute2/rt_tablesecho '13 sa3' >>/etc/iproute2/rt_tablesecho '14 sa4' >>/etc/iproute2/rt_tablesip rule add fwmark $sa2 table sa2ip route add default via 192.1.2.254 dev eth1 table sa2ipsec tncfg --attach --virtual ipsec0 --physical eth1ifconfig ipsec0 inet 192.1.2.45 netmask 0xffffff00 broadcast 192.1.2.255 up# stuff the ARP table for the destinations involvedarp -s 192.1.2.23 10:00:00:64:64:23arp -s 192.1.2.254 10:00:00:64:64:fearp -s 192.0.1.1 10:00:00:32:32:01arp -s 192.9.2.254 10:00:00:99:99:fe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -