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

HCIP的配置

一、实验拓扑图

在这里插入图片描述

二、实验要求

1.内网1P地坊用172.16.0.0/16分配
2.SW1和SW2之间互为备份
3.VRRP/STP/VLAN/Eth-trunk均使用
4.所有PC均通过DHCP获取IP地址
5.ISP路由器只能配置IP地址
6.所有电脑可以正常访问ISP路由器环回

三、实验步骤

1. 创建VLAN并配置端口模式

在所有交换机(LSW1、LSW2、LSW3、LSW4)上创建VLAN2和VLAN3:
system-view
vlan batch 2 3

  • 配置连接PC的端口为Access模式并分配VLAN:

  • LSW3:
    interface GigabitEthernet 0/0/1 # PC1(VLAN2)
    port link-type access
    port default vlan 2
    interface GigabitEthernet 0/0/2 # PC2(VLAN3)
    port link-type access
    port default vlan 3

  • LSW4:
    interface GigabitEthernet 0/0/1 # PC3(VLAN2)
    port link-type access
    port default vlan 2
    interface GigabitEthernet 0/0/2 # PC4(VLAN3)
    port link-type access
    port default vlan 3

  • 配置交换机间互联端口为Trunk模式,允许VLAN2和VLAN3通过:
    LSW1与LSW2之间的端口(GE0/0/1、GE0/0/2):

    interface GigabitEthernet 0/0/1
    port link-type trunk
    port trunk allow-pass vlan 2 3
    interface GigabitEthernet 0/0/2
    port link-type trunk
    port trunk allow-pass vlan 2 3

    • 其他Trunk链路(如LSW1↔LSW3、LSW1↔LSW4等)同理配置。
2. 配置Eth-Trunk链路(SW1与SW2之间)
  • 在SW1和SW2上创建Eth-Trunk并绑定物理端口:

    interface Eth-Trunk 1
    mode lacp-static # 使用LACP协议
    trunkport GigabitEthernet 0/0/1 0/0/2 # 绑定端口
    port link-type trunk
    port trunk allow-pass vlan 2 3

3. 配置MSTP(多生成树协议)
  • 在所有交换机上配置MSTP域并划分实例:

    stp region-configuration
    region-name MSTP_DOMAIN
    revision-level 1
    instance 1 vlan 2 # VLAN2映射到Instance1
    instance 2 vlan 3 # VLAN3映射到Instance2
    active region-configuration
    stp enable

  • 设置SW1为Instance1的主根和Instance2的备份根:
    stp instance 1 root primary
    stp instance 2 root secondary

  • 设置SW2为Instance2的主根和Instance1的备份根:
    stp instance 2 root primary
    stp instance 1 root secondary

4. 配置VLAN接口和DHCP服务
  • 在SW1和SW2上为VLAN2和VLAN3配置接口IP并启用DHCP:
    • SW1:
      interface Vlanif 2
      ip address 172.16.2.1 24
      dhcp select interface # 启用DHCP服务
      interface Vlanif 3
      ip address 172.16.3.1 24
      dhcp select interface

    • SW2:
      interface Vlanif 2
      ip address 172.16.2.2 24
      dhcp select interface
      interface Vlanif 3
      ip address 172.16.3.2 24
      dhcp select interface

5. 配置VRRP实现网关冗余
  • 在SW1和SW2的VLAN接口上配置VRRP虚拟IP:
    • VLAN2(虚拟IP:172.16.2.100):
      interface Vlanif 2
      vrrp vrid 2 virtual-ip 172.16.2.100
      vrrp vrid 2 priority 120 # SW1为主网关

    • VLAN3(虚拟IP:172.16.3.100):
      interface Vlanif 3
      vrrp vrid 3 virtual-ip 172.16.3.100
      vrrp vrid 3 priority 100 # SW1为备份网关

    • SW2配置相反优先级:
      interface Vlanif 2
      vrrp vrid 2 virtual-ip 172.16.2.100
      vrrp vrid 2 priority 100 # SW2为备份网关
      interface Vlanif 3
      vrrp vrid 3 virtual-ip 172.16.3.100
      vrrp vrid 3 priority 120 # SW2为主网关

6. 配置路由和NAT
  • 在SW1和SW2上配置默认路由指向AR1和AR2:
    ip route-static 0.0.0.0 0.0.0.0 172.16.0.1 # AR1的接口IP
    ip route-static 0.0.0.0 0.0.0.0 172.16.0.2 # AR2的接口IP(可选)

  • 在AR1上配置NAT和默认路由:
    interface GigabitEthernet 0/0/0 # 连接ISP的接口
    ip address 200.1.1.1 24
    nat outbound # 启用NAT
    ip route-static 0.0.0.0 0.0.0.0 200.1.1.254 # 指向ISP

  • ISP路由器仅配置接口IP和环回地址:
    interface GigabitEthernet 0/0/0
    ip address 200.1.1.254 24
    interface LoopBack 0
    ip address 8.8.8.8 32

四、实验结果

1、验证VLAN及端口模式:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
2、主根与配根的配置
在这里插入图片描述
在这里插入图片描述
3、vrrp的配置
sw1的vrrp vrid 2设置为master,3设置为backup:
在这里插入图片描述
sw2的vrrp vrid 3设置为master,2设置为backup:
在这里插入图片描述

4、ping指令

在这里插入图片描述
在这里插入图片描述

ping通公网ip,开启nat服务
在这里插入图片描述
ping通isp:
在这里插入图片描述

http://www.dtcms.com/a/108402.html

相关文章:

  • 使用Python和OpenCV进行指纹识别与验证
  • 通过必应壁纸官方api实现网页背景图片随机展示
  • substring() 和 slice() 这两个方法的相同与不同
  • Python 脚本:自动化你的日常任务
  • 【element ui】翻页记忆功能、多选时执行删除操作,刷新表格问题
  • VS+Qt配置QtXlsx库实现execl文件导入导出(全教程)
  • 自动调整PPT文本框内容:防止溢出并智能截断文本
  • Shiro学习(三):shiro整合springboot
  • 城电科技 | 探秘零碳校园:创新应用,引领绿色未来
  • PHP在Debian环境上的并发处理能力如何
  • 深度学习处理文本(6)
  • STM32实现一个简单电灯
  • 2023年12月电子学会青少年软件编程四级考级真题—新“跳7”游戏
  • OpenCV
  • 系统与网络安全------Windows系统安全(5)
  • Maya软件中的约束基础:提高角色动画制作效率的关键技术
  • 【解决】Edge浏览器硬件加速问题:无法滚动与卡顿的应对方法
  • Lumerical ------ Edge coupler design
  • Test——BUG篇
  • 掌握 Git 的艺术:Rebase 和 Merge 的使用技巧
  • MySQL 中 LOCK TABLES(手动锁表) 语句的详细说明,包括语法、使用场景、示例代码及注意事项
  • c加加学习之day02
  • ubuntu制做vsftpd的docker镜像
  • git总是链接不成功
  • Excel处理控件Spire.XLS系列教程:C# 打印 Excel 文档
  • 【算法】双指针
  • GIT ---- 解决【fatal: Authentication failed for】
  • 【案例89】达梦数据库优化器参数导致的SQL执行错误
  • 在Ubuntu20.04开发Dify插件教程,部署Dify插件脚手架
  • 深度学习 Deep Learning 第15章 表示学习