sw0(config)#ip routing ;开启虚接口 sw0(config)#int range f0/1 - 3 sw0(config-if-range)#switchport trunk en ;定义封装类型 sw0(config-if-range)#switchport trunk encapsulation dot1q sw0(config-if-range)#sw m t ;将f0/1 - 3设置为trunk链路 sw0(config-if-range)#exit sw0(config)#int vlan 10 sw0(config-if)#ip add 10.1.1.254 255.255.255.0 ;为虚接口配置IP sw0(config-if)#no sh sw0(config-if)#exit sw0(config)#int vlan 20 sw0(config-if)# %LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up sw0(config-if)#ip add 20.1.1.254 255.255.255.0 sw0(config-if)#ip helper sw0(config-if)#ip helper-address 50.1.1.1 sw0(config-if)#no sh sw0(config-if)#exit sw0(config)#int vlan 30 sw0(config-if)# %LINK-5-CHANGED: Interface Vlan30, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up sw0(config-if)#ip add 30.1.1.254255.255.255.0 sw0(config-if)#ip helper sw0(config-if)#ip helper-address 50.1.1.1 sw0(config-if)#no sh sw0(config-if)#exit sw0(config)#int vlan 40 sw0(config-if)# %LINK-5-CHANGED: Interface Vlan40, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to up sw0(config-if)#ip add 40.1.1.254255.255.255.0 sw0(config-if)#ip help sw0(config-if)#ip helper-address 50.1.1.1 sw0(config-if)#no sh sw0(config-if)#exit sw0(config)#int vlan 50 sw0(config-if)#ip add 50.1.1.254255.255.255.0 sw0(config-if)#no sh sw0(config-if)#exit sw0(config)#do sh vtp status
此时在接入层已经可以互通并访问50.1.1.1的web站点
为服务器配置IP地址和网关
配置路由器
先升级三层交换机的端口使其和路由器连接
1 2 3 4 5
sw0(config)#int f0/4 sw0(config-if)#no switchport sw0(config-if)#ip add 60.1.1.1255.255.255.0 sw0(config-if)#no sh sw0(config-if)#exit