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:

实验到此结束!

相关推荐
hhb_6183 小时前
Terra常见技术问题梳理与实战应用案例解析
运维·服务器·网络
代码中介商4 小时前
Linux TCP 协议深度解析:从状态机到拥塞控制
linux·网络·tcp/ip
落羽的落羽4 小时前
【网络】TCP与UDP协议使用指南,Socket编程实现Echo服务
linux·服务器·网络·c++·网络协议·tcp/ip·机器学习
风落无尘13 小时前
《智能重生:从垃圾堆到AI工程师》——第五章 代码与灵魂
服务器·网络·人工智能
其实防守也摸鱼16 小时前
CTF密码学综合教学指南--第九章
开发语言·网络·python·安全·网络安全·密码学·ctf
xlq2232217 小时前
50.UDP套接字
网络·网络协议·udp
南境十里·墨染春水17 小时前
linux学习笔记 网络编程——Socket入门与TCP客户端/服务器实现
linux·服务器·网络
qq_三哥啊18 小时前
【mitmproxy】通过 mitmproxy 的HTTP代理模式获取 OpenCode 发起的 AI API 请求的详细信息
网络·http·代理模式
nikolay18 小时前
AI重塑企业信息安全:攻防升级与信任重构
网络·人工智能·网络安全