华为OSPF配置

#拓扑结构

华为OSPF配置_第1张图片



#R1


system-view 
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 10.1.12.1 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int LoopBack 0
[Huawei-LoopBack0]ip add 1.1.1.1 
[Huawei-LoopBack0]q
[Huawei]ospf 1 router-id 1.1.1.1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 10.1.12.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0


#R2


system-view 
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 10.1.12.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 10.1.23.1 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int LoopBack 0
[Huawei-LoopBack0]ip add 2.2.2.2 32
[Huawei-LoopBack0]q
[Huawei]ospf 1 router-id 2.2.2.2
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 10.1.12.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]network 10.1.23.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.1]network 2.2.2.2 0.0.0.0
[Huawei-ospf-1-area-0.0.0.1]vlink-peer 3.3.3.3


#R3


system-view 
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 10.1.23.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 10.1.34.1 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int LoopBack 0
[Huawei-LoopBack0]ip add 3.3.3.3 32
[Huawei]ospf 1 router-id 3.3.3.3
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]network 10.1.23.0 0.0.0.255
[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]q
[Huawei-ospf-1]area 2
[Huawei-ospf-1-area-0.0.0.2]network 10.1.34.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.2]q
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2




#R4
system-view 
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 10.1.34.2 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int LoopBack 0
[Huawei-LoopBack0]ip add 4.4.4.4 32
[Huawei]ospf 1 router-id 4.4.4.4
[Huawei-ospf-1]area 2
[Huawei-ospf-1-area-0.0.0.2]network 10.1.34.2 0.0.0.255
[Huawei-ospf-1-area-0.0.0.2]network 4.4.4.4 0.0.0.0


验证:

R1  ping  R2

华为OSPF配置_第2张图片

查看路由表

华为OSPF配置_第3张图片


如需引入外部路由在边缘路由执行:

[Huawei-ospf-1]default-route-advertise always (路由的注入)






你可能感兴趣的:(网络)