华为OSPF多区域简单配置
在ospf中固定了所有非area 0区域必须与area 0区域直连,否则无法工作。所以当有非area0区域没有与area0区域直连时,就需要使用虚链路让区域与area0区域在逻辑上直连。
骨干区域与非骨干区域。
#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 32
[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
#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
#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
现在我们在R2和R3做虚链路:
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]vlink-peer 3.3.3.3
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2
验证:
查看路由表
如需引入外部路由在边缘路由执行:
[Huawei-ospf-1]default-route-advertise always (路由的注入)