当前位置:网站首页>静态和浮动路由
静态和浮动路由
2022-07-28 05:29:00 【花生味花生米】
目录
前言
路由器工作在OSI参考模型的网络层,它的重要作用是为数据包的传输选择最佳路径,已到达目的地。
一.路由器工作原理

根据路由表转发数据
1.PC1要发数据给PC2,因为不是同网段,所以pc1只能发给本网段的路由器a网关
2.路由器收到数据包,查看数据包的源和目的IP,在查看路由表,把数据从b路由的接口发出去,直到到达pc2反之把数据从a接口发出去,直到到达pc1。
二.路由表的形成
直连网段
配置ip地址,端口UP状态,形成直连路由
非直连网段
通过静态和动态路由协议形成
三.静态路由
由管理员手动配置,是单向的
缺乏灵活
四.默认路由
当路由器在路由表中找不到目标网络的路由条目时,路由器把请求转发到默认路由接口
五.浮动路由
两条或多条链路组成浮动路由
相同的目的地址,不同的下一跳地址,另一条下一跳的优先级低
六.路由器转发数据包封装过程

1、源IP192.168.10.10 目的IP192.168.20.10
源MAC 11-11 目的MAC 22-22
先ARP广播析出g/0/0/0的MAC地址,进行第一次封装
2、先解封装,查看数据包的目的IP,查询路由表,确定转发路径,给路由器2
3、先ARP广播解析出路由器2 g0/0/0的MAC地址,进行第二次封装
源IP 192.168.10.10 目的IP 192.168.20.10
源MAC 33-33 目的MAC 44-44
4、先解封装,查看数据包的目的IP为自己直连网段,通过E0/0/1转发给PC2
5、先ARP广播解析出PC2的MAC地址,进行第三次封装
源IP 192.168.1.2 目的IP 192.168.2.2
源MAC 55-55 目的MAC 66-66
七.静态路由配置

R1配置
undo t m
system-view
user-interface console 0
idle-timeout 0
q
int g0/0/0
ip add 192.168.10.1 24
int g0/0/2
ip add 192.168.50.2 24
int g0/0/1
ip add 192.168.30.3 24
q
ip route-static 192.168.60.0 24 192.168.50.1
ip route-static 192.168.20.0 24 192.168.60.2
ip route-static 192.168.40.0 24 192.168.30.1 preference 70
ip route-static 192.168.60.0 24 192.168.40.2 preference 70
ip route-static 192.168.20.0 24 192.168.60.2 preference 70
R2配置
system-view
user-interface console 0
idle-timeout 0
q
int g0/0/0
ip add 192.168.30.1 24
int g0/0/1
ip add 192.168.40.1 24
q
ip route-static 192.168.10.0 24 192.168.30.3 preference 70
ip route-static 192.168.60.0 24 192.168.40.2 preference 70
ip route-static 192.168.20.0 24 192.168.60.2 preference 70
R3配置
undo t m
system-view
user-interface console 0
idle-timeout 0
q
int g0/0/0
ip add 192.168.40.2 24
int g0/0/2
ip add 192.168.50.1 24
int g0/0/1
ip add 192.168.60.1 24
q
ip route-static 192.168.30.0 24 192.168.40.1 preference 70
ip route-static 192.168.10.0 24 192.168.50.2
ip route-static 192.168.10.0 24 192.168.30.3 preference 70
ip route-static 192.168.20.0 24 192.168.60.2
R4配置
system-view
user-interface console 0
idle-timeout 0
q
int g0/0/0
ip add 192.168.60.2 24
int g0/0/1
ip add 192.168.20.1 24
q
ip route-static 192.168.50.0 24 192.168.60.1
ip route-static 192.168.10.0 24 192.168.50.2
ip route-static 192.168.40.0 24 192.168.60.1 preference 70
ip route-static 192.168.30.0 24 192.168.40.1 preference 70
ip route-static 192.168.10.0 24 192.168.30.3 preference 70
测试结果


总结
静态要做双向配置
浮动优先级的设定
数据包经过路由,MAC地址重新封装
边栏推荐
- Which brand of air conduction earphones is better? These four should not be missed
- 一、PXE概述和安装
- Technology sharing | common proxy tools for interface testing
- Applet creation component
- MySQL主从
- [learning notes] tool
- Ubuntu18.04 set up redis cluster [learning notes]
- What kind of air conduction Bluetooth headset with good configuration is recommended
- Technology sharing | how to do Assertion Verification in interface automated testing?
- Understanding of C language EOF
猜你喜欢

Shell script - regular expression

Results fill in the blank shopping list (teach you to solve it with Excel)

Repair the faulty sector

Use powercli to create a custom esxi ISO image

MOOC翁恺C语言 第四周:进一步的判断与循环:3.多路分支4.循环的例子5.判断和循环常见的错误

Detailed explanation of LNMP construction process

Technology sharing | sending requests using curl

DHCP principle and configuration

Technology sharing | do you know the functions of the server interface automated testing and requests library?

Esxi community network card driver
随机推荐
What is the good brand of air conduction Bluetooth headset and the best brand recommendation of air conduction headset
Iptables firewall
Esxi arm edition version 1.10 update
Custom component -- pure data field & component life cycle
My deployment notes
On cookies and session
Applet navigator cannot jump (debug)
[learning notes] tool
Escape character notes
Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking
About gcc:multiple definition of
KVM热迁移
Method of designing test cases
DNS域名解析
Qgraphicsview promoted to qchartview
Difference between process and thread
Ubuntu18.04+centos7 configure redis master-slave [learning notes]
---Stack & queue---
Test interview questions collection (I) | common required questions and procedures of software testing (with answers)
Hdu-1159-commonsubsequence (LCS longest common subsequence)