1、三层交换机配置
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vtp domain wgj
Changing VTP domain name from NULL to wgj
Switch(config)#vtp mode server
Device mode already VTP SERVER.
Switch(config)#vlan 50
Switch(config-vlan)#vlan 60
Switch(config-vlan)#exit
Switch(config)#interface vlan 50
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan50, changed state to up
Switch(config-if)#ip address 192.168.50.254 255.255.255.0
Switch(config-if)#interface vlan 60
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan60, changed state to up
Switch(config-if)#ip address 192.168.60.254 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#
使用ping命令检测,网关不通,什么原因?
需设置二层交换机的trunk和vlan通过
2、二层交换机50-2配置
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface gigabitEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
Switch(config-if)#exit
Switch(config)#vtp domain wgj
Domain name already set to wgj.
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/2
50 VLAN0050 active
60 VLAN0060 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
Switch#
使用ping命令测试,仍然不通,需要配置三层交换机vlan 通过,二层交换机vlan通过,pc网关设置
4、三层交换机配置
Switch(config)#interface range gigabitEthernet 0/1-2
Switch(config-if-range)#switchport trunk allowed vlan all
5、二层交换机配置
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport access vlan 50
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport access vlan 60
Switch(config-if)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console
6、PC机IP地址设置
7、同样的方法设置其余3台PC和50-3二层交换机
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vtp domain wgj
Changing VTP domain name from NULL to wgj
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to up
Switch(config)#interface gigabitEthernet 0/2
Switch(config-if)#switchport trunk allowed vlan all
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport access vlan 50
Switch(config-if)#interface fastEthernet 0/2
Switch(config-if)#switchport access vlan 60
Switch(config-if)#
使用ping命令检测,发现相同网段的连通,不同网段的不通,需开启三层交换机的路由。
8、开启三层交换机路由
Switch(config)#ip routing
全网连通,完成。