AI赋能,重塑校园服务新范式,锐捷AI校园百事通应用发布会
预约直播
产品
< 返回主菜单
产品中心
产品

交换机

交换机所有产品
< 返回产品
交换机主页
交换机

无线

无线所有产品
< 返回产品
无线主页
无线

云桌面

云桌面产品方案中心
< 返回产品
云桌面主页
云桌面

安全

安全所有产品
< 返回产品
安全主页
安全

RSR路由器如何配置OSPF

发布时间:2023-03-29
点击量:745

功能介绍:    

OSPF(Open Shortest Path First)为 IETF OSPF 工作组开发的一种基于链路状态的内部网关路由协议。OSPF 是专为 IP 开发的路由协议,直接运行在 IP 层上面,协议号为 89,采用组播方式进行 OSPF 包交换,组播地址为 224.0.0.5 (全部 OSPF 设备)和 224.0.0.6(指定设备)。当 OSPF 路由域规模较大时,一般采用分层结构,即将 OSPF 路由域分割成几个区域(AREA),区域之间通过一个骨干区域互联,每个非骨干区域都需要直接与骨干区域连接。       

   

应用场景:

企业的网络规模比较大,在10台路由器以上,为了实现整个网络可以互相通信,共享资料,那么可以在整个网络里面的所有路由器上启用OSPF协议。    

   

一、组网需求    

全网路由器运行ospf协议,使全网路由可达。

   

二、组网拓扑    

    

三、配置要点    

1、全网基本ip地址配置

2、全网路由启用ospf,并把对应的接口通告到指定的区域

3(可选)调整以太网接口的ospf网络类型

   

四、配置步骤    

1、全网基本ip地址配置

Ruijie(config)#hostname R1

R1(config)#interface gigabitEthernet 0/0

R1(config-GigabitEthernet 0/0)#ip address 192.168.1.1 255.255.255.0

R1(config-GigabitEthernet 0/0)#exit

R1(config)#interface gigabitEthernet 0/1

R1(config-GigabitEthernet 0/1)#ip address 10.1.1.1 255.255.255.0

R1(config-GigabitEthernet 0/1)#exit

R1(config)#interface loopback 0        //配置loopback 0接口的地址做为ospf 的router-id    

R1(config-Loopback 0)#ip address 1.1.1.1 255.255.255.255     

R1(config-Loopback 0)#exit

   

Ruijie(config)#hostname R2

R2(config)#interface fastEthernet 0/0

R2(config-if-FastEthernet 0/0)#ip address 192.168.1.2 255.255.255.0

R2(config-if-FastEthernet 0/0)#exit

R2(config)#interface fastEthernet 0/1

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

R2(config-if-FastEthernet 0/1)#exit

R2(config)#interface loopback 0

R2(config-if-Loopback 0)#ip address 2.2.2.2 255.255.255.255

R2(config-if-Loopback 0)#exit

   

Ruijie(config)#hostname R3

R3(config)#interface fastEthernet 0/0

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

R3(config-if-FastEthernet 0/0)#exit

R3(config)#interface fastEthernet 0/1

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

R3(config-if-FastEthernet 0/1)#exit

R3(config)#interface loopback 0

R3(config-if-Loopback 0)#ip address 3.3.3.3 255.255.255.255

R3(config-if-Loopback 0)#exit

   

Ruijie(config)#hostname R4

R1(config)#interface gigabitEthernet 0/0

R1(config-GigabitEthernet 0/0)#ip address 192.168.3.2 255.255.255.0

R1(config-GigabitEthernet 0/0)#exit

R1(config)#interface gigabitEthernet 0/1

R1(config-GigabitEthernet 0/1)#ip address 10.4.1.1 255.255.255.0

R1(config-GigabitEthernet 0/1)#exit

R1(config)#interface loopback 0

R1(config-Loopback 0)#ip address 4.4.4.4 255.255.255.255

R1(config-Loopback 0)#exit

2、全网路由启用ospf,并把对应的接口通告到指定的区域

注意:

1)ospf的进程号,只是代表本路由器上的一个ospf进程,全网路由器的ospf进程号可以不一致

2)ospf在建立邻居的时候会检测对方hello包的区域标识,同一条链路上,两端的ospf 区域号必须一致

3)network命令的含义:network命令用于定义需要启用ospf的接口,通过ip网段+反掩码(0代表精确匹配,1代表任意匹配)将对应接口匹配出来,建议network后面直接跟接口的ip地址,反掩码用 0.0.0.0,把这个 ip地址 所属的接口通告进ospf进程。

R1(config)#router ospf 1      //启用ospf协议,进程号为1    

R1(config-router)#network 192.168.1.1 0.0.0.0 area 1     //把192.168.1.1匹配的接口通告进ospf进程,区域号为1    

R1(config-router)#network 10.1.1.1 0.0.0.0 area 1

R1(config-router)#exit

   

R2(config)#router ospf 1

R2(config-router)#network 192.168.1.2 0.0.0.0 area 1

R2(config-router)#network 192.168.2.1 0.0.0.0 area 0

R2(config-router)#exit

   

R3(config)#router ospf 1

R3(config-router)#network 192.168.2.2 0.0.0.0 area 0

R3(config-router)#network 192.168.3.1 0.0.0.0 area 2

R3(config-router)#exit

   

R4(config)#router ospf 1

R4(config-router)#network 192.168.3.2 0.0.0.0 area 2

R4(config-router)#network 10.4.1.1 0.0.0.0 area 2

R4(config-router)#exit

3、(可选)调整以太网接口的ospf网络类型

说明:

以太网接口的默认ospf网络类型为broadcast,有40秒的wait时间来选举DR/BDR。建议点到点的以太网互联接口,将两端的接口ospf网络类型都配置为point-to-point ,加快ospf邻居关系的收敛。

R2(config)#interface fastEthernet 0/1

R2(config-if-FastEthernet 0/1)#ip ospf network point-to-point        //调整接口的ospf网络类型为point-to-point  链路两端ospf网络类型必须一致    

R2(config-if-FastEthernet 0/1)#exit

   

R3(config)#interface fastEthernet 0/1

R3(config-if-FastEthernet 0/1)#ip ospf network point-to-point

R3(config-if-FastEthernet 0/1)#exit

   4、(可选)出口位置设备向OSPF普通区域下发默认路由

R2(config)#router ospf 1

             R2(config-router)#default-information originate always        //加上always参数后无论设备本地存在生效的默认路由,设备都会向OSPF区域下发默认路由。 如果没有加always参数,那么只有在该路由器上有有效的默认路由时设备才会向OSPF区域内下发默认路由。

 

 

 

五、配置验证    

1、查看相邻的路由器之间是否建立ospf邻居关系,及邻居状态。若相邻路由器能够正常建立邻居关系,且状态为full,则ospf运行正常。

注意:

ospf网络类型为多路访问网络时,DR other之间的邻居关系为2-way,不会达到full状态。

    

2、查看全网路由器的路由,若每台路由器都能学习到整网的路由,则ospf配置正确。

    

返回顶部

收起
请选择服务项目
关闭咨询页
售前咨询 售前咨询
售前咨询
售后服务 售后服务
售后服务
意见反馈 意见反馈
意见反馈
更多联系方式
是否找到您想要的内容?
您遇到了什么问题?
找不到想要的信息
筛选功能不好用
加载速度太慢
页面体验差
提交
您是否找到了与产品相关的文档
筛选功能是否帮助您更快找到所需的文档?
有帮助
一般
没有帮助
没用过
请问您遇到了什么问题?
需要填写的内容太多
有些信息不懂怎么填
页面有问题/错误
其他
确定
这些客户案例是否对您有帮助?
非常有帮助
比较有帮助
没有帮助
请您对这个客户案例进行评价
兴趣度
相关性
可信度
确定
感谢您的反馈!
感谢您的反馈!