在三层交换机上配置Trunk并指定接口封装为802.1q

在三层交换机上配置Trunk并指定接口封装为802.1q
1.全局配置模式,新建vlan10 和 vlan 20
Switch>enable
Switch#configure terminal
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20

2.把f0/1和f0/2接口加入到vlan 10
Switch(config-vlan)#interface range f0/1 - 2
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit

3.把f0/3和f0/4接口加入到vlan 20
Switch(config)#interface range f0/3 - 4
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit

4.测试通网段vlan间的通讯。

5.二层交换机0/5接口设置
Switch>enable
Switch#configure terminal
Switch(config)#interface fastEthernet 0/5
Switch(config-if)#switchport mode trunk

6.三层交换机0/5接口设置
Switch>enable
Switch#configure terminal
Switch(config)#interface fastEthernet 0/5
Switch(config-if)#switchport trunk encapsulation dot1q (封装端口)
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit

7.三层交换开启路由功能,创建VLAN,分配ip。
Switch>enable
Switch#ip routing //(开启路由功能)

Switch#configconfigure terminal
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20

Switch(config)#interface vlan 10
Switch(config-if)#ip address 192.168.10.254 255.255.255.0
Switch(config-if)#no shutdown //(**)
Switch(config-if)#exit

Switch(config)#interface vlan 20
Switch(config-if)#ip address 192.168.20.254 255.255.255.0
Switch(config-if)#no shutdown //(**)
Switch(config-if)#exit

8.测试vlan间通讯

在三层交换机上配置Trunk并指定接口封装为802.1q