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的链路状态数据库(拓扑表)