OSPF实验
实验报告
一,拓扑信息
二,实验要求及分析
要求:
1,整个网络IP地址为192.168.1.0/24,自己规划
2,Area 0区域手工设置R1为DR、R2为BDR
3,R3–R5之间使用密文认证方式
4,R1、R2、R5上配置环回接口,但是R5的环回接口不能宣告进OSPF
5,全网可达
分析:
根据实验要求可知,在实验之前要先划分子网,及将192.168.1.0/24划分成五个网段和三个环回,然后分别将划分出的网段进行配置;再根据实验对各个路由器进行操作。
三,子网划分
将192.168.1.0/24划分成五个网段和三个环回接口:
192.168.1.0/24划分子网
192.168.1.000 00000/27----192.168.1.0/27
192.168.1.001 00000/27----192.168.1.32/27---r3到r4
192.168.1.010 00000/27----192.168.1.64/27---r4到r5
192.168.1.011 00000/27----192.168.1.96/27---r1的环回
192.168.1.100 00000/27----192.168.1.128/27---r2的环回
192.168.1.101 00000/27----192.168.1.160/27---r5的环回
192.168.1.110 00000/27----192.168.1.192/27
192.168.1.111 00000/27----192.168.1.224/27
四,IP配置
r1
进入0/0/0接口并配置IP:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 27
Mar 27 2023 12:57:56-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]q
创建接口并配置IP:
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.97 27
测试直连:
[r1]ping 192.168.1.3-------r1到r3
PING 192.168.1.3: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.3: bytes=56 Sequence=1 ttl=255 time=290 ms
Reply from 192.168.1.3: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.1.3: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 192.168.1.3: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.1.3: bytes=56 Sequence=5 ttl=255 time=60 ms
--- 192.168.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/94/290 ms
[r1]ping 192.168.1.2--------r1到r2
PING 192.168.1.2: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.2: bytes=56 Sequence=1 ttl=255 time=170 ms
Reply from 192.168.1.2: bytes=56 Sequence=2 ttl=255 time=50 ms
Reply from 192.168.1.2: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 192.168.1.2: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 192.168.1.2: bytes=56 Sequence=5 ttl=255 time=50 ms
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/72/170 ms
r2
进入0/0/0接口并配置IP:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 27
Mar 27 2023 12:58:34-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]q
创建接口并配置IP:
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.1.129 27
测试直连:
[r2]ping 192.168.1.1-----------r2到r1
PING 192.168.1.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=60 ms
Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=70 ms
Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/54/70 ms
[r2]ping 192.168.1.3-------------r2到r3
PING 192.168.1.3: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.3: bytes=56 Sequence=1 ttl=255 time=80 ms
Reply from 192.168.1.3: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 192.168.1.3: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.1.3: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.1.3: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 192.168.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/42/80 ms
r3
进入0/0/0接口并配置IP:
[r3-GigabitEthernet0/0/0]ip add 192.168.1.3 27
Mar 27 2023 12:59:12-08:00 r3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]q
进入0/0/1接口并配置IP:
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.33 27
Mar 27 2023 12:59:47-08:00 r3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]
测试直连:
[r3]ping 192.168.1.1------------r3到r1
PING 192.168.1.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=50 ms
Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=60 ms
Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=50 ms
Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/52/60 ms
[r3]ping 192.168.1.2------------r3到r2
PING 192.168.1.2: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.2: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 192.168.1.2: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.1.2: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 192.168.1.2: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 192.168.1.2: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/44/50 ms
[r3]ping 192.168.1.34------------r3到r4
PING 192.168.1.34: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.34: bytes=56 Sequence=1 ttl=255 time=140 ms
Reply from 192.168.1.34: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.34: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.1.34: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.1.34: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.34 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/46/140 ms
r4
进入0/0/0接口并配置IP:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.34 27
Mar 27 2023 13:00:12-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]q
进入0/0/1接口并配置IP:
[r4]interface GigabitEthernet 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.65 27
Mar 27 2023 13:00:26-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]
测试直连:
[r4]ping 192.168.1.33---------------r4到r3
PING 192.168.1.33: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.33: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 192.168.1.33: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.33: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.1.33: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.1.33: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.33 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/22/30 ms
[r4]ping 192.168.1.66--------------r4到r5
PING 192.168.1.66: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.66: bytes=56 Sequence=1 ttl=255 time=110 ms
Reply from 192.168.1.66: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.66: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.1.66: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.1.66: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.66 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/40/110 ms
r5
进入0/0/0接口并配置IP:
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.66 27
Mar 27 2023 13:00:50-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]q
创建接口并配置IP:
[r5]interface LoopBack 0
[r5-LoopBack0]ip add 192.168.1.161 27
[r5-LoopBack0]q
测试直连:
[r5]ping 192.168.1.65--------------r5到r4
PING 192.168.1.65: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.65: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 192.168.1.65: bytes=56 Sequence=2 ttl=255 time=10 ms
Reply from 192.168.1.65: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 192.168.1.65: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.1.65: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.65 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/22/40 ms
五,配置OSPF协议
r1
启动OSPF协议:
[r1]ospf 1 router-id 1.1.1.1
进入区域0:
[r1-ospf-1]area 0
宣告网段:
[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]network 192.168.1.1 0.0.0.0
修改优先级:
[r1-GigabitEthernet0/0/0]ospf dr-priority 10
查看邻居表:
[r1-ospf-1-area-0.0.0.0]dis ospf peer
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.1.1(GigabitEthernet0/0/0)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.1.2
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:06:30
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:04:11
Authentication Sequence: [ 0 ]
r2
启动OSPF协议:
[r2]ospf 1 router-id 2.2.2.2
进入区域0:
[r2-ospf-1]area 0
宣告网段:
[r2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.1.2 0.0.0.0
修改优先级:
[r2-GigabitEthernet0/0/0]ospf dr-priority 9
查看邻居表:
[r2-ospf-1-area-0.0.0.0]dis ospf p
OSPF Process 1 with Router ID 2.2.2.2
Neighbors
Area 0.0.0.0 interface 192.168.1.2(GigabitEthernet0/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 40 sec
Retrans timer interval: 0
Neighbor is up for 00:07:52
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 28 sec
Retrans timer interval: 5
Neighbor is up for 00:05:37
Authentication Sequence: [ 0 ]
r3
启动OSPF协议:
[r3]ospf 1 router-id 3.3.3.3
进入区域0:
[r3-ospf-1]area 0
宣告网段:
[r3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]q
启动OSPF协议:
[r3]ospf 1 router-id 3.3.3.3
进入区域1:
[r3-ospf-1]area 1
宣告网段:
[r3-ospf-1-area-0.0.0.1]network 192.168.1.33 0.0.0.0
查看邻居表:
[r3-ospf-1-area-0.0.0.0]dis ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.1.3(GigabitEthernet0/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 36 sec
Retrans timer interval: 0
Neighbor is up for 00:10:31
Authentication Sequence: [ 0 ]
Router ID: 2.2.2.2 Address: 192.168.1.2
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 40 sec
Retrans timer interval: 5
Neighbor is up for 00:10:35
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.1.33(GigabitEthernet0/0/1)'s neighbors
Router ID: 4.4.4.4 Address: 192.168.1.34
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.34 BDR: 192.168.1.33 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:09:12
Authentication Sequence: [ 0 ]
密文认证:
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456
r4
启动OSPF协议:
[r4]ospf 1 router-id 4.4.4.4
进入区域1:
[r4-ospf-1]area 1
宣告网段:
[r4-ospf-1-area-0.0.0.1]network 192.168.1.34 0.0.0.0
[r4-ospf-1-area-0.0.0.1]network 192.168.1.65 0.0.0.0
查看邻居表:
[r4-ospf-1-area-0.0.0.1]dis ospf peer
OSPF Process 1 with Router ID 4.4.4.4
Neighbors
Area 0.0.0.1 interface 192.168.1.34(GigabitEthernet0/0/0)'s neighbors
Router ID: 3.3.3.3 Address: 192.168.1.33
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.34 BDR: 192.168.1.33 MTU: 0
Dead timer due in 34 sec
Retrans timer interval: 5
Neighbor is up for 00:10:05
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.1.65(GigabitEthernet0/0/1)'s neighbors
Router ID: 5.5.5.5 Address: 192.168.1.66
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.65 BDR: 192.168.1.66 MTU: 0
Dead timer due in 28 sec
Retrans timer interval: 5
Neighbor is up for 00:09:41
Authentication Sequence: [ 0 ]
密文认证:
[r4]int g0/0/0----进入接口0/0/0
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r4-GigabitEthernet0/0/0]int g0/0/1---进入接口0/0/1
[r4-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456
r5
启动OSPF协议:
[r5]ospf 1 router-id 5.5.5.5
进入区域1:
[r5-ospf-1]area 1
宣告网段:
[r5-ospf-1-area-0.0.0.1]network 192.168.1.66 0.0.0.0
查看邻居表:
[r5-ospf-1-area-0.0.0.1]dis ospf peer
OSPF Process 1 with Router ID 5.5.5.5
Neighbors
Area 0.0.0.1 interface 192.168.1.66(GigabitEthernet0/0/0)'s neighbors
Router ID: 4.4.4.4 Address: 192.168.1.65
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.65 BDR: 192.168.1.66 MTU: 0
Dead timer due in 33 sec
Retrans timer interval: 5
Neighbor is up for 00:10:14
Authentication Sequence: [ 0 ]
发放缺省:
[r5-ospf-1]default-route-advertise always
密文认证:
[r5-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
六,测试
r1
r2
r3
r4
r5