当前位置: 首页 > news >正文

三层交换机SVI功能(交换机虚拟接口)实现各个实训室电脑网络可互通,原本是独立局域网

三层交换机

SVI功能(交换机虚拟接口)

  • 实现VLAN路由

  • 需求 :各实训室使用独立局域网,即每个实训有自己的IP网段, 每个实训室只有内部互相访问。

  • 需求:为了加强各实训室学生的交流,学校要求我们将各实训室电脑网络连接起来。

  • 1. 先去汇聚层划分VLAN,
  • 2. 把实训一划分到VLAN10,
  • 3. 把实训二划分到VLAN20
  • 4. 让汇聚层连接核心层的端口模式修改为trunk

    三层-1

三层交换机(s3560)

  • 1. 在核心层划分和汇聚层相同个数的VLAN
    • vlan 10

    • exit

  • 2. 先将该接口的Trunk封装为802.1Q的帧格式
    • switchport trunk encapsulation dotlq

  • 3. 将三层交换机的端口设为trunk模式
    • switchport mode trunk

  • 4. 进入SVI模式 (vlan 10 只是进入)
    • interface vlan 10

  • 5. 设IP网关
    • ip address 192.168.10.254 255.255.255.0

  • 6. 开启
    • no shutdown

  • 7. 开启路由功能,才能跨网络(全局模式)
    • ip routing

具体步骤

先在二层交换机(汇聚层)

image-20250410154827077

  Switch>enable //进入特权
Switch#configure terminal //进入全局
Switch(config)#vlan 10 // 划分VLAN
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface f0/5 // 进入f0/5端口
Switch(config-if)#switchport access vlan 10 //设置端口模式为access ,把这个端口添加到VLAN10
Switch(config-if)#exit
Switch(config)#interface f0/10   // 进入f0/10端口
Switch(config-if)#switchport access vlan 20   //设置端口模式为access ,把这个端口添加到VLAN10
Switch(config-if)#exit
// 汇聚层和核心层连接的端口一定要设为trunk模式,要和三层一致
Switch(config)#interface f0/24  // 进入f0/24端口
Switch(config-if)#switchport mode trunk  //修改端口模式为trunk

三层交换机(核心层)

  • 选no

% Please answer 'yes' or 'no'.
Would you like to enter the initial configuration dialog? [yes/no]: no
Switch>enable //进入特权
Switch#configure terminal //进入全局
Switch(config)#interface f0/24 //进入f0/24端口
Switch(config-if)#switchport trunk encapsulation dot1q//先将该接口的Trunk封装为802.1Q的帧格式
Switch(config-if)#switchport mode trunk //再配置端口模式为Trunk
Switch(config-if)#exit
Switch(config)#vlan 10 //创建VLAN
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface vlan 10 进入SVI
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
​
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
​配置该SVI接口的IP地址,作为所在VLAN主机的网关
Switch(config-if)#ip address 192.168.10.254 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface 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 address 192.168.20.254 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#ip routing //开启路由功能,才能跨网络

相关文章:

  • MATLAB仿真多相滤波抽取与插值的频谱变化(可视化混叠和镜像)
  • TypeScript 进阶指南 - 使用泛型与keyof约束参数
  • spark简介和核心编程
  • spark-sql核心
  • 试一下阿里云新出的mcp服务
  • 鸿蒙动画与交互设计:ArkUI 3D变换与手势事件详解
  • 【字节跳动AI论文】Seaweed-7B:视频生成基础模型的高成本效益培训
  • 栈与队列习题分享(精写)
  • chrome无法访问此网站怎么回事 分享5种解决方法
  • 模拟集成电路设计与仿真 : PLL
  • CentOS DVD完整版与Minimal版的区别
  • 筛选条件在on和where中的区别(基于hivesql)
  • 数据结构·树
  • Upwork全球化战略:用“文化套利”收割国际客户
  • Spark-SQL核心编程
  • 无人机气动-结构耦合技术要点与难点
  • API:科技赋能,引领智能文字识别、身份认证与发票查验真伪变革
  • centos yum install environment-modules
  • 初识Redis · list和hash类型
  • 速卖通商品详情API接口:功能、应用与开发指南
  • 北京“准80后”干部兰天跨省份调任新疆生态环境厅副厅长
  • 牟海松任国家信访局副局长
  • 【社论】人工智能将为教育带来什么
  • 宁德时代港股募资预计最高至50亿美元:90%将投向匈牙利项目
  • 中美会谈前都发生了什么?美方为何坐不住了?
  • 2025年上海市模范集体、劳动模范和先进工作者名单揭晓