实验要求:
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
5、减少LSA的更新量,加快收敛,保障更新安全;
6、全网可达;
拓扑图及网段划分如图:
实验步骤:
1.按要求配置IP地址
1.配置各接口ip
R1
[Huawei]sysname R1
[R1]int G0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.33.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 172.16.34.1 24
[R1-LoopBack0]q
[R1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.33.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.34.1/24 up up(s)
NULL0 unassigned up up(s)
R2
[Huawei]sysname R2
[R2]int G0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.33.2 24
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip add 172.16.35.2 24
[R2-LoopBack0]q
[R2]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.33.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.35.2/24 up up(s)
NULL0 unassigned up up(s)
R3
[Huawei]sysname R3
[R3]int G0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 24[R3]int s 4/0/0
[R3-Serial4/0/0]ip add 34.0.0.3 24
[R3-Serial4/0/0]int l0
[R3-LoopBack0]ip add 172.16.36.3 24
[R3-LoopBack0]q
[R3]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 5
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 5Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.33.3/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.36.3/24 up up(s)
NULL0 unassigned up up(s)
Serial3/0/0 unassigned down down
Serial3/0/1 unassigned down down
Serial4/0/0 34.0.0.3/24 up up
Serial4/0/1 unassigned down down
R4
[Huawei]sysname R4
[R4]int s 4/0/0
[R4-Serial4/0/0]ip add 34.0.0.4 24
[R4-Serial4/0/0]int s 4/0/1
[R4-Serial4/0/1]ip add 45.0.0.4 24
[R4-Serial4/0/1]int s 3/0/0
[R4-Serial3/0/0]ip add 46.0.0.4 24
[R4-Serial3/0/0]int G0/0/0
[R4-GigabitEthernet0/0/0]ip add 47.0.0.4 24
[R4-GigabitEthernet0/0/0]int l0
[R4-LoopBack0]ip add 172.16.2.4 24
[R4-LoopBack0]q
[R4]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 3Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 47.0.0.4/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.2.4/24 up up(s)
NULL0 unassigned up up(s)
Serial3/0/0 46.0.0.4/24 up up
Serial3/0/1 unassigned down down
Serial4/0/0 34.0.0.4/24 up up
Serial4/0/1 45.0.0.4/24 up up
R5
[Huawei]sysname R5
[R5]int s 4/0/0
[R5-Serial4/0/0]ip add 45.0.0.5 24
[R5-Serial4/0/0]int l0
[R5-LoopBack0]ip add 172.16.3.5 24
[R5-LoopBack0]q
[R5]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 6
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 6Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.3.5/24 up up(s)
NULL0 unassigned up up(s)
Serial3/0/0 unassigned down down
Serial3/0/1 unassigned down down
Serial4/0/0 45.0.0.5/24 up up
Serial4/0/1 unassigned down down
R6
[Huawei]sysname R6
[R6]int s 4/0/0
[R6-Serial4/0/0]ip add 46.0.0.6 24
[R6-Serial4/0/0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.65.1 30
[R6-GigabitEthernet0/0/0]int l0
[R6-LoopBack0]ip add 172.16.4.6 24
[R6-LoopBack0]q
[R6]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 5
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 5Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.65.1/30 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.4.6/24 up up(s)
NULL0 unassigned up up(s)
Serial3/0/0 unassigned down down
Serial3/0/1 unassigned down down
Serial4/0/0 46.0.0.6/24 up up
Serial4/0/1 unassigned down down
R7
[Huawei]sysname R7
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[R7-GigabitEthernet0/0/0]int g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.96.1 30
[R7-GigabitEthernet0/0/1]int l0
[R7-LoopBack0]ip add 172.16.5.7 24
[R7-LoopBack0]q
[R7]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 47.0.0.7/24 up up
GigabitEthernet0/0/1 172.16.96.1/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.5.7/24 up up(s)
NULL0 unassigned up up(s)
R8
[Huawei]sysname R8
[R8]int G0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.97.2 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.97.5 30
[R8-GigabitEthernet0/0/1]int l0
[R8-LoopBack0]ip add 172.16.98.8 24
[R8-LoopBack0]q
[R8]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.97.2/30 up up
GigabitEthernet0/0/1 172.16.97.5/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.98.8/24 up up(s)
NULL0 unassigned up up(s)
R9
[Huawei]sysname R9
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.97.6 30
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.129.1 30
[R9-GigabitEthernet0/0/1]int l0
[R9-LoopBack0]ip add 172.16.130.9 24
[R9-LoopBack0]q
[R9]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.97.6/30 up up
GigabitEthernet0/0/1 172.16.129.1/30 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.130.9/24 up up(s)
NULL0 unassigned up up(s)
R10
[Huawei]sysname R10
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 30
[R10-GigabitEthernet0/0/0]int l0
[R10-LoopBack0]ip add 172.16.131.10 24
[R10-LoopBack0]q
[R10]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.129.2/30 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.131.10/24 up up(s)
NULL0 unassigned up up(s)
R11
[Huawei]sysname R11
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.65.2 30
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.65.5 30
[R11]int l0
[R11-LoopBack0]ip add 172.16.66.11 24
[R11-LoopBack0]q
[R11]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.65.2/30 up up
GigabitEthernet0/0/1 unassigned up down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.66.11/24 up up(s)
NULL0 unassigned up up(s)
R12
[Huawei]sysname R12
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.65.6 30
[R12-GigabitEthernet0/0/0]int l0
[R12-LoopBack0]ip add 172.16.160.12 24
[R12-LoopBack0]int l1
[R12-LoopBack1]ip add 172.16.161.12 24
[R12-LoopBack1]q
[R12]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 2Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.65.6/30 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 172.16.160.12/24 up up(s)
LoopBack1 172.16.161.12/24 up up(s)
NULL0 unassigned up up(s)
2.配置ospf协议,实现私网通,在每个区域内进行网段或者接口宣告,建立邻居关系
区域1:
R1
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]net 172.16.34.0 0.0.0.255
查看邻居是否能完全建立
[R1]dis ospf peer b
OSPF Process 1 with Router ID 1.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.1 GigabitEthernet0/0/0 2.2.2.2 Full
0.0.0.1 GigabitEthernet0/0/0 3.3.3.3 Full
----------------------------------------------------------------------------建立完成,则不需要在其他路由进行查看
R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]net 172.16.35.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]q
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]net 172.16.36.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
区域0:
R5
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]net 172.16.3.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]q
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]net 172.16.4.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]q
R7
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]net 172.16.5.0 0.0.0.255
区域2:
R6
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]net 172.16.65.1 0.0.0.0
R11
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]net 172.16.65.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]net 172.16.65.5 0.0.0.0
[R11-ospf-1-area-0.0.0.2]net 172.16.66.0 0.0.0.255
R12
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]net 172.16.65.6 0.0.0.0
[R12-ospf-1-area-0.0.0.2]q域外使用rip协议
[R12-ospf-1]rip 1
[R12-rip-1]v 2 版本号
[R12-rip-1]undo s
[R12-rip-1]undo summary 关闭路由自动汇总
[R12-rip-1]net 172.16.0.0路由引入:
[R12]ospf 1
[R12-ospf-1]im
[R12-ospf-1]import-route rip
[R12-ospf-1]q
区域3:
R7
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]net 172.16.97.1 0.0.0.0
R8
[R8]ospf 1 r
[R8]ospf 1 router-id 8.8.8.8
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]net 172.16.97.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]net 172.16.97.5 0.0.0.0
[R8-ospf-1-area-0.0.0.3]net 172.16.98.0 0.0.0.255
区域4 (不规则区域)
使用多进程双向重分布
R9
[R9]ospf 2 r
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]net 172.16.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]net 172.1.130.0 0.0.0.255
R10
[R10]ospf 2 r
[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]net 172.16.129.2 0.0.0.0
[R10-ospf-2-area-0.0.0.4]net 172.16.131.0 0.0.0.255
路由引入
[R9-ospf-2]q
[R9]ospf 1
[R9-ospf-1]im
[R9-ospf-1]import-route ospf 2
[R9-ospf-1]q
[R9]ospf 2
[R9-ospf-2]im
[R9-ospf-2]import-route ospf 1
3.配置公网通(在内外网进出路由器上配置静态缺省)
R3
[R3]ip route-static 0.0.0.0 0 34.0.0.4
R5
[R5]ip route-static 0.0.0.0 0 45.0.0.4
R6
[R6]ip route-static 0.0.0.0 0 46.0.0.4
R7
[R7]ip route-static 0.0.0.0 0 47.0.0.4
测试是否实现公网通
[R3]ping 47.0.0.7
PING 47.0.0.7: 56 data bytes, press CTRL_C to break
Request time out
Reply from 47.0.0.7: bytes=56 Sequence=2 ttl=254 time=100 ms
Reply from 47.0.0.7: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 47.0.0.7: bytes=56 Sequence=4 ttl=254 time=50 ms
Reply from 47.0.0.7: bytes=56 Sequence=5 ttl=254 time=30 ms--- 47.0.0.7 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/50/100 ms
[R3]ping 46.0.0.6
PING 46.0.0.6: 56 data bytes, press CTRL_C to break
Reply from 46.0.0.6: bytes=56 Sequence=1 ttl=254 time=60 ms
Reply from 46.0.0.6: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 46.0.0.6: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 46.0.0.6: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 46.0.0.6: bytes=56 Sequence=5 ttl=254 time=30 ms--- 46.0.0.6 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/38/60 ms
[R3]ping 45.0.0.5
PING 45.0.0.5: 56 data bytes, press CTRL_C to break
Reply from 45.0.0.5: bytes=56 Sequence=1 ttl=254 time=70 ms
Reply from 45.0.0.5: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 45.0.0.5: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 45.0.0.5: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 45.0.0.5: bytes=56 Sequence=5 ttl=254 time=30 ms--- 45.0.0.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/40/70 ms
测试成功!!
2.创建MGRE VPN 隧道
建立隧道
R3
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 172.16.6.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source s
[R3-Tunnel0/0/0]source Serial 4/0/0
Apr 18 2024 18:57:14-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R3-Tunnel0/0/0]nhrp network-id 100 创建nhrp域 以R3为中心站点
[R3-Tunnel0/0/0]nhrp en
[R3-Tunnel0/0/0]nhrp entry m
[R3-Tunnel0/0/0]nhrp entry multicast d
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
R5
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip add 172.16.6.5 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source Serial 4/0/0
Apr 18 2024 19:02:58-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register 找中心站点进行注册
R6
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ip add 172.16.6.6 24[R6-Tunnel0/0/0]tunnel-protocol gre p
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source s
[R6-Tunnel0/0/0]source Serial 4/0/0
Apr 18 2024 19:07:46-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
R7
[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ip add 172.16.6.7 24
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source g0/0/0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
查看中心站点R3接受信息
[R3]dis nhrp peer all
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
172.16.6.5 32 45.0.0.5 172.16.6.5 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:08:59
Expire time : 01:51:01
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
172.16.6.6 32 46.0.0.6 172.16.6.6 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:04:57
Expire time : 01:55:03
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
172.16.6.7 32 47.0.0.7 172.16.6.7 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:01:00
Expire time : 01:59:00Number of nhrp peers: 3
对隧道网段进行宣告
R3:
[R3]ospf 1
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
R5:
[R5]ospf 1
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
R6:
[R6]ospf 1
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
R7:
[R7]ospf 1
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
此时其他area 0的路由之间不能完全建立邻居关系。因为我们在设置隧道口类型时,设置的是p2p 型,但是area 0 中有的路由器是broadcast 广播型,所以不能够建立邻居。所以需要将公网中的ospf的网络类型更改为broadcast型
R3
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast
R5
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcastR6
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcastR7
[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
更改完成发现还是不能完全建立邻居关系,这是因为选举DR 和 BDR出现混乱
配置只允许中心站点R具有选举权利,让它成为DR:
R5:
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf d
[R5-Tunnel0/0/0]ospf dr-priority 0R6:
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ospf d
[R6-Tunnel0/0/0]ospf dr-priority 0[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ospf d
[R7-Tunnel0/0/0]ospf dr-priority 0
查看中间路由邻居建立情况
R3
[R3]dis ospf peer b
OSPF Process 1 with Router ID 3.3.3.3
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Tunnel0/0/0 5.5.5.5 Full
0.0.0.0 Tunnel0/0/0 6.6.6.6 Full
0.0.0.0 Tunnel0/0/0 7.7.7.7 Full
0.0.0.1 GigabitEthernet0/0/0 1.1.1.1 Full
0.0.0.1 GigabitEthernet0/0/0 2.2.2.2 Full
----------------------------------------------------------------------------
R6
[R6]dis ospf peer b
OSPF Process 1 with Router ID 6.6.6.6
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Tunnel0/0/0 3.3.3.3 Full
0.0.0.2 GigabitEthernet0/0/0 11.11.11.11 Full
----------------------------------------------------------------------------
R7
[R7]dis ospf peer b
OSPF Process 1 with Router ID 7.7.7.7
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Tunnel0/0/0 3.3.3.3 Full
----------------------------------------------------------------------------
R11
[R11]dis ospf peer b
OSPF Process 1 with Router ID 11.11.11.11
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.2 GigabitEthernet0/0/0 6.6.6.6 Full
0.0.0.2 GigabitEthernet0/0/1 12.12.12.12 Full
----------------------------------------------------------------------------
R9
[R9]dis ospf peer b
OSPF Process 1 with Router ID 9.9.9.9
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.3 GigabitEthernet0/0/0 8.8.8.8 Full
----------------------------------------------------------------------------OSPF Process 2 with Router ID 9.9.9.9
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.4 GigabitEthernet0/0/1 10.10.10.10 Full
--------------------------------------------------------------------------
查看路由表详细信息
[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 28 Routes : 28Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 34.0.0.4 Serial4/0/0
34.0.0.0/24 Direct 0 0 D 34.0.0.3 Serial4/0/0
34.0.0.3/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
34.0.0.4/32 Direct 0 0 D 34.0.0.4 Serial4/0/0
34.0.0.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
172.16.3.5/32 OSPF 10 1562 D 172.16.6.5 Tunnel0/0/0
172.16.4.6/32 OSPF 10 1562 D 172.16.6.6 Tunnel0/0/0
172.16.5.7/32 OSPF 10 1562 D 172.16.6.7 Tunnel0/0/0
172.16.6.0/24 Direct 0 0 D 172.16.6.3 Tunnel0/0/0
172.16.6.3/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
172.16.6.255/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
172.16.33.0/24 Direct 0 0 D 172.16.33.3 GigabitEthernet
0/0/0
172.16.33.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
172.16.33.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
172.16.34.1/32 OSPF 10 1 D 172.16.33.1 GigabitEthernet
0/0/0
172.16.35.2/32 OSPF 10 1 D 172.16.33.2 GigabitEthernet
0/0/0
172.16.36.0/24 Direct 0 0 D 172.16.36.3 LoopBack0
172.16.36.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
172.16.36.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
172.16.65.0/30 OSPF 10 1563 D 172.16.6.6 Tunnel0/0/0
172.16.65.4/30 OSPF 10 1564 D 172.16.6.6 Tunnel0/0/0
172.16.66.11/32 OSPF 10 1563 D 172.16.6.6 Tunnel0/0/0
172.16.160.0/24 O_ASE 150 1 D 172.16.6.6 Tunnel0/0/0
172.16.161.0/24 O_ASE 150 1 D 172.16.6.6 Tunnel0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
测试是否全网通
[R12]ping 172.16.33.1
PING 172.16.33.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.33.1: bytes=56 Sequence=1 ttl=252 time=180 ms
Reply from 172.16.33.1: bytes=56 Sequence=2 ttl=252 time=70 ms
Reply from 172.16.33.1: bytes=56 Sequence=3 ttl=252 time=70 ms
Reply from 172.16.33.1: bytes=56 Sequence=4 ttl=252 time=90 ms
Reply from 172.16.33.1: bytes=56 Sequence=5 ttl=252 time=90 ms--- 172.16.33.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 70/100/180 ms[R12]ping 172.16.3.5
PING 172.16.3.5: 56 data bytes, press CTRL_C to break
Reply from 172.16.3.5: bytes=56 Sequence=1 ttl=252 time=60 ms
Reply from 172.16.3.5: bytes=56 Sequence=2 ttl=253 time=60 ms
Reply from 172.16.3.5: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 172.16.3.5: bytes=56 Sequence=4 ttl=253 time=40 ms
Reply from 172.16.3.5: bytes=56 Sequence=5 ttl=253 time=40 ms--- 172.16.3.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/48/60 ms
测试通过!
3.配置easy ip
R3:
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000R5:
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R5-acl-basic-2000]q[R5]int Serial 4/0/0
[R5-Serial4/0/0]nat outbound 2000
R6:
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q[R6]int Serial 4/0/0
[R6-Serial4/0/0]nat outbound 2000
R7:
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]q[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
4.减少LSA的更新量
1.配置ospf特殊区域
totally stub区域
area 1
R1:
[R1]ospf 1
[R1-ospf-1]a 1[R1-ospf-1-area-0.0.0.1]stub no-summary
R2:
[R2]ospf 1
[R2-ospf-1]a 1[R2-ospf-1-area-0.0.0.1]stub no-summary
R3:
[R3]ospf 1
[R3-ospf-1]a 1[R3-ospf-1-area-0.0.0.1]stub no-summary
totally NSSA区域
area 2
R6:
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
R11:
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa no-summary
R12:
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa no-summary
area 3:
R7:
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
R8:
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa no-summary
R9:
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa no-summary
查看一下ospf的路由信息是否精简,是否下发默认缺省:
[R1]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 3 Routes : 3OSPF routing table status : <Active>
Destinations : 3 Routes : 3Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 OSPF 10 2 D 172.16.33.3 GigabitEthernet
0/0/0
172.16.35.2/32 OSPF 10 1 D 172.16.33.2 GigabitEthernet
0/0/0
172.16.36.3/32 OSPF 10 1 D 172.16.33.3 GigabitEthernet
0/0/0OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[R1]dis ospf lsdb
OSPF Process 1 with Router ID 1.1.1.1
Link State DatabaseArea: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 791 48 80000006 1
Router 1.1.1.1 1.1.1.1 790 48 80000008 1
Router 3.3.3.3 3.3.3.3 790 48 80000004 1
Network 172.16.33.1 1.1.1.1 790 36 80000004 0
Sum-Net 0.0.0.0 3.3.3.3 798 28 80000001 1
可以看出已经被精简,且下发了一条缺省。
在area 3成为otally NSSA区域后area 4被当作域外而无法默认下发缺省路由,需要向area 4的设备手动下发一条缺省路由。
[R9]ospf 2
[R9-ospf-2]default-route-advertise
进行测试
使用多个路由去pingR4的环回
[R1]ping 172.16.2.4
PING 172.16.2.4: 56 data bytes, press CTRL_C to break
Reply from 172.16.2.4: bytes=56 Sequence=1 ttl=254 time=110 ms
Reply from 172.16.2.4: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 172.16.2.4: bytes=56 Sequence=3 ttl=254 time=50 ms
Reply from 172.16.2.4: bytes=56 Sequence=4 ttl=254 time=50 ms
Reply from 172.16.2.4: bytes=56 Sequence=5 ttl=254 time=60 ms--- 172.16.2.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/64/110 ms[R12]ping 172.16.2.4
PING 172.16.2.4: 56 data bytes, press CTRL_C to break
Reply from 172.16.2.4: bytes=56 Sequence=1 ttl=253 time=60 ms
Reply from 172.16.2.4: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 172.16.2.4: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 172.16.2.4: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 172.16.2.4: bytes=56 Sequence=5 ttl=253 time=30 ms--- 172.16.2.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/40/60 ms<R11>ping 172.16.2.4
PING 172.16.2.4: 56 data bytes, press CTRL_C to break
Reply from 172.16.2.4: bytes=56 Sequence=1 ttl=254 time=60 ms
Reply from 172.16.2.4: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 172.16.2.4: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 172.16.2.4: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 172.16.2.4: bytes=56 Sequence=5 ttl=254 time=40 ms--- 172.16.2.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/34/60 ms
测试成功!!
5.加快收敛;
修改hello时间或是修改death时间,
若两个接口hello时间不同,将不能建立邻接关系。
修改hello时间为5秒。达到加快收敛的作用。
配置命令如下:
ospf timer hello 5
6.保证更新安全
使用ospf区域验证
区域验证模式:在区域下配置一致的密码才能加入同一个区域
area 0
R3:
[R3]ospf 1
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123
R5:
[R5]ospf 1
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123
R6:
[R6]ospf 1
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123
R7:
[R7]ospf 1
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123
area 1
R1:
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123
R2:
[R2]ospf
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123
R3:
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123
area 2
R6:
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123
R11:
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123
R12:
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123
area 3
R7:
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123
R8:
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123
R9:
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123
area 4
R9:
[R9]ospf 2
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123
R10:
[R10]ospf 2
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123
测试
[R1]ping 172.16.2.4
PING 172.16.2.4: 56 data bytes, press CTRL_C to break
Reply from 172.16.2.4: bytes=56 Sequence=1 ttl=254 time=110 ms
Reply from 172.16.2.4: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 172.16.2.4: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 172.16.2.4: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 172.16.2.4: bytes=56 Sequence=5 ttl=254 time=60 ms--- 172.16.2.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/58/110 ms[R1]ping 34.0.0.3
PING 34.0.0.3: 56 data bytes, press CTRL_C to break
Reply from 34.0.0.3: bytes=56 Sequence=1 ttl=255 time=70 ms
Reply from 34.0.0.3: bytes=56 Sequence=2 ttl=255 time=70 ms
Reply from 34.0.0.3: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 34.0.0.3: bytes=56 Sequence=4 ttl=255 time=50 ms
Reply from 34.0.0.3: bytes=56 Sequence=5 ttl=255 time=70 ms--- 34.0.0.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/62/70 ms
测试通过实验配置完成!!