实验要求及拓扑图如下:
一、配置 IP 地址
拓扑图如下:
R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 21.0.0.1 24
[R1]int l0
[R1-LoopBack0]ip add 192.168.1.1 24
R2 ( ISP )
[ISP]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[ISP-GigabitEthernet0/0/0]int g 0/0/1
[ISP-GigabitEthernet0/0/1]ip add 21.0.0.2 24
[ISP-GigabitEthernet0/0/1]int g 0/0/2
[ISP-GigabitEthernet0/0/2]ip add 23.0.0.2 24
[ISP-GigabitEthernet0/0/2]int g 4/0/0
[ISP-GigabitEthernet4/0/0]ip add 24.0.0.2 24
[ISP-GigabitEthernet4/0/0]int g 4/0/1
[ISP-GigabitEthernet4/0/1]ip add 25.0.0.2 24
[ISP-GigabitEthernet4/0/1]int g 4/0/2
[ISP-GigabitEthernet4/0/2]ip add 26.0.0.2 24
R3
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 23.0.0.1 24
[R3-GigabitEthernet0/0/0]int l0
[R3-LoopBack0]ip add 192.168.3.1 24
R4
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 24.0.0.1 24
[R4-GigabitEthernet0/0/0]int l0
[R4-LoopBack0]ip add 192.168.4.1 24
R5
[R5]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip add 25.0.0.1 24
[R5-GigabitEthernet0/0/0]int l0
[R5-LoopBack0]ip add 192.168.5.1 24
R6
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip add 26.0.0.1 24
[R6-GigabitEthernet0/0/0]int l0
[R6-LoopBack0]ip add 192.168.6.1 24
配置缺省路由
R1
[R1]ip rou
[R1]ip route
[R1]ip route-static 0.0.0.0 0 12.0.0.2
[R1]ip route-static 0.0.0.0 0 21.0.0.2
R3
[R3]ip rou
[R3]ip route
[R3]ip route-static 0.0.0.0 0 23.0.0.2
R4
[R4]ip rou
[R4]ip route
[R4]ip route-static 0.0.0.0 0 24.0.0.2
R5
[R5]ip rou
[R5]ip route
[R5]ip route-static 0.0.0.0 0 25.0.0.2
R6
[R6]ip rou
[R6]ip route
[R6]ip route-static 0.0.0.0 0 26.0.0.2
二、配置MGRE环境
R1
[R1]int t 0/0/0
[R1-Tunnel0/0/0]ip add 192.168.10.1 24
[R1-Tunnel0/0/0]tun
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]sour
[R1-Tunnel0/0/0]source 21.0.0.1
[R1-Tunnel0/0/0]nhrp net
[R1-Tunnel0/0/0]nhrp network-id 100
[R1-Tunnel0/0/0]nhrp en
[R1-Tunnel0/0/0]nhrp entry 192.168.10.3 23.0.0.1 reg
[R1-Tunnel0/0/0]nhrp entry 192.168.10.3 23.0.0.1 register
[R1-Tunnel0/0/0]nhrp entry 192.168.10.4 24.0.0.1 register
R3
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ip add 192.168.10.3 24
[R3-Tunnel0/0/0]tun
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]sou
[R3-Tunnel0/0/0]source 23.0.0.1
[R3-Tunnel0/0/0]nhrp net
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp ent
[R3-Tunnel0/0/0]nhrp entry 192.168.10.1 21.0.0.1
[R3-Tunnel0/0/0]nhrp entry 192.168.10.1 21.0.0.1 re
[R3-Tunnel0/0/0]nhrp entry 192.168.10.1 21.0.0.1 register
[R3-Tunnel0/0/0]nhrp entry 192.168.10.4 24.0.0.1 register
R4
[R4]int t 0/0/0
[R4-Tunnel0/0/0]ip add 192.168.10.4 24
[R4-Tunnel0/0/0]tun
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp
[R4-Tunnel0/0/0]sou
[R4-Tunnel0/0/0]source 24.0.0.1
[R4-Tunnel0/0/0]nhrp net
[R4-Tunnel0/0/0]nhrp network-id 100
[R4-Tunnel0/0/0]nhrp ent
[R4-Tunnel0/0/0]nhrp entry 192.168.10.1 21.0.0.1 re
[R4-Tunnel0/0/0]nhrp entry 192.168.10.1 21.0.0.1 register
三、启动 OSPF 协议并进行优化
R1
[R1]ospf 1 r
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]net
[R1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[R1]int t 0/0/0
[R1-Tunnel0/0/0]nhrp ent
[R1-Tunnel0/0/0]nhrp entry mul
[R1-Tunnel0/0/0]nhrp entry multicast dyn
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
[R1]int t 0/0/0
[R1-Tunnel0/0/0]ospf ne
[R1-Tunnel0/0/0]ospf network-type bro
[R1-Tunnel0/0/0]ospf network-type broadcast
R3
[R3]ospf 1 r
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]net
[R3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[R3]int t 0/0/0
[R3-Tunnel0/0/0]nhrp ent
[R3-Tunnel0/0/0]nhrp entry mul
[R3-Tunnel0/0/0]nhrp entry multicast dy
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ospf net
[R3-Tunnel0/0/0]ospf network-type bro
[R3-Tunnel0/0/0]ospf network-type broadcast
R4
[R4]ospf 1 r
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]net
[R4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[R4]int t 0/0/0
[R4-Tunnel0/0/0]nhrp en
[R4-Tunnel0/0/0]nhrp entry mul
[R4-Tunnel0/0/0]nhrp entry multicast dy
[R4-Tunnel0/0/0]nhrp entry multicast dynamic
[R4]int t 0/0/0
[R4-Tunnel0/0/0]ospf net
[R4-Tunnel0/0/0]ospf network-type bro
[R4-Tunnel0/0/0]ospf network-type broadcast
# 以上为 R1 ( GE 0/0/0 ) 与 R3、R4 间的配置
R1
[R1]int t 0/0/1
[R1-Tunnel0/0/1]ip add 192.168.100.1 24
[R1-Tunnel0/0/1]tun
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp
[R1-Tunnel0/0/1]sou
[R1-Tunnel0/0/1]source 12.0.0.1
[R1-Tunnel0/0/1]nhrp net
[R1-Tunnel0/0/1]nhrp network-id 200
[R1-Tunnel0/0/1]nhrp ent
[R1-Tunnel0/0/1]nhrp entry mul
[R1-Tunnel0/0/1]nhrp entry multicast dyn
[R1-Tunnel0/0/1]nhrp entry multicast dynamic
[R1-Tunnel0/0/1]ospf net
[R1-Tunnel0/0/1]ospf network-type p2mp
[R1]ospf
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net
[R1-ospf-1-area-0.0.0.0]network 192.168.100.0 0.0.0.255
R5
[R5]int t 0/0/0
[R5-Tunnel0/0/0]ip add 192.168.100.5 24
[R5-Tunnel0/0/0]tun
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]sou
[R5-Tunnel0/0/0]source 25.0.0.1
[R5-Tunnel0/0/0]nhrp net
[R5-Tunnel0/0/0]nhrp network-id 200
[R5-Tunnel0/0/0]nhrp ent
[R5-Tunnel0/0/0]nhrp entry 192.168.100.1 12.0.0.1 re
[R5-Tunnel0/0/0]nhrp entry 192.168.100.1 12.0.0.1 register
[R5-Tunnel0/0/0]ospf net
[R5-Tunnel0/0/0]ospf network-type p2mp
[R5]ospf
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]net
[R5-ospf-1-area-0.0.0.0]network 192.168.100.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
R6
[R6]int t 0/0/0
[R6-Tunnel0/0/0]ip add 192.168.100.6 24
[R6-Tunnel0/0/0]tun
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]sou
[R6-Tunnel0/0/0]source 26.0.0.1
[R6-Tunnel0/0/0]nhrp net
[R6-Tunnel0/0/0]nhrp network-id 200
[R6-Tunnel0/0/0]nhrp ent
[R6-Tunnel0/0/0]nhrp entry 192.168.100.1 12.0.0.1 re
[R6-Tunnel0/0/0]nhrp entry 192.168.100.1 12.0.0.1 register
[R6-Tunnel0/0/0]ospf net
[R6-Tunnel0/0/0]ospf network-type p2mp
[R6]ospf 1 rou
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]net
[R6-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 192.168.100.0 0.0.0.255
# 以上为 R1 ( GE 0/0/1 ) 与 R5、R6 间的配置