Categories: 网络学习

华为HCIA实验-单区域OSPF的实现

拓扑图

每台路由器的Lo0口的ip作为route ID。都是Area 0区域。

R1设置

<Huawei>sys

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sy

[Huawei]sysname R1

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 10.1.1.1 24

[R1-GigabitEthernet0/0/0]int lo0

[R1-LoopBack0]ip add 11.1.1.1 32

[R1-LoopBack0]quit

[R1]router id 11.1.1.1    //指定路由器的router id,如果不指定,则ospf默认使用lo0接口的最大ip作为router id

Info: Router ID has been modified, please reset the relative protocols manually

to update the Router ID.

[R1]ospf    //开启ospf

[R1-ospf-1]area 0        //进入区域视图

[R1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255

[R1-ospf-1-area-0.0.0.0]network 11.1.1.1 0.0.0.0        //network指定区域包含的网段,掩码需要使用反码

R2设置

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R2

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0]ip add 10.1.1.2 24

[R2-GigabitEthernet0/0/0]int lo0

[R2-LoopBack0]ip add 22.1.1.1 32

[R2-LoopBack0]quit

[R2]router id 22.1.1.1

Info: Router ID has been modified, please reset the relative protocols manually

to update the Router ID.

[R2]ospf

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255

[R2-ospf-1-area-0.0.0.0]network 22.1.1.1 0.0.0.0

OSPF验证

[R1]display ospf peer    //查看ospf邻居状态

[R1]display ospf peer brief        //查看邻居状态,显示ospf的邻居概要信息


[R1]display ospf routing        //查看ospf的路由表信息


[R1]dis ip routing-table protocol ospf        //查看ospf学到的路由

测试连通性

修改dr和bdr的优先级

目前R1是dr,我们修改下优先级把R2变成br。

<R2>system-view

Enter system view, return user view with Ctrl+Z.

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0]ospf dr-priority 100        //修改dr的接口优先级为100

修改了优先级后不会自动重新选举dr,需要重置r1r2的邻居关系

两台路由器上都要执行下下面的命令

<R1>reset ospf process

<R2>reset ospf process

在验证下看到现在dr是R2了

王哥哥

Share
Published by
王哥哥