目录
VLAN概述与优势
分割广播域
物理分割
逻辑分割
VLAN的优势
控制广播
增强网络安全性
简化网络管理
静态VLAN的配置
VLAN的范围
VLAN ID范围 | 范围 | 用途 |
0,4095 | 保留 | 仅限系统使用 用户不能查看和使用这些VLAN |
1 | 正常 | Ciscot默认VLAN 用户能够使用该VLAN,但不能删除它 |
2-1001 | 正常 | 用于以太网的VLAN 用户可以创建、使用和删除这些VLAN |
1002-1005 | 正常 | 用于FDDI和令牌环的Cisco默认VLAN 用户不能删除这些VLAN |
1006-1024 | 保留 | 仅限系统使用 用户不能查看和使用这些VLAN |
1025-4094 | 扩展 | 仅用于以太网VLAN |
配置静态VLAN的步骤
创建VLAN
将交换机的端口加入到相应的VLAN中
验证VLAN的配置
先把拓补图规划好
启动所有设备后 配置交换机sw1
<Huawei>system-view //进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw1 //重命名交换机
[sw1]undo info en
[sw1]vlan 10 //新建vlan10
[sw1]vlan batch 10 20
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access //配置接口类型
[sw1-Ethernet0/0/1]port default vlan 10 //给接口划分vlan
[sw1-Ethernet0/0/1]undo sh //开启接口
Info: Interface Ethernet0/0/1 is not shutdown.
[sw1-Ethernet0/0/1]int e0/0/2 //进入e0/0/2
[sw1-Ethernet0/0/2]port link-type access //配置接口类型
[sw1-Ethernet0/0/2]port default vlan 20 //给接口划分vlan
[sw1-Ethernet0/0/2]undo sh //开启接口
Info: Interface Ethernet0/0/1 is not shutdown.
配置完后pc1ping pc2
VLAN Trunk
1.trunk作用:Trunk是用来实现不同交换机上相同VLAN的主机之间的通信,即跨交换机的VLAN通信。
2.vlan的跨交换机传输过程:
首先把拓扑图规划好,我这里是想要PC1和PC4可以进行数据通信,它们都在vlan10里,PC2和PC3可以进行通信,他们都在vlan20里。
给PC1配置IP地址,然后给PC2/4/6都配置好IP.
配置sw1
<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 sw1 //重命名交换机
[sw1]int e0/0/1 //进入接口e0/0/1
[sw1-Ethernet0/0/1]port link-type access //配置接口类型
[sw1-Ethernet0/0/1]port default vlan 10 //给接口划分vlan
[sw1-Ethernet0/0/1]undo sh //开启接口
Info: Interface Ethernet0/0/1 is not shutdown.
[sw1-Ethernet0/0/1]int e0/0/2 //进入e0/0/2
[sw1-Ethernet0/0/2]port link-type access //配置接口类型
[sw1-Ethernet0/0/2]port default vlan 20 //划分vlan
[sw1-Ethernet0/0/2]undo shutdown //开启接口
Info: Interface Ethernet0/0/2 is not shutdown.
[sw1-Ethernet0/0/2]int e0/0/3 //进入接口
[sw1-GigabitEthernet0/0/3]port link-type trunk //配置接口类型,trunk
[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all //白名单,允许所有vlan通过
[sw1-Ethernet0/0/3]undo shutdown //开启接口
Info: Interface Ethernet0/0/3 is not shutdown.
配置sw2
<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 sw1 //重命名交换机
[sw2]int e0/0/1 //进入接口e0/0/1
[sw2-Ethernet0/0/1]port link-type access //配置接口类型
[sw2-Ethernet0/0/1]port default vlan 10 //给接口划分vlan
[sw2-Ethernet0/0/1]undo sh //开启接口
Info: Interface Ethernet0/0/1 is not shutdown.
[sw2-Ethernet0/0/1]int e0/0/2 //进入e0/0/2
[sw2-Ethernet0/0/2]port link-type access //配置接口类型
[sw2-Ethernet0/0/2]port default vlan 20 //划分vlan
[sw2-Ethernet0/0/2]undo shutdown //开启接口
Info: Interface Ethernet0/0/2 is not shutdown.
[sw2-Ethernet0/0/2]int e0/0/3 //进入接口
[sw2-GigabitEthernet0/0/3]port link-type trunk //配置接口类型,trunk
[sw2-GigabitEthernet0/0/3]port trunk allow-pass vlan all //白名单,允许所有vlan通过
[sw2-Ethernet0/0/3]undo shutdown //开启接口
Info: Interface Ethernet0/0/3 is not shutdown.
pingPC1和PC4,看是否能ping通,可以ping通说明成功