说明:通过ip/gre tunnel能够通过多个tunnel网关将公司内网和机房互通
例如:
一、公司:
UPIP:221.224.0.1
网关:192.168.1.1/24
network 公司
二、机房A:
UPIP:221.224.1.1
network 机房A
网关:10.30.1.1/24
三、机房B:
UPIP:221.224.2.1
网关:172.16.1.1/24
1、公司网关配置:
modprobe ipip
modprobe ip_gre
#tunnel for 机房A
ip tunnel add 机房A mode gre remote 221.224.1.1 local 221.224.0.1 ttl 255
ip link set 机房A up
ip addr add 192.168.1.1 dev 机房A
ip route add 10.30.1.0/24 dev 机房A
#tunnel for 机房B
ip tunnel add 机房B mode gre remote 221.224.2.1 local 221.224.0.1 ttl 255
ip link set 机房B up
ip addr add 192.168.1.1 dev 机房B
ip route add 172.16.1.0/24 dev 机房B
2、机房A网关配置:
ip tunnel add 机房A mode gre remote 221.224.0.1 local 221.224.1.1 ttl 255
ip link set 机房A up
ip addr add 10.30.1.1 dev 机房A
ip route add 192.168.1.0/24 dev 机房A
3、机房B网关配置:
ip tunnel add 机房B mode gre remote 221.224.0.1 local 221.224.2.1 ttl 255
ip link set 机房B up
ip addr add 172.16.1.1 dev 机房B
ip route add 192.168.1.0/24 dev 机房B