1.在交换机上创建vlan ----------vlan编号:12位二进制 0-4095 其中1-4094可用
交换机默认存在vlan1,且默认所有的接口属于vlan1
建立新的vlan
2.把交换机上的接口划分到对应的vlan上
a.先改模式(电脑为access模式)
b.然后接到对应的vlan
指令如下:
[sw1]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[sw1-port-group]port link-type access
[sw1-port-group]port default vlan 2
3.trunk干道-------1.不属于任何一个vlan,可承载所有vlan流量的转发,具有标记和识别区分不同vlan的能力 标记的标准---802.1Q(dot1q)标准
指令如下:
[sw1]interface Eth0/0/6
[sw1-Ethernet0/0/6]port link-type trunk 先将接口修改为trunk模式
[sw1-Ethernet0/0/6]port trunk allow-pass vlan 2 to 3 再定义该接口允许经过的vlan流量,默认仅允许VLAN1通过
[sw2]interface Eth0/0/3
[sw2-Ethernet0/0/3]port link-type trunk
[sw2-Ethernet0/0/3]port trunk allow-pass vlan 2 to 3
4.单臂路由--路由器子接口
指令:
[route]interface g0/0/0.1
[route-GigabitEthernet0/0/0.1]dot1q termination vid 2
[route-GigabitEthernet0/0/0.1]ip address 192.168.1.254 24
5.开完接口,pc端选择dhcp自动获取