华为路由器的动态路由加上GRE隧道,R1和R4路由器通过Gre实现内部网络的通信,不通过R2和R3路由器进行通信。
一、四台路由器环回地址
R1 lo 0 1.1.1.1/32
R2 lo 0 2.2.2.2/32
R3 lo 0 3.3.3.3/32
R4 lo 0 4.4.4.4/32
二、设备互联IP:
R1路由器至R2路由器互联地址
10.1.1.1/30----10.1.1.2/30
R2路由器至R3路由器互联地址
10.1.2.1/30----10.1.2.2/30
R3路由器至R4路由器互联地址
10.1.3.1/30----10.1.3.2/30
三、四台路由器配置OSPF
R1路由器
interface GigabitEthernet0/0/0
ip address 10.1.1.1 255.255.255.252
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ospf 100 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.1.0 0.0.0.3
R2路由器
interface GigabitEthernet0/0/0
ip address 10.1.1.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 10.1.2.1 255.255.255.252
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
ospf 100 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.1.1.0 0.0.0.3
network 10.1.2.0 0.0.0.3
#
R3路由器
interface GigabitEthernet0/0/0
ip address 10.1.3.1 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 10.1.2.2 255.255.255.252
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
ospf 100 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.2.0 0.0.0.3
network 10.1.3.0 0.0.0.3
#
R4路由器
interface GigabitEthernet0/0/0
ip address 10.1.3.2 255.255.255.252
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
ospf 100 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 10.1.3.0 0.0.0.3
四、R1与R4运行GRE隧道,使R1与R4内部网络通信
R 1 路由器配置tunnel隧道
interface Tunnel0/0/1
description GRE-TO-R4
ip address 192.168.1.1 255.255.255.252
tunnel-protocol gre
keepalive
source 10.1.1.1
destination 10.1.3.2
R4路由器配置tunnel隧道
interface Tunnel0/0/1
description GRE-TO-R1
ip address 192.168.1.2 255.255.255.252
tunnel-protocol gre
keepalive
source 10.1.3.2
destination 10.1.1.1