当前位置:网站首页>HCIA OSPF
HCIA OSPF
2022-07-17 12:00:00 【恩赫阿木古朗汗】
一、搭建拓扑
二、规划ip
OSPF
基础配置
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 192.168.1.129 0.0.0.0
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]a 1
[r4-ospf-1-area-0.0.0.1]network 192.168.1.130 0.0.0.0
查看邻居表
[r3]display ospf peer brief
OSPF Process 1 with Router ID 3.3.3.3
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 1.1.1.1 Full
0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 Full
0.0.0.1 GigabitEthernet0/0/1 4.4.4.4 Full
----------------------------------------------------------------------------
[r3]
查看路由表
<r4>display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 4 Routes : 4
OSPF routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.1.0/29 OSPF 10 2 D 192.168.1.129 GigabitEthernet0/0/0
192.168.1.33/32 OSPF 10 2 D 192.168.1.129 GigabitEthernet0/0/0
192.168.1.65/32 OSPF 10 2 D 192.168.1.129 GigabitEthernet0/0/0
192.168.1.97/32 OSPF 10 1 D 192.168.1.129 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
<r4>
r4ping
<r4>ping 192.168.1.33
PING 192.168.1.33: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.33: bytes=56 Sequence=1 ttl=254 time=60 ms
Reply from 192.168.1.33: bytes=56 Sequence=2 ttl=254 time=60 ms
Reply from 192.168.1.33: bytes=56 Sequence=3 ttl=254 time=60 ms
Reply from 192.168.1.33: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 192.168.1.33: bytes=56 Sequence=5 ttl=254 time=50 ms
--- 192.168.1.33 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/54/60 ms
<r4>ping 192.168.1.65
PING 192.168.1.65: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.65: bytes=56 Sequence=1 ttl=254 time=50 ms
Reply from 192.168.1.65: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 192.168.1.65: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 192.168.1.65: bytes=56 Sequence=4 ttl=254 time=50 ms
Reply from 192.168.1.65: bytes=56 Sequence=5 ttl=254 time=50 ms
--- 192.168.1.65 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/46/50 ms
<r4>ping 192.168.1.97
PING 192.168.1.97: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.97: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 192.168.1.97: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.97: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.1.97: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 192.168.1.97: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.97 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/18/20 ms
查看r3的邻居表
<r3>display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.1.3(GigabitEthernet0/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 34 sec
Retrans timer interval: 0
Neighbor is up for 00:15:40
Authentication Sequence: [ 0 ]
Router ID: 2.2.2.2 Address: 192.168.1.2
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 30 sec
Retrans timer interval: 5
Neighbor is up for 00:15:40
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.1.129(GigabitEthernet0/0/1)'s neighbors
Router ID: 4.4.4.4 Address: 192.168.1.130
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.129 BDR: 192.168.1.130 MTU: 0
Dead timer due in 28 sec
Retrans timer interval: 5
Neighbor is up for 00:12:25
Authentication Sequence: [ 0 ]
扩展配置
修改优先级
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
[r1-GigabitEthernet0/0/0]ospf dr-priority 0
查看邻居表
[r1]display ospf peer
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.1.1(GigabitEthernet0/0/0)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.1.2
State: 2-Way Mode:Nbr is Master Priority: 0
DR: 192.168.1.3 BDR: None MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 0
Neighbor is up for 00:00:00
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.3 BDR: None MTU: 0
Dead timer due in 36 sec
Retrans timer interval: 0
Neighbor is up for 00:00:45
Authentication Sequence: [ 0 ]
[r1]display ospf peer brief
OSPF Process 1 with Router ID 1.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 2-Way
0.0.0.0 GigabitEthernet0/0/0 3.3.3.3 Full
----------------------------------------------------------------------------
[r1]
r4缺省
[r4]ospf 1
[r4-ospf-1]default-route-advertise always
查看r1的路由表
[r1]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 4 Routes : 4
OSPF routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 1 D 192.168.1.3 GigabitEthernet0/0/0
192.168.1.65/32 OSPF 10 1 D 192.168.1.2 GigabitEthernet0/0/0
192.168.1.97/32 OSPF 10 1 D 192.168.1.3 GigabitEthernet0/0/0
192.168.1.128/25 OSPF 10 2 D 192.168.1.3 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
测试
r1ping r4的环回
[r1]ping 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 4.4.4.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/36/40 ms
此时,全网可达已满足
保障更新安全
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
汇总
[r3]ospf 1
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.224
[r3-ospf-1-area-0.0.0.0]undo abr-summary 192.168.1.0 255.255.255.224
[r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.128
查看效果
<r4>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 : <Active>
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.1.0/25 OSPF 10 2 D 192.168.1.129 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
<r4>
避免环路
[r3]ip route-static 192.168.1.0 25 NULL 0
边栏推荐
- Introduction to blender automated modeling
- 软件工程——软科中国大学专业排名
- 快速判断站点是否存活的 3 种编程实现
- R语言使用epiDisplay包的ordinal.or.display函数获取有序logistic回归模型的汇总统计信息(变量对应的优势比及其置信区间、以及假设检验的p值)、使用summary汇总统计
- 一种基于Grubbs和孤立森林的多维序列异常检测方法
- Regular expression of rocky basis
- 什么是pytest,自动化测试必学
- Flink introduction to actual combat - phase IV (time and window diagram)
- C# 搭建一个基于.NET5的WPF入门项目
- 流量排名100W网站
猜你喜欢
SSH连接华为ModelArts notebook
Rasa 3. X learning series -rasa version 3.1.5 release
中科磐云—D模块web远程代码执行漏洞解析
ROV and AUV of underwater vehicle
Software engineering - ranking of majors in Chinese Universities of Software Science
【C语言】字符串、转义字符及注释
Ffmpeg record video, stop (vb.net, step on the pit, class library - 10)
Machine learning basics that can be easily introduced in 5 minutes
在线教育知识付费网站源码系统+直播+小程序,安装教程
上學=掙錢?無需繳納學費的神仙院校!
随机推荐
【OpenCV 例程200篇】233. 区域特征之矩不变量
vim怎么保存后退出
【vulnhub靶场】PRIME:1打靶过程记录
私钥,公钥的区分——私钥公钥讲解
[sort] merge sort
【Unity技术积累】简易计时器 & 协程 & 延时函数
华为Ascend910运行yolov3教程
【C语言】字符串、转义字符及注释
作业:输入1-100的奇数
[Mori city] random talk on GIS data (IV) - coordinate system
Introduction to blender automated modeling
Machine learning basics that can be easily introduced in 5 minutes
软件工程——软科中国大学专业排名
TLS四次握手
华为昇思MindSpore详细教程
Good news
Blender自动化建模入门
Rocky基础之正则表达式
A multidimensional sequence anomaly detection method based on Grubbs and isolated forest
ty_gr551x 代码框架