OSPF综合实验
今天给大家带来的是OSPF综合实验,OSPF的理论一旦掌握好,实验其实就非常简单了,那么下面大家就打开Ensp模拟器开启实验之旅吧!
实验拓扑
实验需求
- 按照图示配置好IP地址,PC1网关指向为R8
- OSPF划分为4个区域,其中192.168.0.0/24,192.168.1.0/24,192.168.2.0/24属于AREA 0,192.168.10.0/24属于AREA1,192.168.4.0/24,100.0.0.0/24属于AREA2,192.168.5.0,100.1.1.0/24属于AREA3
- 为了防止链路中断引起的骨干区域隔离,在R3和R4上配置虚连接
- 在R5上配置到达172.16.0.0/24和172.16.1.0/24网段的静态路由,并引入到OSPF内部
- 在R7和R8上配置默认路由,下一跳指向R5和R6
- 在ASBR上对172.16.0.0/24和172.16.1.0/24网段进行准确的路由聚合
- 在R3和R4上分别对AREA 0的网段进行路由聚合
- 将AREA3配置为NSSA区域
- 在R6上配置到达100.2.2.0/24网段的静态路由,并引入到AREA3
- 在AREA0配置区域认证,密码为123456
实验步骤
1. 配置相应接口IP地址及loopback 环回口地址
2. 按照图示分区域配置OSPF
AR1
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
AR2
[Huawei]ospf
[Huawei-ospf-1]area
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net
[Huawei-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]ar
[Huawei-ospf-1-area-0.0.0.0]arp-ping
[Huawei-ospf-1-area-0.0.0.0]area
[Huawei-ospf-1-area-0.0.0.0]area
[Huawei-ospf-1-area-0.0.0.0]area 3
[Huawei-ospf-1-area-0.0.0.3]net
[Huawei-ospf-1-area-0.0.0.3]network 192.168.5.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.3]area 1
[Huawei-ospf-1-area-0.0.0.1]net
[Huawei-ospf-1-area-0.0.0.1]network 192.168.10.0 0.0.0.255
AR3
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net
[Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]area 1
[Huawei-ospf-1-area-0.0.0.1]network 192.168.10.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.1]area 2
[Huawei-ospf-1-area-0.0.0.2]net
[Huawei-ospf-1-area-0.0.0.2]network 192.168.4.0 0.0.0.255
AR4
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]net
[Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
AR5
[Huawei]ospf
[Huawei-ospf-1]ar
[Huawei-ospf-1]area 2
[Huawei-ospf-1-area-0.0.0.2]net
[Huawei-ospf-1-area-0.0.0.2]network 192.168.4.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.2]network 100.0.0.0 0.0.0.255
AR6
[Huawei]ospf
[Huawei-ospf-1]ar
[Huawei-ospf-1]area 3
[Huawei-ospf-1-area-0.0.0.3]net
[Huawei-ospf-1-area-0.0.0.3]network 192.168.5.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.3]net
[Huawei-ospf-1-area-0.0.0.3]network 100.1.1.0 0.0.0.255
3. 在R3和R4上配置虚连接
AR3
[Huawei-ospf-1-area-0.0.0.1]vlink-peer 192.168.10.2
AR4
[Huawei-ospf-1-area-0.0.0.1]vlink-peer 192.168.1.1
4. 静态路由,并引入到OSPF内部
AR5
[Huawei]IP route-static 172.16.0.1 24 100.0.0.1
[Huawei]IP route-static 172.16.1.1 24 100.0.0.1
[Huawei-ospf-1]import-route static
在AR3上查看OSPF 路由表
[Huawei]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 7 Routes : 7
OSPF routing table status : <Active>
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.0.0.0/24 OSPF 10 2 D 192.168.4.1 GigabitEthernet
0/0/2
100.1.1.0/24 OSPF 10 3 D 192.168.10.2 GigabitEthernet
0/0/1
172.16.0.0/24 O_ASE 150 1 D 192.168.4.1 GigabitEthernet
0/0/2
172.16.1.0/24 O_ASE 150 1 D 192.168.4.1 GigabitEthernet
0/0/2
192.168.0.0/24 OSPF 10 2 D 192.168.1.2 GigabitEthernet
0/0/0
192.168.2.0/24 OSPF 10 2 D 192.168.10.2 GigabitEthernet
0/0/1
192.168.5.0/24 OSPF 10 2 D 192.168.10.2 GigabitEthernet
0/0/1
5. 在R7和R8上配置默认路由,下一跳指向R5和R6
AR7
[Huawei]ip route-static 192.168.4.0 24 100.0.0.2
AR8
[Huawei]ip route-static 192.168.5.0 24 100.1.1.1
6. 在ASBR上对172.16.0.0/24和172.16.1.0/24网段进行准确的路由聚合
[Huawei-ospf-1]asbr-summary 172.16.0.0 255.255.254.0
在AR7上PING 测试连通性
[Huawei]ping 192.168.4.1
PING 192.168.4.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.4.1: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 192.168.4.1: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.4.1: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 192.168.4.1: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 192.168.4.1: bytes=56 Sequence=5 ttl=255 time=10 ms
--- 192.168.4.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/26/40 ms
在AR8上测试连通性
[Huawei]ping 192.168.5.1
PING 192.168.5.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.5.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 192.168.5.1: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 192.168.5.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/30 ms
7. 在R3和R4上分别对AREA 0的网段进行路由聚合
AR3
abr-summary 192.168.0.0 255.255.252.0
AR4
abr-summary 192.168.0.0 255.255.252.0
查看OSPF 路由表,发现已经聚合
[Huawei]DIS IP routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 5 Routes : 5
OSPF routing table status : <Active>
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.0.0.0/24 OSPF 10 4 D 192.168.5.1 GigabitEthernet
0/0/1
172.16.0.0/23 O_ASE 150 2 D 192.168.5.1 GigabitEthernet
0/0/1
192.168.0.0/22 OSPF 10 3 D 192.168.5.1 GigabitEthernet
0/0/1
192.168.4.0/24 OSPF 10 3 D 192.168.5.1 GigabitEthernet
0/0/1
192.168.10.0/24 OSPF 10 2 D 192.168.5.1 GigabitEthernet
0/0/1
8. 将AREA3配置为NSSA区域
AR4
[Huawei]ospf
[Huawei-ospf-1]area 3
[Huawei-ospf-1-area-0.0.0.3]nssa
AR6
[Huawei]ospf
[Huawei-ospf-1]area 3
[Huawei-ospf-1-area-0.0.0.3]nssa
9. 在R6上配置到达100.2.2.0/24网段的静态路由,并引入到AREA3
AR6
[Huawei]ip route-static 100.2.2.0 24 100.1.1.2
[Huawei-ospf-1]import-route static
10. 在AREA0配置区域认证,密码为123456
AR1
[Huawei-ospf-1-area-0.0.0.0]authentication-mode simple cipher 123456
AR2
[Huawei-ospf-1-area-0.0.0.0]authentication-mode simple cipher 123456
AR3
[Huawei-ospf-1-area-0.0.0.0]authentication-mode simple cipher 123456
AR4
[Huawei-ospf-1-area-0.0.0.0]authentication-mode simple cipher 123456