需求
1.整个网络IP地址为192.168.1.0/24
2.area 0 区域手工设置R1为DR、R2为BDR
3.R3---R5之间使用密文认证方式
4.R1、R2、R5上配置环回接口,但是R5环回接口不能宣告进ospf
5.全网可达
配置
配置ip
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.161 27
[r1-GigabitEthernet0/0/0]
May 13 2023 19:58:02-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]q
[r1]int l 0
[r1-LoopBack0]ip add 192.168.1.1 32
[r1-LoopBack0]q
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.162 27
May 13 2023 19:59:35-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]q
[r2]int l 0
[r2-LoopBack0]ip add 192.168.1.33 32
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.163 27
May 13 2023 20:01:59-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]q
[r3]int l 0
[r3-LoopBack0]q
[r3]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.129 27
May 13 2023 20:03:00-08:00 r3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.130 27
May 13 2023 20:04:14-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]q
[r4]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.97 27
May 13 2023 20:05:02-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.98 27
May 13 2023 20:06:24-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]q
[r5]int l 0
[r5-LoopBack0]ip add 192.168.1.65 32
手工设置R1为DR、R2为BDR
[r1-GigabitEthernet0/0/0]ospf dr-priority 10
[r2-GigabitEthernet0/0/0]ospf dr-priority 9
ospf配置
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.161 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.162 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.33 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.163 0.0.0.0
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 192.168.1.129 0.0.0.0
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]network 192.168.1.130 0.0.0.0
[r4-ospf-1-area-0.0.0.1]network 192.168.1.97 0.0.0.0
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]network 192.168.1.98 0.0.0.0
[r5-ospf-1-area-0.0.0.1]network 192.168.1.65 0.0.0.0
R3---R5之间使用密文认证
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r4-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456
[r5-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
R5环回接口不能宣告进ospf
[r5-ospf-1]default-route-advertise always
检测
[r1]ping -a 192.168.1.1 192.168.1.98
PING 192.168.1.98: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.98: bytes=56 Sequence=1 ttl=253 time=80 ms
Reply from 192.168.1.98: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 192.168.1.98: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 192.168.1.98: bytes=56 Sequence=4 ttl=253 time=40 ms
Reply from 192.168.1.98: bytes=56 Sequence=5 ttl=253 time=30 ms
--- 192.168.1.98 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/46/80 ms
[r1]ping -a 192.168.1.1 192.168.1.97\
Error: Unknown host 192.168.1.97\.
[r1]ping -a 192.168.1.1 192.168.1.97
PING 192.168.1.97: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.97: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 192.168.1.97: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 192.168.1.97: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 192.168.1.97: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 192.168.1.97: bytes=56 Sequence=5 ttl=254 time=40 ms
--- 192.168.1.97 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/42/50 ms
[r1]ping -a 192.168.1.1 192.168.1.129
PING 192.168.1.129: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.129: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 192.168.1.129: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 192.168.1.129: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 192.168.1.129: bytes=56 Sequence=4 ttl=255 time=50 ms
Reply from 192.168.1.129: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 192.168.1.129 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/44/50 ms