原图如下
绘图
实验拓扑
实验需求
按照图示分区域配置ospf
配置虚连接认证
实验步骤
- 配置相应接口ip地址及loopback 环回口地址
按照图示分区域配置ospf
ar1
[huawei]ospf router-id 1.1.1.1
[huawei-ospf-1]area 0
[huawei-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[huawei-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255
ar2
[huawei]ospf router-id 2.2.2.2
[huawei-ospf-1]area 0
[huawei-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[huawei-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255
[huawei-ospf-1]area 1
[huawei-ospf-1-area-0.0.0.1]network 30.1.1.0 0.0.0.255
ar3
[huawei]ospf router-id 3.3.3.3
[huawei-ospf-1]area 1
[huawei-ospf-1-area-0.0.0.1]network 3.3.3.3 0.0.0.0
[huawei-ospf-1-area-0.0.0.1]network 30.1.1.0 0.0.0.255
[huawei-ospf-1]area 2
[huawei-ospf-1-area-0.0.0.1]network 40.1.1.0 0.0.0.255
ar4
[huawei]ospf router-id 4.4.4.4
[huawei-ospf-1]area 2
[huawei-ospf-1-area-0.0.0.1]network 4.4.4.4 0.0.0.0
[huawei-ospf-1-area-0.0.0.1]network 40.1.1.0 0.0.0.255
ar1 ping ar3 测试连通性
[huawei]ping 3.3.3.3
ping 3.3.3.3: 56 data bytes, press ctrl_c to break
reply from 3.3.3.3: bytes=56 sequence=1 ttl=254 time=20 ms
reply from 3.3.3.3: bytes=56 sequence=2 ttl=254 time=20 ms
reply from 3.3.3.3: bytes=56 sequence=3 ttl=254 time=30 ms
reply from 3.3.3.3: bytes=56 sequence=4 ttl=254 time=40 ms
reply from 3.3.3.3: bytes=56 sequence=5 ttl=254 time=40 ms
--- 3.3.3.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/30/40 ms
配置虚连接
ospf非骨干区域必须和骨干区域相连才能通信,为了不改变网络拓扑,我们可以实现虚连接来扩大区域0的面积,实现区域互通。
ar2
[huawei-ospf-1-area-0.0.0.1]vlink-peer 3.3.3.3
ar3
[huawei-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2
在ar3上查看虚连接
建成邻居后 是p2p的一个链路
[huawei]dis ospf vlink
ospf process 1 with router id 3.3.3.3
virtual links
virtual-link neighbor-id -> 2.2.2.2, neighbor-state: full
interface: 30.1.1.2 (gigabitethernet0/0/0)
cost: 1 state: p-2-p type: virtual
transit area: 0.0.0.1
timers: hello 10 , dead 40 , retransmit 5 , transmit delay 1
gr state: normal
ar1 ping ar4
[huawei]ping 4.4.4.4
ping 4.4.4.4: 56 data bytes, press ctrl_c to break
reply from 4.4.4.4: bytes=56 sequence=1 ttl=253 time=40 ms
reply from 4.4.4.4: bytes=56 sequence=2 ttl=253 time=40 ms
reply from 4.4.4.4: bytes=56 sequence=3 ttl=253 time=30 ms
reply from 4.4.4.4: bytes=56 sequence=4 ttl=253 time=30 ms
reply from 4.4.4.4: bytes=56 sequence=5 ttl=253 time=30 ms
--- 4.4.4.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/34/40 ms
虚连接上做认证
ar2
[huawei-ospf-1-area-0.0.0.1]vlink-peer 3.3.3.3 simple cipher 123
ar3
[huawei-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2 simple cipher 123
测试连通性,ar4 ping ar1
ping 1.1.1.1
ping 1.1.1.1: 56 data bytes, press ctrl_c to break
reply from 1.1.1.1: bytes=56 sequence=1 ttl=253 time=40 ms
reply from 1.1.1.1: bytes=56 sequence=2 ttl=253 time=30 ms
reply from 1.1.1.1: bytes=56 sequence=3 ttl=253 time=40 ms
reply from 1.1.1.1: bytes=56 sequence=4 ttl=253 time=30 ms
reply from 1.1.1.1: bytes=56 sequence=5 ttl=253 time=50 ms
--- 1.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/38/50 ms