连接设配
注:两台笔记本用于配置两台交换机
pc_name | ip | mask | rlation_f |
---|---|---|---|
laptop2 | 192.168.3.100 | 192.168.3.1 | f0/4 |
pc0 | 192.168.1.100 | 192.168.1.1 | f0/1 |
pc1 | 192.168.2.100 | 192.168.2.1 | f0/2 |
配置3960
Switch(config)#vlan 10 //创建vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#int f0/1 //进入f0/1 端口
Switch(config-if)#switchport mode access 配置端口模式为access ,accesss模式只允许一个vlan通过,trunk 可允许多个
Switch(config-if)#switchport access vlan 10 //允许vlan 10 通过
Switch(config-if)#exit
Switch(config)#int f0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#vlan 30
Switch(config-vlan)#exit
Switch(config)#int f0/4
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 30
Switch(config-if)#
配置3960与3560连接的端口
Switch(config)#int f0/3
Switch(config-if)#switchport mode trunk
配置3560
Switch(config)#vlan 10 //创建vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#int vlan 10 //进入vlan 10
Switch(config-if)# //下面两行是系统提示
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.1.1 255.255.255.0 //配置vlan IP 地址,对应pc上的网关
Switch(config-if)#no shutdown //启动端口
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#ip routing
Switch(config)#int f0/1 //进入与3960交换机连接的端口,并配置成trunk模式
Switch(config-if)#switchport mode trunk
Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.
Switch(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to down
Switch(config-if)#exit
Switch(config)#vlan 30
Switch(config-vlan)#exit
Switch(config)#int vlan 30
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
Switch(config-if)#ip address 192.168.3.1 255.255.255.0
Switch(config-if)#
ping 一下