华为OSPF基本配置
OSFP协议路由角色分为: IR 内部路由 即所有接口都在同一区域内 ABR区域边界路由 连接不同区域之间的路由 ASBR自治系统边界路由 即连接OSPF协议及其它轮协议间路由 DR 指定路由 BDR备份指定路由 DRother其它/非指定路由 区域一般分为两个层级: AREA0 骨干区域 AREA大于0数值非骨干区域
基本配置为:R1 <Huawei>system-view [Huawei]sysnamer1 [r1]interfaceGigabitEthernet 0/0/0 [r1-GigabitEthernet0/0/0]ipaddress 192.168.12.1 24 [r1-GigabitEthernet0/0/0]quit [r1]routerid 1.1.1.1 [r1]interfaceloopback 0 [r1-LoopBack0]ipaddress 1.1.1.1 24 [r1-LoopBack0]quit [r1]ospf1 //打开OSPF协议 进程为1 [r1-ospf-1]area1 //创建非骨干区域 1 [r1-ospf-1-area-0.0.0.1]authentication-modemd5 1 cipher admin1234 //配置认证模式及密码 [r1-ospf-1-area-0.0.0.1]network1.1.1.1 0.0.0.0 //宣告参考网络 注意通配符 [r1-ospf-1-area-0.0.0.1]network192.168.12.0 0.0.0.255 [r1-ospf-1-area-0.0.0.1]quit [r1-ospf-1]quit [r1]displayospf brief
R2 <Huawei>system-view [Huawei]sysnamer2 [r2]interfaceGigabitEthernet 0/0/0 [r2-GigabitEthernet0/0/0]ipaddress 192.168.12.2 24 [r2-GigabitEthernet0/0/0]quit [r2]interfaceGigabitEthernet 0/0/1 [r2-GigabitEthernet0/0/1]ipaddress 192.168.23.2 24 [r2-GigabitEthernet0/0/1]quit [r2]routerid 2.2.2.2 [r2]interfaceloopback 0 [r2-LoopBack0]ipaddress 2.2.2.2 32 [r2-LoopBack0]quit [r2]ospf1 [r2-ospf-1]area1 [r2-ospf-1-area-0.0.0.1]authentication-modemd5 1 cipher admin1234 [r2-ospf-1-area-0.0.0.1]network2.2.2.2 0.0.0.0 [r2-ospf-1-area-0.0.0.1]network192.168.12.0 0.0.0.255 [r2-ospf-1-area-0.0.0.1]quit [r2-ospf-1]area0 [r2-ospf-1-area-0.0.0.0]authentication-modemd5 1 cipher admin1234 [r2-ospf-1-area-0.0.0.0]network192.168.23.0 0.0.0.255 [r2-ospf-1-area-0.0.0.0]return
R3 <Huawei>system-view [Huawei]sysnamer3 [r3]interfaceGigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]ipaddress 192.168.23.3 24 [r3-GigabitEthernet0/0/0]quit [r3]interfaceGigabitEthernet 0/0/1 [r3-GigabitEthernet0/0/1]ipaddress 192.168.34.3 24 [r3-GigabitEthernet0/0/1]quit [r3]routerid 3.3.3.3 [r3]interfaceloopback 0 [r3-LoopBack0]ipaddress 3.3.3.3 32 [r3-LoopBack0]quit [r3]ospf1 [r3-ospf-1]area0 [r3-ospf-1-area-0.0.0.0]authentication-modemd5 1 cipher admin1234 [r3-ospf-1-area-0.0.0.0]network192.168.23.0 0.0.0.255 [r3-ospf-1-area-0.0.0.0]quit [r3-ospf-1]area2 [r3-ospf-1-area-0.0.0.2]authentication-modemd5 1 cipher admin1234 [r3-ospf-1-area-0.0.0.2]network3.3.3.3 0.0.0.0 [r3-ospf-1-area-0.0.0.2]network192.168.34.0 0.0.0.255 [r3-ospf-1-area-0.0.0.2]return
R4 <Huawei>system-view [Huawei]sysnamer4 [r4]interfaceGigabitEthernet 0/0/0 [r4-GigabitEthernet0/0/0]ipaddress 192.168.34.4 24 [r4-GigabitEthernet0/0/0]quit [r4]routerid 4.4.4.4 [r4]interfaceloopback 0 [r4-LoopBack0]ipaddress 4.4.4.4 32 [r4-LoopBack0]quit [r4]ospf1 [r4-ospf-1]area2 [r4-ospf-1-area-0.0.0.2]authentication-modemd5 1 cipher admin1234 [r4-ospf-1-area-0.0.0.2]network4.4.4.4 0.0.0.0 [r4-ospf-1-area-0.0.0.2]network192.168.34.0 0.0.0.255 [r4-ospf-1-area-0.0.0.2]return
检验 [r1]displayip routing-table //显示IP路由表 结果显示R1中已经学习到了所有OSFP自治区域中的网段。其它省略。 检验R2的OSPF邻居状态: [r2]displayospf peer
邻居为R3和R1 再显示OSPF的链路状态数据库(LSDB)信息 [r1]display ospf lsdb
最后Ping测试各路由连通状态: [r1]ping2.2.2.2 PING2.2.2.2: 56 data bytes, press CTRL_C tobreak Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=50 ms Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=20 ms Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=20 ms Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=30 ms ---2.2.2.2 ping statistics --- 5packet(s) transmitted 5packet(s) received 0.00% packet loss round-trip min/avg/max = 20/28/50 ms [r1]ping3.3.3.3 PING3.3.3.3: 56 data bytes, press CTRL_C tobreak Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=254 time=50 ms Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=254 time=30 ms Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=254 time=30 ms Replyfrom 3.3.3.3: bytes=56 Sequence=4 ttl=254 time=40 ms Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=254 time=20 ms ---3.3.3.3 ping statistics --- 5packet(s) transmitted 5packet(s) received 0.00% packet loss round-trip min/avg/max = 20/34/50 ms [r1]ping4.4.4.4 PING4.4.4.4: 56 data bytes, press CTRL_C tobreak Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=253 time=60 ms Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=253 time=40 ms Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=253 time=50 ms Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=253 time=40 ms Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=253 time=30 ms ---4.4.4.4 ping statistics --- 5packet(s) transmitted 5packet(s) received 0.00% packet loss round-trip min/avg/max = 30/44/60 ms |