静态路由实验(通过学习ENSP)
题目:
1,分析题目
前言:首先,我们应该了解到路由器的作用,路由器可实现不同网络间的相互连接,也就是网关;路由器还可以选择路径。
此次实验我们使用路由器的原理是:用路由协议,将不同的网络进行互通,数据包进入路由器后会先查看IP地址,再在自己的路由表中询是否存在此IP,若不存在,则需要我们手动去输入IP,也就是静态。
————————————————
版权声明:本文为CSDN博主「森 木」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_72584178/article/details/125696412
1.1
该网络拓扑图中拥有六个广播域,所以我们基于192.168.1.0/24划分出六个网段,并根据顺时针方向分别对GE口进行分配IP地址,对AR5进行环回地址配置。
AR1-AR2为192.168.1.0/24
AR2-AR4为192.168.2.0/24
AR4-AR3为192.168.3.0/24
AR4-AR1为192.168.4.0/24
AR4-AR5上方G0/0/2-G0/0/0为192.168.5.0/24
AR4-AR5下方G4/0/0-G0/0/1为192.168.6.0/24
1.2
AR1-AR5每个路由器配置两个环回接口,我们从192.168.7.0/24到192.168.14.0/24进行分配。
1.3
通过利用缺省路由(默认路由)进行低保保护,让数据包从0.0.0.0/0地址访问5.5.5.0/24。
1.4
AR4与AR5之间运用浮动静态路由完成题目要求。
二,实验操作
2.1
打开ENSP,搭建好网络拓扑图,并开启设备,网线接口为绿色即为启动成功。
2.2
点击AR1进入配置页面,
通过system-view 进入[huawei],sysname r1改名,并依次重复以上操作,实现r1,r2,r3,r4,r5,r6
interface g0/0/0接口进行ip address 192.168.1.1配置,通过interface LoopBack配置环回地址
配置完成后可以用display进行查看:
r1:
r2:
r3:
r4:
r5:
2.3
通过利用缺省路由实现低保,即使不用编写静态路由依然可以访问5.5.5.0/24网段。
知识点:缺省路由— 华为体系中也叫默认路由。一旦路由黑洞和缺省路由相遇,将100%出现路由环路。
缺省路由解释:就是一条不限定目标的路由条目。缺省路由一定是路由表中所有路由条目都无法匹配时,才最后匹配。
[r1]ip route-static 0.0.0.0 0 就近原则
每个路由器之间需要进行互相访问需要通过[r1]ip route-static命令来写入路由表,使数据包访问时知道下一跳的地址与路由条目。
2.4
利用“取相同,去不同”对环回地址进行手工汇总可以尽量减少路由条目
r1:
192.168.7.0/24
192.168.8.0/24
192.168.00000111.0/24
192.168.00001000.0/24
子网汇总:192.168.0.0/20
r2:
192.168.9.0/24
192.168.10.0/24
192.168.00001001/24
192.168.00001010/24
子网汇总:192.168.8.0/22
r3:
192.168.11.0/24
192.168.12.0/24
192.168.00001011/24
192.168.00001100/24
子网汇总:192.168.8.0/21
r4:
192.168.13.0/24
192.168.14.0/24
192.168.00001101/24
192.168.00001110/24
子网汇总:192.168.12.0/22
2.6
为避免环路出现,使用空接口路由
NULL0 — 空接口 — 虚拟接口 — 如果一条路由条目,出接口为空接口,则如果匹
配到这条路由条目,则将直接丢弃该数据包。
[r1]ip route-static 地址 NULL 0
r1:r1-r4路由表内容设置基本一致
只需要看Static即可
r5:
2.7
浮动静态路由 — 通过修改默认的优先级,实现静态路由的备份效果。
[r5]ip route-static 192.168.2.0 24 192.168.5.1 preference 70 — 手动修改静态路由的优先级
[r5]display ip routing-table protocol static — 过滤静态路由
[r5-GigabitEthernet0/0/0]shutdown — 手动关闭接口
三,实验结果
3.1 全网可达:
[r1]ping -a 192.168.7.1 192.168.9.1
PING 192.168.9.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.9.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 192.168.9.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 192.168.9.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 192.168.9.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.9.1: bytes=56 Sequence=5 ttl=255 time=20 ms
— 192.168.9.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/26/40 ms
[r1]ping -a 192.168.7.1 192.168.12.1
PING 192.168.12.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.12.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 192.168.12.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.12.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.12.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.12.1: bytes=56 Sequence=5 ttl=255 time=20 ms
— 192.168.12.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/40 ms
[r1]ping -a 192.168.7.1 192.168.13.1
PING 192.168.13.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.13.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 192.168.13.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 192.168.13.1: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 192.168.13.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 192.168.13.1: bytes=56 Sequence=5 ttl=254 time=30 ms
— 192.168.13.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/26/30 ms
[r2]ping -a 192.168.9.1 192.168.11.1
PING 192.168.11.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.11.1: bytes=56 Sequence=1 ttl=252 time=40 ms
Reply from 192.168.11.1: bytes=56 Sequence=2 ttl=252 time=40 ms
Reply from 192.168.11.1: bytes=56 Sequence=3 ttl=252 time=50 ms
Reply from 192.168.11.1: bytes=56 Sequence=4 ttl=252 time=30 ms
Reply from 192.168.11.1: bytes=56 Sequence=5 ttl=252 time=30 ms
— 192.168.11.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/38/50 ms
[r2]ping -a 192.168.9.1 192.168.13.1
PING 192.168.13.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.13.1: bytes=56 Sequence=1 ttl=253 time=20 ms
Reply from 192.168.13.1: bytes=56 Sequence=2 ttl=253 time=30 ms
Reply from 192.168.13.1: bytes=56 Sequence=3 ttl=253 time=30 ms
Reply from 192.168.13.1: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 192.168.13.1: bytes=56 Sequence=5 ttl=253 time=30 ms
— 192.168.13.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/30 ms
3.2 通过缺省路由访问5.5.5.0/24:
[r1]ping -a 192.168.7.1 5.5.5.1
PING 5.5.5.1: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.1: bytes=56 Sequence=1 ttl=253 time=70 ms
Reply from 5.5.5.1: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 5.5.5.1: bytes=56 Sequence=3 ttl=253 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=4 ttl=253 time=40 ms
Reply from 5.5.5.1: bytes=56 Sequence=5 ttl=253 time=40 ms
— 5.5.5.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/44/70 ms
[r3]ping -a 192.168.11.1 192.168.13.1
PING 192.168.13.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.13.1: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 192.168.13.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.13.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.13.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.13.1: bytes=56 Sequence=5 ttl=255 time=30 ms
— 192.168.13.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/26/30 ms
[r2]ping -a 192.168.9.1 5.5.5.1
PING 5.5.5.1: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.1: bytes=56 Sequence=1 ttl=252 time=40 ms
Reply from 5.5.5.1: bytes=56 Sequence=2 ttl=252 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=3 ttl=252 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=4 ttl=252 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=5 ttl=252 time=40 ms
— 5.5.5.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/34/40 ms
[r3]ping -a 192.168.11.1 5.5.5.1
PING 5.5.5.1: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 5.5.5.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 5.5.5.1: bytes=56 Sequence=5 ttl=254 time=30 ms
— 5.5.5.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/34/40 ms
[r4]ping -a 192.168.13.1 5.5.5.1
PING 5.5.5.1: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 5.5.5.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 5.5.5.1: bytes=56 Sequence=5 ttl=255 time=10 ms
— 5.5.5.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/28/40 ms
3.3 r5G0/0/0口断开后,由优先级为70的的100M链路通信:
总结:全网可达是在这个网络中使用任何一台设备去ping任何一台设备都必须是通的,然后每个接口必须都相互接通才可以。
————————————————