当前位置:网站首页>HCIA-R&S自用笔记(18)园区网架构基础、交换机工作原理、VLAN原理
HCIA-R&S自用笔记(18)园区网架构基础、交换机工作原理、VLAN原理
2022-07-26 22:15:00 【筐瓢大师小吕】
园区网架构基础(7/22,33min)
交换技术/二层技术
路由技术不一定都是三层技术(如RIP封装在UDP 520,OSPF封装在IP 89)
二层交换机工作在数据链路层,对数据帧进行操作。在收到数据帧后,交换机会根据数据帧的头部信息对数据帧进行转发

提到大二层网络
交换机工作原理(7/22,42min)
交换机的主要功能:
终端设备的接入
以太网数据帧的交换,根据目的MAC地址转发数据帧;学习MAC地址,并维护MAC地址表;
防止二层环路
| 原理 | 备注 |
学习 Learn | 当从一个接口收到帧时,把帧内的源MAC与该接口进行绑定,存入MAC地址表 |
泛洪 Flood | 当从一个接口收到广播帧、组播帧、未知单播帧(目标MAC不存在与MAC地址表中),把该帧从所有其他接口转发出去,除了接收口 |
转发 Forward | 当从一个接口收到已知单播帧,立即从相应的接口转发出去 |
更新 Update | 默认每条记录保存300s 交换机重启后会清空所有接口学习到的记录 接口关闭后会清空该接口学习到的记录 一个源MAC出现在另外接口上,会删除老的记录,添加新的记录 |
发包即学习,无故ARP也能使交换机学习到MAC地址
相对交换机,路由器发现没有目标路由则直接丢包
dis mac-add agenting-time查看老化时间(不发包的话五分钟mac表清空)
一个接口只会学到一个主机的一个mac,可能来回浮动
组播优化技术,控制泛洪
以太网接口工作模式:
| 术语 | 备注 |
| 半双工 | half-duplex 通信双方都能发送和接收数据,但不能同时进行。(电话) |
| 全双工 | full-duplex 通信双方都能同时接收和发送数据。(对讲机) |
| 速率 | speed 接口连接时两端进行协商,协商失败则无法正常通信 |
双工与速率默认自适应(negotiation auto);
关闭自动协商:
int GigabitEthernet 0/0/1
undo auto-negotiation 或 negotiation auto disable(根据设备版本不同)半双工可能出现CRC与Framements(分片)以及Collisions(冲突,数据包流向冲突)错误包
VLAN原理(7/22,48min)
Vlan(Virtual Local Area Network),虚拟局域网。
VLAN优点:
有效控制广播域范围;增强局域网的安全性;灵活构建虚拟工作组;简化网络管理
VLAN概述:
将一个物理局域网在逻辑上划分成多个广播域;
1 VLAN =1 广播域 =1 子网
广播不会在VLAN之间转发,而是被限制在各自的VLAN中
不同VLAN间的设备默认无法通讯,需要第三层设备才能实现互通
VLAN范围:
0-4095,共4096个(0和4095作保留,1为默认)
VLAN标签介绍:
以太网帧中源mac与类型之间插入一个4字节的tag

交换机给pc或交换机端口间pvid与vlan一致时,不带tag
VLAN链路类型:
| 类型 | 备注 |
Access Link 接入链路 | 用于连接主机和交换机的链路 接入链路上传输的帧都是untagged帧 |
Trunk link 干道/中继链路 | 用于交换机的互连或交换机与路由器间(单臂路由)的链路 干道链路上传输的帧几乎都是tagged帧用于两端识别 |
还有Hybrid与QinQ两种
PVID:
即Port VLAN ID,代表端口的缺省VLAN
接口类型-Access:
用于连接主机;
收到数据后会添加VLAN Tag,VLAN ID和端口的PVID相同;
转发数据前会移除VLAN Tag
主机A给交换机发送数据,交换机打上标签10,找到另一个pvid10端口转发,并剥离tag
注:
PC不能发送或接受有tag的帧(无法识别)
交换机打标签只用于自己识别
若主机A向交换机发送标签为20的数据包,交换机接口(PVID为10)怎么处理——将20改为10
接口类型-Trunk:
收到帧时(入方向)
如该帧不含Tag,则打上端口的PVID;
若该帧包含Tag,则不改变
发送帧时(出方向),该帧的VLAN ID在Trunk的允许发送列表中:
若与端口的PVID相同,则剥离Tag发送;
若与端口的PVID不同,则直接发送
承载多个vlan的流量
接口类型-Hybrid
全access口也能通(主机地址要同网段)
既可以连接主机,又可以连接其他交换机。
既可以连接接入链路又可以连接干道链路
允许多个VLAN的帧通过,并可以在出接口方向将某些VLAN帧的Tag剥离(取决于命令的配置)
特殊场景:
只依靠Access接口完成不同VLAN(但同网段)主机的通信:

交换机的级联端口做如上设置,也可以实现数据通信
PC-A→SW1 Gi0/0/1(添加标签PVID10)→SW1 Gi0/0/2(剥离标签PVID 10)→SW2 Gi0/0/1(添加标签PVID 20)→SW2 Gi0/0/2(剥离标签PVID20)→PC-B
边栏推荐
- Xinding acquires Ziguang holdings! Wanye enterprise: comprehensive transformation of integrated circuits!
- 总投资100亿美元,华虹无锡12吋晶圆厂正式投产
- Huawei conspires to acquire Brazilian operators?
- 比海豹便宜,造型炸裂空间大,20万左右真没对手?长安全新“王炸”这样选才划算
- 纷享销客罗旭对话西门子王海滨:先进制造,要向数字化要效益
- Embedded sig | distributed soft bus
- 2022 latest Tibet Construction Safety Officer simulation question bank and answers
- 《强化学习周刊》第55期:LB-SGD、MSP-DRL & 对抗鲁棒强化学习
- Mate30系列发布:华为的重构影像之路还能走多远?
- Domestic DRAM will be mass produced by the end of the year, but the road ahead is still long!
猜你喜欢

模块8(消息队列存储消息数据的mysql表格)

杰理下载器强制下载工具的使用介绍_AC695N696NAD14AD15全系列支持

Introduction to Nacos as a registry and configuration center - realize remote call, dynamically obtain configuration files and database configuration information

基于信心上界蒙特卡洛搜索树(UCT)实现四子棋

Basic use of gateway

Incremental secure file system SFS based on C language design

Database full stack Engineers (devdbops) have low down payment and high return, and pay after employment

json格式化小工具--pyqt5实例

kalibr标定realsenseD435i --多相机标定
![[IO Development Notes] smart cloud intelligent watering device practice (3) - automatic code generation and transplantation](/img/f6/e23089c473cc72a7d763ff975d8e62.png)
[IO Development Notes] smart cloud intelligent watering device practice (3) - automatic code generation and transplantation
随机推荐
Implementation principle of semaphore in golang
Domestic DRAM will be mass produced by the end of the year, but the road ahead is still long!
Reduce power consumption and upgrade functions! Qiyingtailun released the second generation voice AI chip: the module price is as low as 14.99 yuan!
STM32-如何使用串口
比海豹便宜,造型炸裂空间大,20万左右真没对手?长安全新“王炸”这样选才划算
CSRC: agree to the IPO registration of Chuanyin holding science and Technology Innovation Board
DTS is equipped with a new self-developed kernel, which breaks through the key technology of the three center architecture of the two places Tencent cloud database
Huawei atlas900 reveals the secret: it integrates thousands of shengteng 910 chips, and its computing power is comparable to 500000 PCs!
工作一年后,我有些感悟(写于2017年)
Parameter analysis and stone jumping board
芯鼎收购紫光控股!万业企业:全面转型集成电路!
[hcip] OSPF external route introduction
思立微的反击:汇顶涉案屏下光学指纹专利被宣告无效
gateway基本使用
7.27 watch first | openeuler is ambitious, open source Huizhi creates the future - the most detailed agenda of the Euler sub forum of the open atom global open source summit is released
Shardingsphere JDBC keyword problem
Monte Carlo search tree (UCT) based on confidence upper bound to realize four sub chess
杭州银行面试题【杭州多测师】【杭州多测师_王sir】
Introduction to the use of Jerry downloader forced download tool_ Ac695n696nad14ad15 full range support
The secret weapon of apple iphone11 series: U1 chip may usher in the era of ultra wideband