1、一、组网需求PC1与PC2之间在不同VLAN,通过设置上层三层交换机SwitchB的VLAN接口10的IP地址为10.1.1.254/24,路由器设置VLAN接口20的IP地址为20.1.1.254/24可以实现VLAN间的互访。二、组网图三、配置步骤SwitchA相关配置:SwitchAvlan 10 /创建VLAN10SwitchA-vlan10port Ethernet 0/1 /将E0/1加入到VLAN10SwitchAvlan 20 /创建VLAN20SwitchA-vlan20port Ethernet 0/2 /将E0/2加入到VLAN20SwitchAinterface Gig
2、abitEthernet 1/1SwitchA-GigabitEthernet1/1port link-type trunk /将端口G1/1配置为Trunk端口SwitchA-GigabitEthernet1/1port trunk permit vlan 10 20 /允许VLAN10和VLAN20通过SwitchB相关配置:SwitchBvlan 10 /创建VLAN10SwitchBinterface vlan 10SwitchB-int-vlan10ip address 10.1.1.254 255.255.255.0 /设置VLAN10的虚接口地址SwitchBvlan 20 /创建VLAN20SwitchBinterface vlan 20SwitchB-int-vlan20ip address 20.1.1.254 255.255.255.0 /设置VLAN20的虚接口地址SwitchBinterface GigabitEthernet 1/1SwitchB-GigabitEthernet1/1port link-type trunk /将端口G1/1配置为Trunk端口SwitchB-GigabitEthernet1/1port trunk permit vlan 10 20 /允许VLAN10和VLAN20通过