交换机和路由器都通过VLANif接口连接两个不同的VLAN,实现不同VLAN间的通信。
拓扑:
3层交换机
system-view
#
vlan batch 11 12 //创建VLAN
#
interface Vlanif11 //创建VLANIF接口
ip address 11.1.1.1 255.255.255.0 //相同VLAN内PC终端的网关地址
#
interface Vlanif12
ip address 12.1.1.1 255.255.255.0
#
interface g0/0/1
port link-type trunk
port trunk allow-pass vlan all
quit
2层交换机
system-view
#
vlan batch 11 12 //创建VLAN
#
interface Ethernet0/0/1
port link-type access //和PC终端相连,接口类型为Access
port default vlan 11 //接口加入VLAN
#
interface Ethernet0/0/2
port link-type access
port default vlan 12
#
interface g0/0/1
port link-type trunk
port trunk allow-pass vlan all
quit