提示:文章例子中的指令#号若无特殊提示,则指代在[system]系统视图中进行 *** 作。 OSPF介绍
OSPF(Open Shortest Path First - 最短路径优先协议):
是一种典型的链路状态型
路由协议。也是网络层
的一种协议。传递网络掩码。基于IP协议封装,协议号为 89传递LSA 链路状态通告
,包含:
路由LSA:描述本路由器上接口的路由信息拓扑LSA:描述路由器之间的连接状态 更新方式: 触发更新+30分钟的链路状态刷新更新地址: 组播和单播更新,组播地址: 224.0.0.5(ALL SPF router) 224.0.0.6 (ALL DR router)支持路由认证支持手工汇总支持区域划分比较消耗设备资源
简单的单区域拓扑图
OSPF拓扑设计原则
星型网络多区域网络中,任一ospf区域必须存在有唯一的骨干区域。骨干区域会在非骨干区域之间发布区域间路由信息。区域area0为骨干区域,其它为非骨干区域
配置思路
将蓝色区域作为area1,所有路由都在area1内用ospf协议。
最终效果应该是全网可达。
模板配置的网关我假设为24,环回接口序号为0
配置接口IP,配置环回接口IP:[Huawei]interface g0/0/0
[Huawei]ip address xxx.xxx.xxx.xxx 掩码(24或者255.255.255.0)
[Huawei]interface loopback 0
[Huawei-ospf-1]ospf 1
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]network 自身接口IP地址 反掩码 //0.0.0.0作为反掩码表示,特指宣告精确的IP地址
全部配置
(以下#号为注释)
[V200R003C00]
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 192.168.0.20 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
#
ospf 1
area 0.0.0.1
network 1.1.1.1 0.0.0.0
network 192.168.0.20 0.0.0.0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[V200R003C00]
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 192.168.0.21 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.1.21 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.2.21 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
#
ospf 1
area 0.0.0.0
area 0.0.0.1
network 2.2.2.2 0.0.0.0
network 192.168.0.21 0.0.0.0
network 192.168.1.21 0.0.0.0
network 192.168.2.21 0.0.0.0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[V200R003C00]
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 192.168.2.20 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack4
ip address 4.4.4.4 255.255.255.0
#
ospf 1
area 0.0.0.1
network 192.168.2.20 0.0.0.0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[V200R003C00]
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 192.168.1.20 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.0
#
ospf 1
area 0.0.0.1
network 3.3.3.3 0.0.0.0
network 192.168.1.20 0.0.0.0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
OSPF成功运行的表现
注意下图末行的full状态,说明ospf获取了LSU数据包内的LSA信息,并且成功同步了LSA信息
#display ospf peer //查看OSPF邻居状态
#display ospf interface //查看OSPF接口通告,可查主从选举优先级的值
#display ospf brief //查看OSPF精简信息
查看Router-ID指令
#display router id
修改DR/BDR选举优先级
由于DR/BDR(主从指定路由)选举中,优先级:
比较优先级(Pri)值,越大越优。优先级范围:0-255。优先级需人为指定,若不指定默认为1。
若优先级相同,则比较Router-ID,值大者优先
一般我们采用修改优先级来控制主从选举,例
:
#interface GigabitEthernet0/0/1
[interface 0/0/1] ospf dr-priority 2
修改后再次查看ospf主从选举状态,会发现主从指定路由并未发生变化。原因是系统为了维持OSPF网络的稳定,DR/BDR之间的选举若发生改变后不会立即改变,需要先将接口关闭(可选择物理重启)或者重启OSPF进程后才能令DR/BDR重新选举。
PS:建议是重启OSPF进程 *** 作,手速不够快可以在拓扑中保存配置后热重启。
重启 *** 作,例:
<Huawei> reset ospf 1 process
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)