相同vlan如何跨交换机通信?

场景:

在工作上遇到了相关的问题,所以在这整理一下相同的vlan是如何跨交换机通信的。

拓扑图

在这里插入图片描述

要求

PC1与PC4可以通信,与PC2/PC3之间无法通信。
PC2与PC5可以通信,与PC1/PC3之间无法通信。
PC3与PC6可以通信,与PC1/PC2之间无法通信。

配置

第一台交换机(LSW3)配置

<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SWA
[SWA]user-interface console 0
[SWA-ui-console0]idle-timeout 0 0
[SWA-ui-console0]quit
[SWA]vlan bat 10 20 30
Info: This operation may take a few seconds. Please wait for a moment...done.               
[SWA]int e0/0/1
[SWA-Ethernet0/0/1]port link-type trunk
[SWA-Ethernet0/0/1]port link-type access
[SWA-Ethernet0/0/1]port default vlan 10
[SWA-Ethernet0/0/1]q
[SWA]int e0/0/22
[SWA-Ethernet0/0/22]port link-type trunk
[SWA-Ethernet0/0/22]port trunk allow-pass vlan 10 20 30
[SWA-Ethernet0/0/22]q                              
[SWA]int e0/0/2
[SWA-Ethernet0/0/2]port link-type access 
[SWA-Ethernet0/0/2]port default vlan 20
[SWA-Ethernet0/0/2]q
[SWA]int e0/0/3
[SWA-Ethernet0/0/3]port link-type access 
[SWA-Ethernet0/0/3]port default vlan 30
[SWA-Ethernet0/0/3]q

第二台交换机(LSW4)配置

<Huawei>
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SWB
[SWB]user-interface console 0
[SWB-ui-console0]idle-timeout 0 0
[SWB-ui-console0]quit
[SWB]vlan bat 10 20 30 
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWB]int e0/0/1	
[SWB-Ethernet0/0/1]port link-type access 
[SWB-Ethernet0/0/1]port default vlan 10
[SWB-Ethernet0/0/1]q
[SWB]int e0/0/22
[SWB-Ethernet0/0/22]port link-type trunk 
[SWB-Ethernet0/0/22]port trunk allow-pass vlan 10 20 30
[SWB-Ethernet0/0/22]q
[SWB]int e0/0/2	
[SWB-Ethernet0/0/2]port link-type access 
[SWB-Ethernet0/0/2]port default vlan 20
[SWB-Ethernet0/0/2]q
[SWB]int e0/0/3
[SWB-Ethernet0/0/3]port link-type access 
[SWB-Ethernet0/0/3]port default vlan 30
[SWB-Ethernet0/0/3]q                               

测试联通性

PC1与PC4能通在这里插入图片描述
PC1与PC2不通在这里插入图片描述
PC4与PC5/PC6不通在这里插入图片描述
测试结果说明配置成功

总结

交换机给往其他交换机的数据帧打上VLAN标识,经过中继链路传输,带VLAN标签的数据到达接收方后,接收方交换机会去除掉VLAN标签,根据MAC地址表,实现VLAN标签对应的端口的数据转发。

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

头发莫的了呀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值