• 思科配置SVI实现VLAN间路由


    思科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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    配置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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    三层交换机配置

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

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

    S1(config)#vlan 10
    S1(config-vlan)#vlan 20
    S1(config-vlan)#exit
    
    • 1
    • 2
    • 3

    给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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    开启三层功能:

    这一步很重要

    S1(config)#ip routing
    
    • 1

    配置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
    
    • 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    PC2默认网关:

    ping 192.168.20.1
    
    • 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    PC2:

    ping 192.168.20.2
    
    • 1
    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    Tracert

    tracert 192.168.20.2
    
    • 1
    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.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
  • 相关阅读:
    保护 Web 服务器安全性
    wordpress 增加SSL
    Python趣味入门10:推倒繁琐化烦为简的推导式
    15.0_[Java 集合框架]-集合与框架
    Mysql:锁
    C# 后端以form格式请求上传附件
    算法练习13——H 指数
    python-(4-2)数据类型的应用(列表)
    企业数据治理的下一步是数据资产管理?
    最佳生物信息工作环境(2023年11月更新版)
  • 原文地址:https://blog.csdn.net/qq_42759112/article/details/128066157