华为路由器OSPF基础配置命令
1.互聯IP地址規則:如AR1和AR2互聯就是12.1.1.1和12.1.1.2以此類推。
2.環回口配置如AR1? int lo 0 1.1.1.1 32
3.Ospf的routerID跟回環口相同方便記憶。也可以是設備里面沒有的IP地址做routeid。只是一個標識。
4.宣告接口注意是只宣告自己有的接口
第一步配置接口IP和回環口地址(IP地址規則如上) ?
第二步配置ospf進程
第三步宣告ospf進程和rip進程
AR1配置回環口和接口IP
[Huawei]int LoopBack 0???????????? //進入回環口0接口(也可以是1接口)
[Huawei-LoopBack0]ip add 1.1.1.1 32? //配置IP地址
[Huawei-LoopBack0]int g0/0/0??????? //直接從回環口進入到接口0
[Huawei-GigabitEthernet0/0/0]ip add 14.1.1.1 24? //配置IP地址
[Huawei-GigabitEthernet0/0/0]int g0/0/2???????? //進入接口2
[Huawei-GigabitEthernet0/0/2]ip add 172.16.10.1 24 ?//配置IP地址(中間有交換機需要三臺AR路由器有接口在一個網段)
第二步:配置ospf
[Huawei]ospf 10 router-id 1.1.1.1??? //創建ospf10 配置router-id 為1.1.1.1
[Huawei-ospf-10]area 10?????????? //進入area 10區域
[Huawei-ospf-10-area-0.0.0.10]network 172.16.10.0 0.0.0.255?? //宣告接口網段
[Huawei-ospf-10-area-0.0.0.10]network 14.1.1.0 0.0.0.255? //宣告接口網段
[Huawei-ospf-10-area-0.0.0.10]network 1.1.1.1 0.0.0.0???? //宣告回環口網段
[Huawei-ospf-10-area-0.0.0.10]dis this????????????????? //查看area10下配置的命令
[V200R003C00]
#
?area 0.0.0.10
? network 1.1.1.1 0.0.0.0
? network 14.1.1.0 0.0.0.255
? network 172.16.10.0 0.0.0.255
AR2配置回環口和接口IP地址
[Huawei]int LoopBack 0???????????? //進入回環口0接口(也可以是1接口)
[Huawei-LoopBack0]ip add 2.2.2.2 32? //配置IP地址
[Huawei-LoopBack0]int g0/0/0??????? //直接從回環口進入到接口0
[Huawei-GigabitEthernet0/0/0]ip add 172.16.10.2 24 ?//配置IP地址(中間有交換機需要三臺AR路由器有接口在一個網段)
第二步:配置ospf
[Huawei]ospf 10 router-id 2.2.2.2??? //創建ospf10 配置router-id 為2.2.2.2
[Huawei-ospf-10]area 10?????????? //進入area 10區域
[Huawei-ospf-10-area-0.0.0.10]network 172.16.10.0 0.0.0.255?? //宣告接口網段
[Huawei-ospf-10-area-0.0.0.10]network 2.2.2.2 0.0.0.0???? //宣告回環口網段
AR3配置回環口和接口IP地址
[Huawei]int LoopBack 0???????????? //進入回環口0接口(也可以是1接口)
[Huawei-LoopBack0]ip add 3.3.3.3 32? //配置IP地址
[Huawei-LoopBack0]int g0/0/0??????? //直接從回環口進入到接口0
[Huawei-GigabitEthernet0/0/0]ip add 172.16.10.3 24 ?//配置IP地址(中間有交換機需要三臺AR路由器有接口在一個網段)
第二步:配置ospf
[Huawei]ospf 10 router-id 3.3.3.3??? //創建ospf10 配置router-id 為3.3.3.3
[Huawei-ospf-10]area 10?????????? //進入area 10區域
[Huawei-ospf-10-area-0.0.0.10]network 172.16.10.0 0.0.0.255?? //宣告接口網段
[Huawei-ospf-10-area-0.0.0.10]network 3.3.3.3 0.0.0.0???? //宣告回環口網段
AR4(屬于兩個區域0和區域10)配置回環口和接口IP地址
[Huawei]int LoopBack 0???????????? //進入回環口0接口(也可以是1接口)
[Huawei-LoopBack0]ip add 4.4.4.4 32? //配置IP地址
[Huawei-LoopBack0]int g0/0/0??????? //直接從回環口進入到接口0
[Huawei-GigabitEthernet0/0/0]ip add 14.1.1.4 24 ?//配置IP地址
[Huawei-GigabitEthernet0/0/0]int g0/0/1??????? //直接從回環口進入到接口1
[Huawei-GigabitEthernet0/0/1]ip add 46.1.1.4 24 ?//配置IP地址
[Huawei-GigabitEthernet0/0/1]int g0/0/2??????? //直接從回環口進入到接口1
[Huawei-GigabitEthernet0/0/2]ip add 45.1.1.4 24 ?//配置IP地址
第二步:配置ospf
[Huawei]ospf 10 router-id 4.4.4.4??? //創建ospf10 配置router-id 為4.4.4.4
[Huawei-ospf-10]area 10?????????? //進入area 10區域
[Huawei-ospf-10-area-0.0.0.10]network 14.1.1..0 0.0.0.255?? //宣告接口網段
[Huawei]ospf 10 router-id 4.4.4.4??? //創建ospf10 配置router-id 為3.3.3.3
[Huawei-ospf-10]area 0? ??????????//進入area 0區域
[Huawei-ospf-10-area-0.0.0.0]network 45.1.1..0 0.0.0.255?? //宣告接口網段
[Huawei-ospf-10-area-0.0.0.0]network 46.1.1..0 0.0.0.255?? //宣告接口網段
AR5(直接看配置就可以配置了如果不會就看AR4的步驟)
[Huawei-ospf-10]dis ip int br
Interface???????????????????????? IP Address/Mask????? Physical?? Protocol?
GigabitEthernet0/0/0????????????? 56.1.1.5/24????????? up???????? up???????
GigabitEthernet0/0/1????????????? 45.1.1.5/24????????? up???????? up???????
GigabitEthernet0/0/2????????????? 57.1.1.5/24????????? up???????? up???????
LoopBack0??????????????? ????????5.5.5.5/32??????? ?up??? ?????up(s)
配置opsf
[Huawei-ospf-10]dis this
[V200R003C00]
#
ospf 10 router-id 5.5.5.5
?area 0.0.0.0
? network 5.5.5.5 0.0.0.0
? network 45.1.1.0 0.0.0.255
? network 56.1.1.0 0.0.0.255
?area 0.0.0.20
? network 57.1.1.0 0.0.0.255
#
return
AR6配置
配置接口
<Huawei>dis ip int br
Interface???????????????????????? IP Address/Mask????? Physical?? Protocol?
GigabitEthernet0/0/0????????????? 46.1.1.6/24????????? up???????? up???????
GigabitEthernet0/0/1????????????? 56.1.1.6/24????????? up???????? up???????
GigabitEthernet0/0/2???? ?????????unassigned????????? down???? down?????
LoopBack0???????????????????????? 6.6.6.6/32???????? up????? up(s)????
配置ospf
[Huawei-ospf-10]dis this
[V200R003C00]
#
ospf 10 router-id 6.6.6.6
?area 0.0.0.0
? network 6.6.6.6 0.0.0.0
? network 46.1.1.0 0.0.0.255
? network 56.1.1.0 0.0.0.255
AR7配置
接口配置
<Huawei>dis ip int br
Interface???????????????????????? IP Address/Mask????? Physical?? Protocol?
GigabitEthernet0/0/0????????????? 57.1.1.7/24????????? up???????? up???????
GigabitEthernet0/0/1????????????? 78.1.1.7/24????????? up???????? up???????
GigabitEthernet0/0/2????????????? unassigned?????? ??down????? down?????
LoopBack0???????????????????????? 7.7.7.7/32?????????? up?????? up(s)
AR8(需要配置兩個協議sopf和rip)最后還需要宣告路由ospf的路由宣告到rip 。rip的路由宣告到ospf?
接口配置
[Huawei]dis ip int br
Interface???????????????????????? IP Address/Mask????? Physical?? Protocol?
GigabitEthernet0/0/0????????????? 78.1.1.8/24????????? up???????? up???????
GigabitEthernet0/0/1????????????? 89.1.1.8/24????????? up???? ????up???????
GigabitEthernet0/0/2????????????? unassigned?????????? down????? down?????
LoopBack0???????????????????????? 8.8.8.8/32?????????? up??????? up(s)?
Ospf配置(路由引入單獨配置了不在dis this命令里面)
[Huawei-ospf-10]dis this
[V200R003C00]
#
ospf 10 router-id 8.8.8.8
?area 0.0.0.20
? network 8.8.8.8 0.0.0.0
? network 78.1.1.0 0.0.0.255
rip配置
[Huawei-rip-1]dis this
[V200R003C00]
#
rip 1?????????????????? //進入RIP默認是1
?undo summary???????? //關閉自動聚合
?version 2?????????????? //選擇版本V2
?network 89.0.0.0???????? //宣告網段
?import-route ospf 10???? //
配置路由引入
[Huawei]ospf 10?????????
[Huawei-ospf-10]import-route rip ??//rip引入到ospf10里面
[Huawei-ospf-10]rip????????????? //進入rip?????????????
[Huawei-rip-1]import-route ospf 10? //ospf10引入到rip
AR9配置(只需要配置rip也不用引入配置,因為是邊界路由器)
配置接口信息
<Huawei>dis ip int br??? //查看接口IP信息
Interface???????????????????????? IP Address/Mask????? Physical?? Protocol?
GigabitEthernet0/0/0????????????? 89.1.1.9/24????????? up???????? up???????
GigabitEthernet0/0/1????????????? unassigned?????????? down?????? down?????
GigabitEthernet0/0/2????????????? unassigned?????????? down?????? down?????
LoopBack0???????????????????????? 9.9.9.9/32?????????? up???????? up(s)
配置rip
[Huawei-rip-1]dis this
[V200R003C00]
#
rip 1
?version 2
?network 89.0.0.0
?network 9.0.0.0
#
return
[Huawei]dis ip routing-table protocol rip?????? //查看路由
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
???????? Destinations : 15?????? Routes : 15??????
RIP routing table status : <Active>
???????? Destinations : 15?????? Routes : 15
Destination/Mask??? Proto?? Pre? Cost????? Flags NextHop???????? Interface
??????? 1.1.1.1/32? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
??????? 2.2.2.2/32? RIP???? 100? 1?????????? D ??89.1.1.8??????? GigabitEthernet
0/0/0
??????? 3.3.3.3/32? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
??????? 4.4.4.4/32? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
??????? 5.5.5.5/32? RIP???? 100? 1??????? ???D?? 89.1.1.8??????? GigabitEthernet
0/0/0
??????? 6.6.6.6/32? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
??????? 7.7.7.7/32? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
??????? 8.8.8.8/32? RIP???? 100? 1?? ????????D?? 89.1.1.8??????? GigabitEthernet
0/0/0
?????? 14.1.1.0/24? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
?????? 45.1.1.0/24? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
?????? 46.1.1.0/24? RIP???? 100 ?1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
?????? 56.1.1.0/24? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
?????? 57.1.1.0/24? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
?????? 78.1.1.0/24? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
??? 172.16.10.0/24? RIP???? 100? 1?????????? D?? 89.1.1.8??????? GigabitEthernet
0/0/0
RIP routing table status : <Inactive>
???????? Destinations : 0??????? Routes : 0
驗證命令
[Huawei]dis ospf peer br????????????? //查看OSPf的鄰居表
??????? ?OSPF Process 10 with Router ID 4.4.4.4
??????????????? ? Peer Statistic Information
?----------------------------------------------------------------------------
?Area Id????????? Interface??????????????????????? Neighbor id????? State???
?0.0.0.0????????? GigabitEthernet0/0/2???????????? 5.5.5.5????????? Full???????
?0.0.0.0????????? GigabitEthernet0/0/1???????????? 6.6.6.6????????? Full???????
?0.0.0.10???????? GigabitEthernet0/0/0???????????? 1.1.1.1????????? Full???????
?----------------------------------------------------------------------------
[Huawei]
<AR1>display ospf interface???????????? //查看OSPF接口宣告情況
<AR1>display ospf lsdb??????????????? //查看OSPF的鏈路狀態數據庫(拓撲表)
?
總結
以上是生活随笔為你收集整理的华为路由器OSPF基础配置命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【转】文后参考文献著录规则解析
- 下一篇: 华为ensp ospf配置