两台Linux建立GRE隧道

1.拓扑图: 

两台Linux建立GRE隧道

备注:因为应用原因,需要在linux2上添加一个公网地址,并且在中间路由设备不受控制的情况下,Linux1能访问到linux2上面的公网地址。

2.基本接口配置:

linux1:192.168.10.1/24

linux2:192.168.20.2/24

R1:

interface FastEthernet0/0
 ip address 192.168.10.10 255.255.255.0
 no shutdown
!
interface FastEthernet0/1
 ip address 192.168.20.10 255.255.255.0
 no shutdown

3.路由配置:

linux1网关:192.168.10.10
linux2网关:192.168.20.10
R1:只有直连路由

4.单网卡多地址配置:

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0

vi /etc/sysconfig/network-scripts/ifcfg-eth0:0

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0:0
BOOTPROTO=none
ONBOOT=yes
HWADDR=00:0c:29:08:48:63
NETMASK=255.255.255.252
IPADDR=202.100.2.2
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

[root@ams ~]# service network restart
正在关闭接口 eth0: [确定]
关闭环回接口: [确定]
弹出环回接口: [确定]
弹出界面 eth0: [确定]
[root@ams ~]# ping 202.100.2.2
PING 202.100.2.2 (202.100.2.2) 56(84) bytes of data.
64 bytes from 202.100.2.2: icmp_seq=1 ttl=64 time=0.124 ms

--- 202.100.2.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.124/0.124/0.124/0.000 ms
[root@ams ~]# ping 192.168.10.10
PING 192.168.10.10 (192.168.10.10) 56(84) bytes of data.
64 bytes from 192.168.10.10: icmp_seq=1 ttl=255 time=70.6 ms

--- 192.168.10.10 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 70.629/70.629/70.629/0.000 ms

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/498f8bde5577ee55c544826ae631839e.html