实验目的:
配置OSPF,实现动态学习路由
实验环境:
R1-R4均使用AR2220
实验过程:
规划拓扑图
![](https://i-blog.csdnimg.cn/blog_migrate/9f14de9ce9b2afa3ee391d2daa3031c8.png)
规划IP地址
AR1:
GigabitEthernet0/0/0 10.1.10.1/24
LoopBack0 10.1.1.1/32
AR2:
GigabitEthernet0/0/0 10.1.10.2/24
GigabitEthernet0/0/1 10.1.20.2/24
LoopBack0 10.1.2.2/32
AR3:
GigabitEthernet0/0/0 10.1.10.3/24
LoopBack0 10.1.3.3/32
R4:
GigabitEthernet0/0/0 10.1.20.4/24
LoopBack0 10.1.4.4/32
配置IP地址
[AR1]interface GigabitEthernet0/0/0
[AR1-GigabitEthernet0/0/0] ip address 10.1.10.1 255.255.255.0
[AR1-GigabitEthernet0/0/0]interface LoopBack0
[AR1-LoopBack0] ip address 10.1.1.1 255.255.255.255
[AR2]interface GigabitEthernet0/0/0
[AR2-GigabitEthernet0/0/0] ip address 10.1.10.2 255.255.255.0
[AR2-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1
[AR2-GigabitEthernet0/0/1] ip address 10.1.20.2 255.255.255.0
[AR2-LoopBack0] ip address 10.1.2.2 255.255.255.255
[AR3]interface GigabitEthernet0/0/0
[AR3-GigabitEthernet0/0/0] ip address 10.1.10.3 255.255.255.0
[AR3-GigabitEthernet0/0/0]interface LoopBack0
[AR3-LoopBack0] ip address 10.1.3.3 255.255.255.255
[AR4]interface GigabitEthernet0/0/0
[AR4-GigabitEthernet0/0/0] ip address 10.1.20.4 255.255.255.0
[AR4-GigabitEthernet0/0/0]interface LoopBack0
[AR4-LoopBack0] ip address 10.1.4.4 255.255.255.255
配置OSPF进程
[AR1]ospf 1 router-id 10.1.1.1
#配置router-id
[AR1-ospf-1]import-route direct
#引入直连路由
[AR1-ospf-1]area 0.0.0.0
#进入area 0
[AR1-ospf-1-area-0.0.0.0] network 10.1.10.0 0.0.0.255
#宣告路由
[AR2]ospf 1 router-id 10.1.2.2
[AR2-ospf-1]import-route direct
[AR2-ospf-1]area 0.0.0.0
[AR2-ospf-1-area-0.0.0.0] network 10.1.10.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]area 0.0.0.1
[AR2-ospf-1-area-0.0.0.1] network 10.1.20.0 0.0.0.255
[AR3]ospf 1 router-id 10.1.3.3
[AR3-ospf-1]import-route direct
[AR3-ospf-1]area 0.0.0.0
[AR3-ospf-1-area-0.0.0.0] network 10.1.10.0 0.0.0.255
[AR4]ospf 1 router-id 10.1.4.4
[AR4-ospf-1]import-route direct
[AR4-ospf-1]area 0.0.0.1
[AR4-ospf-1-area-0.0.0.1] network 10.1.20.0 0.0.0.255
PING测试
[AR4]ping 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=254 time=80 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=254 time=60 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=254 time=50 ms
Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=254 time=60 ms
--- 10.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/60/80 ms