码迷,mamicode.com
首页 > 其他好文 > 详细

三层交换不同VLAN间通信

时间:2018-05-05 13:25:12      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:access和trunk模式实现多VLA

注意:
1)多VLAN间通信必须在每个交换机上创建所有需要互通pc所属的VLAN的PVID(标识符)
2)多VLAN间的通信用trunk模式的链路类型连接相邻的交换机,允许所有VLAN通过;连接客户端用access模式,将端口加入对应的VLAN
3)交换机接口只允许在VLAN下配置IP地址,而且每个VLAN下配置的IP地址就是该VLAN下所有主机的网关地址

华为eNSP搭建实验环境如图:
技术分享图片
实现所有不同VLAN的pc互通

操作步骤:

[sw5]vlan batch 10 20 30
批量创建VLAN 10 20 30
[sw5]interface gi0/0/1
[sw5-gi0/0/1]port link-type access
接口的接入类型
[sw5-gi0/0/1]port default vlan 10
将接口加入到默认的VLAN
[sw5-gi0/0/1]interface gi0/0/2
[sw5-gi0/0/2]port link-type access
[sw5-gi0/0/2]port default vlan 20
[sw5-gi0/0/2]interface gi0/0/3
[sw5-gi0/0/3]port link-type trunk
将0/0/3接口的链路类型为干道模式
[sw5-gi0/0/3]port trunk allow-pass vlan all
接口允许所有VLAN通过
[sw5]interface vlan 10
因为交换机接口是不允许添加IP地址的,只允许在VLAN下添加
[sw5-vlanif10]ip address 192.168.10.254 24
为VLAN 添加IP地址,也是该VLAN所有主机的网关地址
[[sw5]interface vlan20
[sw5-vlanif20]ip address 192.168.20.254 24
[[sw5]interface vlan30
[sw5-vlanif30]ip address 192.168.30.254 24

[sw6]interface gi0/0/1
[sw6-gi0/0/1]port link-type trunk
[sw6-gi0/0/1]port trunk allow-pass vlan all
[sw6-gi0/0/1]interface gi0/0/2
[sw6-gi0/0/2]port link-type access
[sw6-gi0/0/2]port default vlan 10
[sw6-gi0/0/2]interface gi0/0/3
[sw6-gi0/0/3]port link-type access
[sw6-gi0/0/3]port default vlan 30
[sw6-gi0/0/3]interface gi0/0/4
[sw6-gi0/0/4]port link-type trunk
[sw6-gi0/0/4]port trunk allow-pass vlan all
[[sw6]interface vlan 10
[sw6-vlanif10]ip address 192.168.10.254 24
[[sw6]interface vlan20
[sw6-vlanif20]ip address 192.168.20.254 24
[[sw6]interface vlan30
[sw6-vlanif30]ip address 192.168.30.254 24

[sw7]interface gi0/0/1
[sw7-gi0/0/1]port link-type trunk
[sw7-gi0/0/1]port trunk allow-pass vlan all
[sw7-gi0/0/1]interface gi0/0/2
[sw7-gi0/0/2]port link-type access
[sw7-gi0/0/2]port default vlan 20
[sw7-gi0/0/2]interface gi0/0/3
[sw7-gi0/0/3]port link-type access
[sw7-gi0/0/3]port default vlan 30
[[sw7]interface vlan 10
[sw7-vlanif10]ip address 192.168.10.254 24
[[sw7]interface vlan20
[sw7-vlanif20]ip address 192.168.20.254 24
[[sw7]interface vlan30
[sw7-vlanif30]ip address 192.168.30.254 24
Pc设置:
Pc10:
IP:192.168.10.1
掩码:24(简写:24)
网关:192.168.10.254
Pc11:
IP:192.168.20.1
掩码:24(简写:24)
网关:192.168.20.254
Pc12:
IP:192.168.10.2
掩码:24(简写:24)
网关:192.168.10.254
Pc13:
IP:192.168.30.1
掩码:24(简写:24)
网关:192.168.30.254
Pc14:
IP:192.168.20.2
掩码:24(简写:24)
网关:192.168.20.254
Pc15:
IP:192.168.30.2
掩码:24(简写:24)
网关:192.168.30.254

三层交换不同VLAN间通信

标签:access和trunk模式实现多VLA

原文地址:http://blog.51cto.com/13721794/2112976

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!