PC0
IP地址:192.168.1.2/24
网关:192.168.1.1
接口:Fast Ethernet 0/2
PC1
IP地址:192.168.2.2/24
网关:192.168.2.1
接口:Fast Ethernet 0/3
PC2
IP地址:192.168.1.3/24
网关:192.168.1.1
接口:Fast Ethernet 0/2
二层接入交换机2960
建立VLAN2和VLAN3,并把Fast Ethernet 0/1设置为Trunk口。
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int fa0/2
Switch(config-if)#switchport access vlan 2
Switch(config-if)#int fa0/3
Switch(config-if)#switchport access vlan 3
Switch(config-if)#int fa0/1
Switch(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#^Z
Switch#
三层转发交换机3560
建立VLAN2和VLAN3,并把Fast Ethernet 0/1设置为Trunk口,VLAN2的IP地址设置为192.168.1.1,VLAN2的IP地址设置为192.168.2.1。
Switch>EN
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#
Switch(config)#int vlan 2
%LINK-5-CHANGED: Interface Vlan2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to upSwitch(config-if)#ip addr 192.168.1.1 255.255.255.0
Switch(config-if)#int vlan 3
%LINK-5-CHANGED: Interface Vlan3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to upSwitch(config-if)#ip addr 192.168.2.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int fa0/2
Switch(config-if)#switchport access vlan 2
Switch(config-if)#int fa0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#no shut
Switch(config-if)#^Z
Switch#