拓扑图
需求
实现VLAN间的通信
配置思路
PC机上配置地址
交换机上换分VLAN
创建虚接口作为PC的网关
配置命令
SW1配置:
[SW1]vlan batch 1 to 3
[SW1]interface g0/0/1
[SW1-g0/0/1]port link-type access
[SW1-g0/0/1]port default vlan 1
[SW1-g0/0/1]interface g0/0/2
[SW1-g0/0/2]port link-type access
[SW1-g0/0/2]port default vlan 2
[SW1-g0/0/2]interface g0/0/3
[SW1-g0/0/3]port link-type access
[SW1-g0/0/3]port default vlan 3
[SW1]interface vlanif 1
[SW1-vlanif1] ip address 192.168.1.254 24
[SW1-vlanif1]interface vlanif 2
[SW1-vlanif2]ip address 192.168.2.254 24
[SW1-vlanif2]interface vlanif 3
[SW1-vlanif3]ip address 192.168.3.254 24
测试与验证
PC1可以ping通PC2和PC3