1、环境搭建完成
2、Mrwind和Unicom上加载gre模块
#modprobe ip_gre
#lsmod | grep ip_gre
3、Mrwind-Server
#ip tunnel add tunnel0 mode gre remote 172.16.1.2 local 172.16.1.1 ttl 245
#ip link set tunnel0 up mtu 1400
#ip addr add 192.168.1.1/30 dev tunnel0
#ip addr add 192.168.1.1/30 peer 192.168.1.2 dev tunnel0
#ip route add 10.0.0.155/32 dev tunnel0
4、Unicom-Server
#ip tunnel add tunnel0 mode gre remote 172.16.1.1 local 172.16.1.2 ttl 245
#ip link set tunnel0 up mtu 1400
#ip add add 192.168.1.2/30 dev tunnel0
#ip addr add 192.168.1.2/30 peer 192.168.1.1/30 dev tunnel0
# ip route add 10.0.0.160/32 dev tunnel0
5、测试
#ip add show
#ifconfig
6、开机自动安装Ip-gre.ko,在Mrwind和Unicom
#vim /etc/rc.d/init.d/gre.sh
modprobe ip_gre
ip tunnel add tunnel0 mode gre remote 172.16.1.2 local 172.16.1.1 ttl 245
ip link set tunnel0 up mtu 1400
ip addr add 192.168.1.1/30 dev tunnel0
ip addr add 192.168.1.1/30 peer 192.168.1.2 dev tunnel0
ip route add 10.0.0.155/32 dev tunnel0
#chmod +x /etc/rc.d/init.d/gre.sh
#echo "/etc/rc.d/init.d/gre.sh">>/etc/rc.d/rc.local
#vim /etc/rc.d/init.d/gre.sh
modprobe ip_gre
ip tunnel add tunnel0 mode gre remote 172.16.1.1 local 172.16.1.2 ttl 245
ip link set tunnel0 up mtu 1400
ip add add 192.168.1.2/30 dev tunnel0
ip addr add 192.168.1.2/30 peer 192.168.1.1/30 dev tunnel0
ip route add 10.0.0.160/32 dev tunnel0
#chmod +x /etc/rc.d/init.d/gre.sh
#echo "/etc/rc.d/init.d/gre.sh">>/etc/rc.d/rc.local
转载于:https://blog.51cto.com/imperialzhang/1711384