思科SVI配置

说明

SVI技术与单臂路由和传统VLAN间路由一样,都是解决多个VLAN间通信问题。

SVI技术利用了多层交换机(本文以三层交换机为例)。

示例拓扑

其中S1为三层交换机

S2的Fa0/2接口于VLAN 10下

S3的Fa0/2接口于VLAN 20下

PC 1地址为192.168.10.2/24,默认网关为192.168.10.1

PC 2地址为192.168.20.2/24,默认网关为192.168.20.1

配置

二层交换机配置

首先创建划分VLAN:

S2的Fa0/2接口于VLAN 10下

S2(config)#vlan 10
S2(config-vlan)#name PC1
S2(config-vlan)#exit
S2(config)#interface f0/2
S2(config-if)#no shutdown
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 10
S2(config-if)#exit

S3的Fa0/2接口于VLAN 20下

S3(config)#vlan 20
S3(config-vlan)#name PC2
S3(config-vlan)#exit
S3(config)#interface f0/2
S3(config-if)#switchport mode access
S3(config-if)#switchport access vlan 20
S3(config-if)#no shutdown
S3(config-if)#exit

配置Trunk端口:

分别对S2和S3的Fa0/1端口进行配置

S2(config)#interface f0/1
S2(config-if)#switchport mode trunk
S2(config-if)#exit
S3(config)#interface f0/1
S3(config-if)#switchport mode trunk
S3(config-if)#exit

三层交换机配置

同样在S1中创建相应的VLAN:

(注意,思科模拟器中需要双击3650三层交换机拖动电源模块才能启动它)

S1(config)#vlan 10
S1(config-vlan)#vlan 20
S1(config-vlan)#exit

给VLAN配置IPv4地址:

其中VLAN 10地址为192.168.10.1/24

VLAN 20地址为192.168.20.1/24

S1(config)#interface vlan 10
S1(config-if)#no shutdown
S1(config-if)#ip address 192.168.10.1 255.255.255.0
S1(config-if)#exit
S1(config)#interface vlan 20
S1(config-if)#no shutdown
S1(config-if)#ip address 192.168.20.1 255.255.255.0
S1(config-if)#exit

开启三层功能:

这一步很重要

S1(config)#ip routing

配置PC地址

PC 1地址为192.168.10.2/24,默认网关为192.168.10.1

PC 2地址为192.168.20.2/24,默认网关为192.168.20.1

在模拟器中配置步骤很简单,此处省略

验证

Ping

PC1终端中去分别Ping PC1的默认网关、PC2的默认网关以及PC2

PC1默认网关:

ping 192.168.10.1
Reply from 192.168.10.1: bytes=32 time<1ms TTL=255
Reply from 192.168.10.1: bytes=32 time<1ms TTL=255
Reply from 192.168.10.1: bytes=32 time<1ms TTL=255
Reply from 192.168.10.1: bytes=32 time<1ms TTL=255
Ping statistics for 192.168.10.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

PC2默认网关:

ping 192.168.20.1
Pinging 192.168.20.1 with 32 bytes of data:

Reply from 192.168.20.1: bytes=32 time<1ms TTL=255
Reply from 192.168.20.1: bytes=32 time<1ms TTL=255
Reply from 192.168.20.1: bytes=32 time<1ms TTL=255
Reply from 192.168.20.1: bytes=32 time<1ms TTL=255

Ping statistics for 192.168.20.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

PC2:

ping 192.168.20.2
Pinging 192.168.20.2 with 32 bytes of data:

Request timed out.
Reply from 192.168.20.2: bytes=32 time<1ms TTL=127
Reply from 192.168.20.2: bytes=32 time<1ms TTL=127
Reply from 192.168.20.2: bytes=32 time<1ms TTL=127

Ping statistics for 192.168.20.2:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Tracert

tracert 192.168.20.2
Tracing route to 192.168.20.2 over a maximum of 30 hops: 

  1   0 ms      0 ms      0 ms      192.168.10.1
  2   0 ms      0 ms      0 ms      192.168.20.2

Trace complete.
最后修改:2022 年 11 月 27 日
如果觉得我的文章对你有用,请随意赞赏