HCIP交换综合实验

一.要求及拓扑图如下:

1. 内网IP地址使用<172.16.0.0>/16划分

2. vlan遵循最少vlan透传原则

3. vlan2 属于 instance1 ;vlan3 属于 instance2 ,SW1是instance1的主根, instance2的备份根, SW2反之

4. SW1为vlan2的主网关设备, vlan3的备份网关设备; SW2反之

3. SW1与SW2直接链路做聚合

4. 所有pc均通过DHCP获取IP地址

5. ISP只配置IP地址

6. 所有电脑可以正常访问ISP路由器环回

二.解题思路及配置顺序:

  1. 根据图中内网广播域个数划分对应网段

  2. 创建eth-trunk,划入成员接口

  3. 创建vlan、划分接口类型

  4. MSTP配置

  5. 配置IP地址

  6. VRRP配置,增强网关可靠性

  7. 配置DHCP,并测试

  8. 路由互通(自选协议)

  9. 配置NAT,做公私网的转换

  10. 测试 ···

三.解题拓扑图及设备配置如下:

1.接入交换机 LSW3 配置:

system-view

sysname LSW3

vlan batch 2 3

# 下联PC配置

interface Ethernet0/0/1

port link-type access

port default vlan 2

interface Ethernet0/0/2

port link-type access

port default vlan 3

# 上联核心配置(透传必要VLAN)

interface GigabitEthernet0/0/3

port link-type trunk

port trunk allow-pass vlan 2 3

interface GigabitEthernet0/0/4

port link-type trunk

port trunk allow-pass vlan 2 3

# MSTP配置(透传所有VLAN)

stp mode mstp

stp region-configuration

region-name MSTP-REGION

instance 1 vlan 2

instance 2 vlan 3

active region-configuration

quit

stp enable

quit

2.接入交换机 LSW4 配置:

system-view

sysname LSW4

vlan batch 2 3

# 下联PC配置

interface Ethernet0/0/1

port link-type access

port default vlan 2

interface Ethernet0/0/2

port link-type access

port default vlan 3

# 上联核心配置

interface GigabitEthernet0/0/3

port link-type trunk

port trunk allow-pass vlan 2 3

interface GigabitEthernet0/0/4

port link-type trunk

port trunk allow-pass vlan 2 3

# MSTP配置(与LSW3保持一致)

stp mode mstp

stp region-configuration

region-name MSTP-REGION

instance 1 vlan 2

instance 2 vlan 3

active region-configuration

quit

stp enable

quit

3.核心交换机 LSW1 配置:

# 基础配置与 VLAN

system-view

sysname LSW1

vlan batch 2 3 5

# 与AR1互联VLAN5

interface GigabitEthernet0/0/5

port link-type access

port default vlan 5

interface Vlanif5

ip address 172.16.5.1 255.255.255.0

# 链路聚合(与 LSW2 互联)

interface Eth-Trunk0

port link-type trunk

port trunk allow-pass vlan 2 3

interface GigabitEthernet0/0/1

eth-trunk 0

interface GigabitEthernet0/0/2

eth-trunk 0

# MSTP 配置(满足根桥要求)

stp mode mstp

stp region-configuration

region-name MSTP-REGION

instance 1 vlan 2

instance 2 vlan 3

active region-configuration

quit

# 要求:instance1主根,instance2备份根

stp instance 1 root primary

stp instance 2 root secondary

stp enable

# VRRP 配置(满足网关主备)

VLAN2配置(主网关)

interface Vlanif2

ip address 172.16.2.1 255.255.255.0

vrrp vrid 2 virtual-ip 172.16.2.3

vrrp vrid 2 priority 120

vrrp vrid 2 preempt-mode timer delay 0

VLAN3配置(备份网关)

interface Vlanif3

ip address 172.16.3.1 255.255.255.0

vrrp vrid 3 virtual-ip 172.16.3.3

vrrp vrid 3 priority 100

vrrp vrid 3 preempt-mode timer delay 0

# DHCP 配置(为 PC 分配 IP)

dhcp enable

ip pool VLAN2

gateway-list 172.16.2.3

network 172.16.2.0 mask 255.255.255.0

ip pool VLAN3

gateway-list 172.16.3.3

network 172.16.3.0 mask 255.255.255.0

interface Vlanif2

dhcp select global

interface Vlanif3

dhcp select global

# 静态路由(回包给 AR1)

ip route-static 0.0.0.0 0.0.0.0 172.16.5.2

quit

4.核心交换机 LSW2 配置:

# 基础配置与 VLAN

system-view

sysname LSW2

vlan batch 2 3 6

# 与AR1互联VLAN6

interface GigabitEthernet0/0/1

port link-type access

port default vlan 6

interface Vlanif6

ip address 172.16.6.1 255.255.255.0

# 链路聚合(与 LSW1 互联)

interface Eth-Trunk0

mode lacp-static

port link-type trunk

port trunk allow-pass vlan 2 3

interface GigabitEthernet0/0/1

eth-trunk 0

interface GigabitEthernet0/0/2

eth-trunk 0

# MSTP 配置(满足根桥要求)

stp mode mstp

stp region-configuration

region-name MSTP-REGION

instance 1 vlan 2

instance 2 vlan 3

active region-configuration

quit

# 要求:instance1备份根,instance2主根

stp instance 1 root secondary

stp instance 2 root primary

stp enable

# VRRP 配置(满足网关主备)

# VLAN2配置(备份网关)

interface Vlanif2

ip address 172.16.2.2 255.255.255.0

vrrp vrid 2 virtual-ip 172.16.2.3

vrrp vrid 2 priority 100

vrrp vrid 2 preempt-mode timer delay 0

# VLAN3配置(主网关)

interface Vlanif3

ip address 172.16.3.2 255.255.255.0

vrrp vrid 3 virtual-ip 172.16.3.3

vrrp vrid 3 priority 120

vrrp vrid 3 preempt-mode timer delay 0

# DHCP 配置(为 PC 分配 IP)

dhcp enable

ip pool VLAN2

gateway-list 172.16.2.3

network 172.16.2.0 mask 255.255.255.0

ip pool VLAN3

gateway-list 172.16.3.3

network 172.16.3.0 mask 255.255.255.0

interface Vlanif2

dhcp select global

interface Vlanif3

dhcp select global

# 静态路由(回包给 AR1)

ip route-static 0.0.0.0 0.0.0.0 172.16.6.2

quit

5.出口路由器 AR1 配置:

# 接口 IP 配置

system-view

sysname AR1

# 与LSW1互联

interface GigabitEthernet0/0/1

ip address 172.16.5.2 255.255.255.0

# 与LSW2互联

interface GigabitEthernet2/0/0

ip address 172.16.6.2 255.255.255.0

# 与ISP互联

interface GigabitEthernet0/0/0

ip address 2.2.2.1 255.255.255.0

# 静态路由(回包内网)

ip route-static 172.16.2.0 255.255.255.0 172.16.5.1

ip route-static 172.16.3.0 255.255.255.0 172.16.6.1

# 为了负载均衡(也可以写浮动路由)

ip route-static 172.16.2.0 255.255.255.0 172.16.6.1

ip route-static 172.16.3.0 255.255.255.0 172.16.5.1

# NAT 配置(让 PC 访问公网)

acl number 2000

rule permit source 172.16.0.0 0.0.255.255

interface GigabitEthernet0/0/0

nat outbound 2000

quit

6.ISP 路由器配置(仅 IP 地址)

system-view

sysname ISP

interface GigabitEthernet0/0/0

ip address 2.2.2.2 255.255.255.0

interface LoopBack0

ip address 1.1.1.1 255.255.255.255

quit

四.验收:

1. 验收聚合链路结果 display Eth-Trunk {number}

SW1:
SW2:

2. 验收 vlan 划分 display port vlan active

SW1:
SW2:
SW3:
SW4:

3.验收 MSTP 配置 display stp brief

SW1:
SW2:
SW3:
SW4:

4. 验收 VRRP 配置 display vrrp brief

SW1:
SW2:

5. 验收 DHCP 配置

PC1:
PC2:
PC3:
PC4:

6. 验收路由情况

SW1:
SW2:
R1:

7. 验收 NAT 配置

ACL配置:

接口配置:

SW1:

R1:

SW2:

实验到此结束!

相关推荐
paopaokaka_luck11 分钟前
基于Springboot3+Vue3的宠物殡葬管理系统(webSocket实时通讯、接入腾讯地图、支付宝沙盒支付、Echarts图形化分析)
java·开发语言·网络·后端
承渊政道21 分钟前
【从零开始大模型开发与微调:基于PyTorch与ChatGLM】(从退化问题到信息高速公路:ResNet残差网络实战拆解)
网络·人工智能·pytorch·深度学习·resnet·chatglm·卷积
Lhappy嘻嘻28 分钟前
网络初识|基础入门:局域网广域网、IP 端口、TCP/IP 五层模型与封装解封装全过程
java·开发语言·网络·笔记·网络协议·tcp/ip
KaMeidebaby36 分钟前
卡梅德生物技术快报|兔单克隆抗体:噬菌体 Fab 免疫文库搭建实操:兔单克隆抗体重组构建完整参数
前端·网络·数据库·人工智能·算法
IpdataCloud11 小时前
担心IP暴露隐私?用安全IP查询工具自查,三步配置网络出口
网络·tcp/ip·安全·ip
xy345311 小时前
wireshark 如何捕获信息
网络·测试工具·渗透测试·wireshark
玖玥拾13 小时前
C# 语言进阶(十五)C# 游戏服务端 MySQL 数据库
服务器·开发语言·网络·数据库·mysql·c#
一个有温度的技术博主14 小时前
【VulnHub 实战】DC-1 靶机渗透测试笔记(一):信息收集与主机发现
服务器·网络·笔记
白帽小阳15 小时前
2026前端面试题!(附答案及解析)
javascript·网络·python·安全·web安全·网络安全·护网行动
hehelm16 小时前
Linux网络编程—TCP字典翻译系统
linux·开发语言·网络·c++·tcp/ip