实验拓扑
实验需求
- 按照图示配置 IP 地址
- 按照图示分区域配置 OSPF ,实现全网互通
- 为了路由结构稳定,要求路由器使用环回口作为 Router-id
实验步骤
每台路由器都要将本地的所有直连网段宣告至 OSPF 区域下
IP 地址配置
AR1 配置
[AR1-GigabitEthernet0/0/1]ip address 10.0.1.1 24
[AR1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[AR1-LoopBack0]ip address 1.1.1.1 32
AR2配置
[AR2-GigabitEthernet0/0/0]ip address 192.168.1.2 24
[AR2-GigabitEthernet0/0/1]ip address 192.168.2.1 24
[Huawei-LoopBack0]ip address 2.2.2.2 32
AR3配置
[Huawei-GigabitEthernet0/0/0]ip address 192.168.2.2 24
[Huawei-GigabitEthernet0/0/1]ip address 20.0.1.1 24
[AR3-LoopBack0]ip address 3.3.3.3 32
配置好主机 IP地址及网关
AR1配置命令
[AR1]OSPF 1 router-id 1.1.1.1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 10.0.1.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
AR2配置命令
[Huawei]ospf 1 router-id 2.2.2.2
[Huawei-ospf-1]area 0
[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]network 192.168.2.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
AR3配置命令
[AR3]ospf 1 router-id 3.3.3.3
[Huawei-ospf-1]area 0
[AR3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[AR3-ospf-1-area-0.0.0.0]network 20.0.1.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
在AR1 上查看OSPF 邻居表
[AR1]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: 192.168.1.2 Address: 192.168.1.2
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.2 BDR: 192.168.1.1 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:23:23
Authentication Sequence: [ 0 ]
AR1]dis ospf peer brief
OSPF Process 1 with Router ID 1.1.1.1
Peer Statistic Information
-----------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 192.168.1.2 Full
查看OSPF 路由表
[AR1]dis ip routing-table protocol ospf
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 OSPF 10 1 D 192.168.1.2 GigabitEthernet0/0/0
3.3.3.3/32 OSPF 10 2 D 192.168.1.2 GigabitEthernet0/0/0
20.0.1.0/24 OSPF 10 3 D 192.168.1.2 GigabitEthernet0/0/0
192.168.2.0/24 OSPF 10 2 D 192.168.1.2 GigabitEthernet0/0/0
PC1 PING PC2 查看连通性
PC>ping 20.0.1.2
Ping 20.0.1.2: 32 data bytes, Press Ctrl_C to break
From 20.0.1.2: bytes=32 seq=1 ttl=125 time=31 ms
From 20.0.1.2: bytes=32 seq=2 ttl=125 time=32 ms
From 20.0.1.2: bytes=32 seq=3 ttl=125 time=15 ms
From 20.0.1.2: bytes=32 seq=4 ttl=125 time=32 ms
From 20.0.1.2: bytes=32 seq=5 ttl=125 time=15 ms
--- 20.0.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/25/32 ms
OSPF 多区域配置,ABR 聚合等高级配置 后期更新!