网络模型
G1
auto eth0
iface eth0 inet static
address 172.16.4.121
netmask 255.255.0.0
gateway 172.16.1.1
auto eth1
iface eth1 inet static
address 192.168.10.1
netmask 255.255.255.0
G2
$ cat/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.100.255
HWADDR=00:0c:29:f0:6d:a5
IPADDR=192.168.100.117
NETMASK=255.255.255.0
NETWORK=192.168.100.0
ONBOOT=yes
#GATEWAY=192.168.100.1
TYPE=Ethernet
$ cat/etc/sysconfig/network-scripts/ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970[PCnet32 LANCE]
DEVICE=eth1
BOOTPROTO=none
BROADCAST=192.168.10.255
IPADDR=192.168.10.2
NETMASK=255.255.255.0
NETWORK=192.168.10.0
ONBOOT=yes
GATEWAY=192.168.10.1
TYPE=Ethernet
在G1上
创建tunnel0
insmod /lib/modules/2.6.28-11-server/kernel/net/ipv4/ip_gre.ko
ip tunnel del tunnel0
ip tunnel add tunnel0 mode gre remote172.16.4.116 local 172.16.4.121 ttl 255
ip link set tunnel0 up mtu 1400
ip addr add 10.0.1.1/30dev tunnel0
ip route add 192.168.20.0/24 dev tunnel0
在G2上
创建tunnel0
insmod /lib/modules/2.6.32-5-686/kernel/net/ipv4/ip_gre.ko
ip tunnel del tunnel0
ip tunnel add tunnel0 mode gre remote172.16.4.121 local 172.16.4.116 ttl 255
ip link set tunnel0 up mtu 1400
ip addr add 10.0.1.2/30dev tunnel0
ip route add 192.168.10.0/24 dev tunnel0