您的当前位置:首页正文

锐捷ospf配置案例

2023-01-13 来源:钮旅网
一、组网需求

配置OSPF动态路由协议,让全网可以互通

二、组网拓扑

三、配置要点

1、根据规划,在设备接口上配置IP地址

2、配置OSPF进程

3、所有区域(area)必须与区域 0(area 0)相连接

四、配置步骤 注意:

配置之前建议使用 Ruijie#show ip interface brief 查看接口名称,

常用接口名称有FastEthernet(百兆)、GigabitEthernet(千兆)和TenGigabitEthernet(万兆)等等,以下配置以百兆接口为例。

步骤一:配置接口IP

路由器R1:

Ruijie>enable ------>进入特权模式

Ruijie#configure terminal ------>进入全局配置模式

Ruijie(config)#interface fastethernet 0/0

Ruijie(config-if-FastEthernet 0/0)#ip address 192.168.1.1255.255.255.0------>配置接口IP

Ruijie(config-if-FastEthernet 0/0)#interface fastethernet 0/1

Ruijie(config-if-FastEthernet 0/1)#ip address 192.168.2.1 255.255.255.0

Ruijie(config-if-FastEthernet 0/1)#interface loopback 0 ------>配置回环口IP,作为OSPF的router-id

Ruijie(config-if-Loopback 0)#ip address 10.0.0.1 255.255.255.0

Ruijie(config-if-Loopback 0)#exit

路由器R2:

Ruijie>enable

Ruijie#configure terminal

Ruijie(config)#interface fastethernet 0/0

Ruijie(config-if-FastEthernet 0/0)#ip address 192.168.2.2 255.255.255.0

Ruijie(config-if-FastEthernet 0/0)#interface fastethernet 0/1

Ruijie(config-if-FastEthernet 0/1)#ip address 192.168.3.2 255.255.255.0

Ruijie(config-if-FastEthernet 0/1)#interface loopback 0

Ruijie(config-if-Loopback 0)#ip address 10.0.0.2 255.255.255.0

Ruijie(config-if-Loopback 0)#exit

路由器R3:

Ruijie>enable

Ruijie#configure terminal

Ruijie(config)#interface fastethernet 0/0

Ruijie(config-if-FastEthernet 0/0)#ip address 192.168.4.1 255.255.255.0

Ruijie(config-if-FastEthernet 0/0)#interface fastethernet 0/1

Ruijie(config-if-FastEthernet 0/1)#ip address 192.168.3.1 255.255.255.0

Ruijie(config-if-FastEthernet 0/1)#interface loopback 0

Ruijie(config-if-Loopback 0)#ip address 10.0.0.3 255.255.255.0

Ruijie(config-if-Loopback 0)#exit

步骤二:配置OSPF

路由器R1:

Ruijie(config)#router ospf 100 ------>配置OSPF,进程号是100

Ruijie(config-router)#router-id 10.0.0.1 ------>手工指定OSPF的router-id

Ruijie(config-router)#network 192.168.1.0 255.255.255.0 area 1 ------>地址属于192.168.1.0/24的接口划入OSPF区域 1,参与OSPF的运做

Ruijie(config-router)#network 192.168.2.0 255.255.255.0 area 0 ------>地址属于192.168.2.0/24的接口划入OSPF区域 0,参与OSPF的运做

Ruijie(config-router)#exit

路由器R2:

Ruijie(config)#router ospf 100

Ruijie(config-router)#router-id 10.0.0.2

Ruijie(config-router)#network 192.168.2.0 255.255.255.0 area 0

Ruijie(config-router)#network 192.168.3.0 255.255.255.0 area 0

Ruijie(config-router)#exit

路由器R3:

Ruijie(config)#router ospf 100

Ruijie(config-router)#router-id 10.0.0.3

Ruijie(config-router)#network 192.168.3.0 255.255.255.0 area 0

Ruijie(config-router)#network 192.168.4.0 255.255.255.0 area 2

Ruijie(config-router)#exit

步骤三、保存配置

Ruijie(config-router)#end ----->退出到特权模式

Ruijie#write -----> 确认配置正确,保存配置

五、验证命令:

在路由器R2上查看相关的信息:

Ruijie#show ip route ----->查看所有的路由表,包括OSPF,静态路由和直连路由等

Codes: C - connected, S - static, R - RIP, B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

ia - IS-IS inter area, * - candidate default

Gateway of last resort is no set

C 10.0.0.0/24 is directly connected, Loopback 0

C 10.0.0.2/32 is local host.

O IA 192.168.1.1/32 [110/1] via 192.168.2.1, 00:04:17, FastEthernet 0/0 ----->O IA表示来自其他区域的OSPF路由条目

C 192.168.2.0/24 is directly connected, FastEthernet 0/0

C 192.168.2.2/32 is local host.

C 192.168.3.0/24 is directly connected, FastEthernet 0/1

C 192.168.3.2/32 is local host.

O IA 192.168.4.1/32 [110/1] via 192.168.3.1, 00:03:56, FastEthernet 0/1

Ruijie#show ip route ospf 100 ----->查看从OSPF进程100学到的OSPF路由条目

O IA 192.168.1.1/32 [110/1] via 192.168.2.1, 00:04:30, FastEthernet 0/0

O IA 192.168.4.1/32 [110/1] via 192.168.3.1, 00:04:09, FastEthernet 0/1

Ruijie#show ip ospf neighbor ----->查看OSPF邻居,以太网环境下正常的状态应该是Full

OSPF process 100, 2 Neighbors, 2 is Full:

Neighbor ID Pri State BFD State Dead Time Address Interface

192.168.1.1 1 Full/DR 192.168.2.1 FastEthernet 0/0

192.168.4.1 1 Full/DR 192.168.3.1 FastEthernet 0/1

- - 00:00:39 00:00:37

因篇幅问题不能全部显示,请点此查看更多更全内容