您的位置首页百科知识

三层交换机虚拟接口做路由案例(思科系列)

三层交换机虚拟接口做路由案例(思科系列)

的有关信息介绍如下:

三层交换机虚拟接口做路由案例(思科系列)

本案例利用三层交换机路由功能,在三层交换机分别创建每个VLAN的SVI接口,用虚拟接口,解决了物理接口短缺的问提。在每个SVI上配置IP地址,作为对应VLAN内主机的网关,三层交换机和二层交换机通过trunk链路相连,在三层交换上利用路由功能解决VLAN间通信

三层交换机与二层交换机相连,二层交换机与PC相连。注意端口。PC0和PC2属于vlan10,PC1和PC3属于vlan20。

配置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

配图例子,按照格式打。

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配置一样。如图

核心交换机

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#

测试连通性