要求:
每台电脑划分一个vlan 二层交换机向下的每个端口需要做access;向上的每个端口需要做trunk
三层交换机向下的每个端口需要做trunk;
而且需要为每个vlan接口配置ip地址,才能起到“路由”的作用。(二层交换机只有转发的功能;三层交换机既可以转发也可以路由) ?
为PC配置IP地址,子网掩码,网关
配置二层交换机
SW1
system-view
sysname SW1
vlan batch 10 20
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
interface Ethernet0/0/2
port link-type access
port default vlan 10
interface Ethernet0/0/3
port link-type access
port default vlan 20
?sw2 ?
system-view
sysname SW2
vlan batch 30 40
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 30 40
interface Ethernet0/0/2
port link-type access
port default vlan 30
interface Ethernet0/0/3
port link-type access
port default vlan 40
配置三层交换机
SW3 ?
vlan batch 10 20 30 40
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 30 40
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
interface Vlanif30
ip address 192.168.30.254 255.255.255.0
interface Vlanif40
ip address 192.168.40.254 255.255.255.0
测试
?
|