三层交换机虚拟接口做路由案例(思科系列)
1、三层交换机与二层交换机相连,二层交换机与PC相连。注意端口。PC0和PC2属于vlan10,PC1和PC3属于vlan20。
2、配置IP地址:PC0:192.168.10.10 255.255.255.0
PC1:192.168.20.10 255.255.255.0
PC2:192.168.10.20 255.255.255.0
PC3:192.168.20.30 255.255.255.0
vlan10网关:192.168.10.1
vlan20网关:192.168.20.1
配图例子,按照格式打。
1、Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
Switch(config)#vlan 10
Switch(config-vlan)#ex
Switch(config)#vlan 20
Switch(config-vlan)#ex
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#ex
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/24
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
switch2配置一样。如图
1、核心交换机
Switch(config)#int 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 add 192.168.10.1 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#ex
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 add 192.168.20.1 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#ex
Switch(config)#ip routing
Switch(config)#ex
Switch#
2、测试连通性