NE相关知识之------路由知识

1.路由表


目标网络/掩码 下一跳 出接口


11.0.0.0/8 2.2.2.2 GE0/0/24

最长掩码匹配--------------------------------最长掩码匹配

2.路由划分

a. 直连路由

由设备自动生成指向本地直连网络

b. 静态路由

由网络管理员手动配置的路由条目

c. 动态路由

路由器运行动态路由协议学习到的路由

3.路由配置方法

1.先写出每台路由器的直连路由、及静态路由

2.按照上面写出来的路由进行静态路由配置

4.等价路由

来源相同、开销相同的路由都会被加入到路由表、形成的路由为等价路由

(两个路由条目执行的目的网段系统,但是具有不同的下一跳地址),路由转发

会将流量分布到多条路径上。

R1dis ip routing-table

Destinations : 11 Routes : 12

Destination/Mask Proto Pre Cost NextHop Interface

10.1.2.0/24 Direct 0 0 10.1.2.1 GE0/0/1

10.1.2.1/32 Direct 0 0 127.0.0.1 GE0/0/1

10.1.2.255/32 Direct 0 0 10.1.2.1 GE0/0/1

10.1.3.0/24 Direct 0 0 10.1.3.1 GE0/0/2

10.1.3.1/32 Direct 0 0 127.0.0.1 GE0/0/2

10.1.3.255/32 Direct 0 0 10.1.3.1 GE0/0/2
100.0.0.0/8 Static 60 0 10.1.2.254 GE0/0/1
Static 60 0 10.1.3.254 GE0/0/2

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

5.浮动路由

例如一个公司使用了两个不同的运营商或多个运营商互联网专线,但是给的速率不同,电信给的100M/bps; 移动给的20M/bps,如果使用等价路由(负载均衡)情况下,需要每秒转发出去200M/bps流量,那么就会从电信发出100M/bps,从移动也发100M/bps,但是移动给的只是20M/bps的情况下,移动这边会把多的80M/bps(100-20)的流量直接给丢弃,造成部分网络丢包,这个时候不能让路由成等价路由方式(目的地项目,开销相同),需要设置对应的开销来做主备而非负载均衡

R1ip route-static 100.0.0.0 8 g

R1ip route-static 100.0.0.0 8 GigabitEthernet 0/0/2 10.1.3.254 preference 61 #设置此条路由的Pre 为 61 未设置的交换机默认为60 ,所有这条总开销(Dest+ Pre + Cost )多,不会被写到路由表

R1dis ip routing-table

Destinations : 11 Routes : 11

Destination/Mask Proto Pre Cost NextHop Interface

10.1.2.0/24 Direct 0 0 10.1.2.1 GE0/0/1

10.1.2.1/32 Direct 0 0 127.0.0.1 GE0/0/1

10.1.2.255/32 Direct 0 0 10.1.2.1 GE0/0/1

10.1.3.0/24 Direct 0 0 10.1.3.1 GE0/0/2

10.1.3.1/32 Direct 0 0 127.0.0.1 GE0/0/2

10.1.3.255/32 Direct 0 0 10.1.3.1 GE0/0/2
100.0.0.0/8 Static 60 0 10.1.2.254 GE0/0/1

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

只有当 100.0.0./8 这条断开后,接着刚才写的 preference 61 会自动生效启动,查看如下:

R1int g 0/0/1

R1-GigabitEthernet0/0/1shut

R1-GigabitEthernet0/0/1shutdown

R1dis ip routing-table

Destinations : 8 Routes : 8

Destination/Mask Proto Pre Cost NextHop Interface

10.1.3.0/24 Direct 0 0 10.1.3.1 GE0/0/2

10.1.3.1/32 Direct 0 0 127.0.0.1 GE0/0/2

10.1.3.255/32 Direct 0 0 10.1.3.1 GE0/0/2
100.0.0.0/8 Static 61 0 10.1.3.254 GE0/0/2

127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

6.缺省路由(默认路由)

配置缺省路由

R1ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet 0/0/1 10.1.2.2

第一个0.0.0.0 表示去往任意地址;

第二个0.0.0.0表示掩码为0,匹配的等价最低,表示匹配不到后最后的保底匹配掩码

一般是配置在互联网出口路由这样配置,当然可以使用上面的浮动路由和等价路由配置

相关推荐
无足鸟ICT1 天前
【RHCA+】vmstat命令(监控系统资源)
linux·服务器
垆边人似月.1 天前
RDMA 文件传输踩坑(五):READY 发送成功后,为什么出现 Work Request Flushed Error?
服务器·网络·tcp/ip
闪亮的路灯1 天前
Linux 安装mqtt服务mosquitto
linux·运维·服务器
HideF1 天前
nmcli
linux·服务器·网络
qetfw1 天前
UOS DHCP Relay:跨网段分配与 IP、DNS、网关验证
linux·服务器·网络·tcp/ip·uos
明航咨询-陈老师1 天前
ITSS运行维护服务能力成熟度认证技术纵深:标准模型、等级路径、2026审核趋势与CS/CMMI对比
服务器·数据库·cmmi
szxinmai主板定制专家1 天前
X86 工控机 vs RK3588 异构主控:AMR 控制器 BOM、散热、长期运维对比
运维·stm32·单片机·嵌入式硬件·fpga开发·am62x
缓慢更新1 天前
AI 辅助生成单测:从接口定义到用例的流水线
java·服务器·前端·网络·数据库·人工智能
叼烟扛炮1 天前
Linux 学习笔记(四十一):TCP 并发演进——从单进程到多线程服务器
linux·运维·服务器·网络·笔记·学习·tcp/ip
叼烟扛炮1 天前
Linux 学习笔记(四十四):HTTP 协议解析与极简 Web 服务器实战
linux·服务器·学习