华为路由交换由浅入深系列(四)OSPF单区域、多区域配置、时间参数 DRBDR选举 重分布路由与认证演示 | 网络之路博客(公众号同名)(其他平台网络之路Blog)
登录
  • 欢迎网络之路博客网站,分享有用的知识点,公众号:网络之路博客,B站:网络之路Blog
  • 如果您觉得本站对您有帮助,那么赶紧使用Ctrl+D 收藏吧,支持我们下
  • 远程技术支持的淘宝店铺已经开张了哦,传送门:需要的朋友可以点击查看

华为路由交换由浅入深系列(四)OSPF单区域、多区域配置、时间参数 DRBDR选举 重分布路由与认证演示

【汇总】华为路由交换由浅入深系列

文档帖子汇总学习视频实战系列学习必备软件
    博主也只是业余时间写写技术文档,请大家见谅,大家觉得不错的话,可以推荐给朋友哦,博主会努力推出更好的系列文档的。如果大家有任何疑问或者文中有错误跟疏忽的地方,欢迎大家留言指出,博主看到后会第一时间修改,谢谢大家的支持,更多技术文章尽在网络之路博客,http://ccieh3c.com

掌握目标

一基本配置:
二、OSPF 单区域配置
三、修改OSPF Hello和Dead时间
四、OSPF重分布默认路由
五、OSPF DR/BDR选举
六、配置OSPF多区域
七、OSPF直连路由重分布
八、配置OSPF认证

拓扑一

huawei

一、基本配置如下:

R1:
interface Serial1/0/0
ip address 10.0.12.1 255.255.255.0
interface GigabitEthernet0/0/0
ip address 10.0.13.1 255.255.255.0
interface LoopBack0
ip address 10.0.1.1 255.255.255.0

R2:
interface Serial1/0/0
ip address 10.0.12.2 255.255.255.0
interface LoopBack0
ip address 10.0.2.2 255.255.255.0

R3:
interface GigabitEthernet0/0/0
ip address 10.0.13.3 255.255.255.0

interface LoopBack0
ip address 10.0.3.3 255.255.255.0
interface LoopBack1
ip address 172.16.0.1 255.255.255.0

测试:
[R1]ping -c 2 10.0.12.2
PING 10.0.12.2: 56 data bytes, press CTRL_C to break
Reply from 10.0.12.2: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 10.0.12.2: bytes=56 Sequence=2 ttl=255 time=10 ms
[R1]ping -c 2 10.0.13.3
PING 10.0.13.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.13.3: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 10.0.13.3: bytes=56 Sequence=2 ttl=255 time=10 ms

二、OSPF配置如下:

[R1]ospf 1 router-id 10.0.1.1 ====启用OPSF进程,默认进程ID为1.进程ID只具有本地意义,所以同一区域的不同路由器可以使用相同或者不同进程ID。
[R1-ospf-1]are 0
[R1-ospf-1-area-0.0.0.0]network 10.0.1.0 0.0.0.255 =====network后面配置反掩码
[R1-ospf-1-area-0.0.0.0]network 10.0.13.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255

[R2]ospf 10 router-id 10.0.2.2
[R2-ospf-10]area 0
[R2-ospf-10-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[R2-ospf-10-area-0.0.0.0]network 10.0.2.0 0.0.0.255

[R3]ospf 100 router-id 10.0.3.3
[R3-ospf-100]area 0
[R3-ospf-100-area-0.0.0.0]network 10.0.13.0 0.0.0.255
[R3-ospf-100-area-0.0.0.0]network 10.0.3.0 0.0.0.255

R1>display ip routing-table protocol ospf ====查看路由表中OSPF路由信息
Route Flags: R – relay, D – download to fib
——————————————————————————
Public routing table : OSPF
Destinations : 2 Routes : 2
OSPF routing table status :
Destinations : 2 Routes : 2
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0
10.0.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet0/0/0
OSPF routing table status :
Destinations : 0 Routes : 0
测试:
ping -c 1 10.0.2.2
PING 10.0.2.2: 56 data bytes, press CTRL_C to break
Reply from 10.0.2.2: bytes=56 Sequence=1 ttl=255 time=10 ms
— 10.0.2.2 ping statistics —
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/10/10 ms
ping -c 1 10.0.3.3
PING 10.0.3.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.3.3: bytes=56 Sequence=1 ttl=255 time=10 ms
— 10.0.3.3 ping statistics —
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/10/10 ms

display ospf peer ====显示OSPF邻居详细信息
OSPF Process 1 with Router ID 10.0.12.1
Neighbors
Area 0.0.0.0 interface 10.0.12.1(Serial1/0/0)’s neighbors
Router ID: 10.0.2.2 Address: 10.0.12.2
State: Full Mode:Nbr is Slave Priority: 1
DR: None BDR: None MTU: 0
Dead timer due in 32 sec
Retrans timer interval: 5
Neighbor is up for 00:09:52
Authentication Sequence: [ 0 ]

Neighbors
Area 0.0.0.0 interface 10.0.13.1(GigabitEthernet0/0/0)’s neighbors
Router ID: 10.0.3.3 Address: 10.0.13.3
State: Full Mode:Nbr is Slave Priority: 1
DR: 10.0.13.1 BDR: 10.0.13.3 MTU: 0
Dead timer due in 34 sec
Retrans timer interval: 5
Neighbor is up for 00:06:50
Authentication Sequence: [ 0 ]

display ospf peer brief ====显示OSPF简洁信息
OSPF Process 1 with Router ID 10.0.12.1
Peer Statistic Information
—————————————————————————-
Area Id Interface Neighbor id State
0.0.0.0 Serial1/0/0 10.0.2.2 Full
0.0.0.0 GigabitEthernet0/0/0 10.0.3.3 Full

三、修改OSPF Hello和Dead时间

display ospf interface g0/0/0 ====查看OSPF Hello与Dead默认时间
OSPF Process 1 with Router ID 10.0.12.1
Interfaces
Interface: 10.0.13.1 (GigabitEthernet0/0/0)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 10.0.13.1
Backup Designated Router: 10.0.13.3
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ospf timer hello 15
[R3-GigabitEthernet0/0/0]ospf timer dead 60

display ip routing-table protocol ospf
Route Flags: R – relay, D – download to fib
——————————————————————————
Public routing table : OSPF
Destinations : 1 Routes : 1
OSPF routing table status :
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0
OSPF routing table status :
Destinations : 0 Routes : 0
注:由于R1和R3之间hello与dead时间不一致,所以邻居无法建立。

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf timer hello 15
[R1-GigabitEthernet0/0/0]ospf timer dead 60

[R1]display ip routing-table protocol ospf
Route Flags: R – relay, D – download to fib
——————————————————————————
Public routing table : OSPF
Destinations : 2 Routes : 2
OSPF routing table status :
Destinations : 2 Routes : 2
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0
10.0.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet0/0/0
OSPF routing table status :
Destinations : 0 Routes : 0

=================OSPF邻居建立必要条件================
1.router-id不能相同
2.hello and dead 必须相同
3.区域ID必须相同
4.认证key-id及密码必须相同
5.特殊区域标记相同
6.三层MTU必须相同
7.子网掩码必须相同(在一个需要DR|BDR环境中)
8.最小范围内的双向互通
==============================================

四、OSPF重分布默认路由

[R3]ip route-static 0.0.0.0 0 lo 1
[R3]ospf 100
[R3-ospf-100]default-route-advertise ====重分布默认路由

display ip routing-table protocol os | in 0.0.0.0
Route Flags: R – relay, D – download to fib
——————————————————————————
Public routing table : OSPF
Destinations : 3 Routes : 3
OSPF routing table status :
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 1 D 10.0.13.3 GigabitEthernet0/0/0
OSPF routing table status :
Destinations : 0 Routes : 0

ping 172.16.0.1
PING 172.16.0.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.0.1: bytes=56 Sequence=1 ttl=255 time=10 ms
Reply from 172.16.0.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 172.16.0.1: bytes=56 Sequence=3 ttl=255 time=10 ms

五、OSPF DR/BDR选举

display ospf peer
OSPF Process 1 with Router ID 10.0.12.1
Neighbors
Area 0.0.0.0 interface 10.0.12.1(Serial1/0/0)’s neighbors
Router ID: 10.0.2.2 Address: 10.0.12.2
State: Full Mode:Nbr is Slave Priority: 1
DR: None BDR: None MTU: 0
Dead timer due in 31 sec
Retrans timer interval: 5
Neighbor is up for 01:17:49
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.0 interface 10.0.13.1(GigabitEthernet0/0/0)’s neighbors
Router ID: 10.0.3.3 Address: 10.0.13.3
State: Full Mode:Nbr is Slave Priority: 1
DR: 10.0.13.1 BDR: 10.0.13.3 MTU: 0
Dead timer due in 59 sec
Retrans timer interval: 5
Neighbor is up for 00:30:15
Authentication Sequence: [ 0 ]
注:默认优先级是1,由于R3 router-id大于R1 router-id所以R3为DR,R1为BDR。

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf dr-priority 200 ====配置OSPF优先级为200
注:由于DR/BDR选举默认为不抢占模式,因此修改了优先级后,不会重新进行选举,所以要重置R1与R3之间邻居关系。
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]shut
[R1-GigabitEthernet0/0/0]undo shut

display ospf pee
OSPF Process 100 with Router ID 10.0.3.3
Neighbors
Area 0.0.0.0 interface 10.0.13.3(GigabitEthernet0/0/0)’s neighbors
Router ID: 10.0.12.1 Address: 10.0.13.1
State: Full Mode:Nbr is Master Priority: 200
DR: 10.0.13.1 BDR: 10.0.13.3 MTU: 0
Dead timer due in 52 sec
Retrans timer interval: 5
Neighbor is up for 00:02:10
Authentication Sequence: [ 0 ]

拓扑二

huawei

六、配置OSPF多区域

R1:
[R1]ospf 1 router-id 10.0.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]quit
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 10.0.13.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]network 10.0.1.0 0.0.0.255

R2:
[R2]ospf 1 router-id 10.0.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 10.0.2.0 0.0.0.255

R3:
[R3]ospf 1 router-id 10.0.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 10.0.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]network 10.0.13.0 0.0.0.255

测试:
display ip rou pr os
Route Flags: R – relay, D – download to fib
——————————————————————————
Public routing table : OSPF
Destinations : 2 Routes : 2
OSPF routing table status :
Destinations : 2 Routes : 2
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0
10.0.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet0/0/0
OSPF routing table status :
Destinations : 0 Routes : 0
display ip routing-table protocol ospf
Route Flags: R – relay, D – download to fib
——————————————————————————
Public routing table : OSPF
Destinations : 3 Routes : 3
OSPF routing table status :
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.1/32 OSPF 10 48 D 10.0.12.1 Serial1/0/0
10.0.3.3/32 OSPF 10 49 D 10.0.12.1 Serial1/0/0
10.0.13.0/24 OSPF 10 49 D 10.0.12.1 Serial1/0/0
OSPF routing table status :
Destinations : 0 Routes : 0
ping -c 2 10.0.3.3
PING 10.0.3.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.3.3: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 10.0.3.3: bytes=56 Sequence=2 ttl=255 time=20 ms
ping -c 2 10.0.2.2
PING 10.0.2.2: 56 data bytes, press CTRL_C to break
Reply from 10.0.2.2: bytes=56 Sequence=1 ttl=255 time=10 ms
Reply from 10.0.2.2: bytes=56 Sequence=2 ttl=255 time=10 ms

display ospf peer brief
OSPF Process 1 with Router ID 10.0.1.1
Peer Statistic Information
—————————————————————————-
Area Id Interface Neighbor id State
0.0.0.0 Serial1/0/0 10.0.2.2 Full
0.0.0.1 GigabitEthernet0/0/0 10.0.3.3 Full

七、OSPF直连路由重分布

[R3]ospf 1
[R3-ospf-1]import-route direct ====重分布直连

测试:
dis ip rout protocol os
Route Flags: R – relay, D – download to fib
——————————————————————————
Public routing table : OSPF
Destinations : 4 Routes : 4
OSPF routing table status :
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0
10.0.3.0/24 O_ASE 150 1 D 10.0.13.3 GigabitEthernet0/0/0
10.0.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet0/0/0
172.16.0.0/24 O_ASE 150 1 D 10.0.13.3 GigabitEthernet0/0/0
注:O_ASE表示OSPF外部路由

ping -a 10.0.2.2 10.0.3.3 ====以IP 10.0.2.2为源
PING 10.0.3.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.3.3: bytes=56 Sequence=1 ttl=254 time=20 ms
Reply from 10.0.3.3: bytes=56 Sequence=2 ttl=254 time=10 ms
Reply from 10.0.3.3: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 10.0.3.3: bytes=56 Sequence=4 ttl=254 time=20 ms

R1>display ospf lsdb ==== 查看LSA数据库
OSPF Process 1 with Router ID 10.0.1.1
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.0.2.2 10.0.2.2 1536 60 80000003 48
Router 10.0.1.1 10.0.1.1 1558 48 80000003 48
Sum-Net 10.0.13.0 10.0.1.1 1773 28 80000001 1
Sum-Net 10.0.3.3 10.0.1.1 1407 28 80000001 1
Sum-Net 10.0.1.1 10.0.1.1 1766 28 80000001 0
Sum-Asbr 10.0.3.3 10.0.1.1 522 28 80000001 1

Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.0.3.3 10.0.3.3 523 48 80000005 1
Router 10.0.1.1 10.0.1.1 1399 48 80000006 1
Network 10.0.13.1 10.0.1.1 1399 32 80000002 0
Sum-Net 10.0.12.0 10.0.1.1 1773 28 80000001 48
Sum-Net 10.0.2.2 10.0.1.1 1535 28 80000001 48

AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 10.0.3.0 10.0.3.3 523 36 80000001 1
External 10.0.13.0 10.0.3.3 523 36 80000001 1
External 172.16.0.0 10.0.3.3 523 36 80000001 1

display ospf lsdb summary 10.0.3.3 =====查看TYPE 3 LSA
OSPF Process 1 with Router ID 10.0.1.1
Area: 0.0.0.0
Link State Database
Type : Sum-Net
Ls id : 10.0.3.3
Adv rtr : 10.0.1.1
Ls age : 1693
Len : 28
Options : E
seq# : 80000001
chksum : 0x4cf3
Net mask : 255.255.255.255
Tos 0 metric: 1
Priority : Low
Area: 0.0.0.1
Link State Database

display ospf lsdb asbr ====查看TYPE 4 LSA
OSPF Process 1 with Router ID 10.0.1.1
Area: 0.0.0.0
Link State Database
Type : Sum-Asbr
Ls id : 10.0.3.3
Adv rtr : 10.0.1.1
Ls age : 1031
Len : 28
Options : E
seq# : 80000001
chksum : 0x3e01
Tos 0 metric: 1
Area: 0.0.0.1
Link State Database
display ospf lsdb ase 172.16.0.0 ====查看TYPE 5 LSA
OSPF Process 1 with Router ID 10.0.1.1
Link State Database
Type : External
Ls id : 172.16.0.0
Adv rtr : 10.0.3.3
Ls age : 1109
Len : 36
Options : E
seq# : 80000001
chksum : 0xf70c
Net mask : 255.255.255.0
TOS 0 Metric: 1
E type : 2
Forwarding Address : 0.0.0.0
Tag : 1
Priority : Low

八、配置OSPF认证

[R1]int s1/0/0
[R1-Serial1/0/0]ospf authentication-mode simple plain ccieh3c.com
[R2]int s1/0/0
[R2-Serial1/0/0]ospf authentication-mode simple plain ccieh3c.com

[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher ccieh3c.com
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher ccieh3c.com

下载对应文档

百度盘下载博客资源汇总与学习思路
如果下载地址失效,请联系博主或者在下面留言,谢谢。下面也有其他您需要的资源推荐哦

关于博客资源下载说明

首先,感谢大家对网络之路博客的支持,本站所有资源都是开放下载,不做任何限制,资源都是上传在百度盘,分为两种类型:
(1)第一种是书籍PDF与视频类,全部放在博客分享,觉得对大家学习有帮助的博主会收集好、然后以博主的经验整理分类后排序好分享出来。
(2)第二种是技术性文章与视频,全部放在公众号(网络之路博客)/B站(网络之路Blog)发布,以博主原创为主,主要分享系列为主,由浅入深的带大家了解工作中常用到的一些网络技术,当然也会分享一些比较经典的案例。
(3)分享资源有涉及到您的利益以及版权问题,请联系博主,24小时候内删除。
想第一时间收到最新更新内容吗,点击获取~~~

点击查看详情

(广告)博主自主原创最新实战课程

点击查看详情


(广告)远程技术支持(设备调试),有搞不定的找我,价格实惠,为您解决实际工作上的问题

远程技术调试与技术支持,点击查看详情


原创与收集的内容,允许转载,转载时请务必以超链接形式标明文章原始出处,博客地址http://ccieh3c.com。

喜欢 (4)
[]
分享 (0)
公众号:网络之路博客(其他平台网络之路Blog)
分享一些自己懂的技术知识点,希望对大家有帮助。
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址