当前位置:   article > 正文

HCL配置 VRRP+STP 实验

vrrp+stp

实验拓扑

在这里插入图片描述

实验过程

步骤一:基本配置

完成 VLAN 基本配置

SW1

[SW1]vlan 10
[SW1-vlan10]vlan 20
[SW1-vlan20]vlan 30
[SW1-vlan30]vlan 40
[SW1-vlan40]qu

[SW1]int vlan 10
[SW1-Vlan-interface10]ip add 192.168.10.1 24
[SW1-Vlan-interface10]int vlan 20
[SW1-Vlan-interface20]ip add 192.168.20.1 24
[SW1-Vlan-interface20]int vlan 30
[SW1-Vlan-interface30]ip add 192.168.30.1 24
[SW1-Vlan-interface30]int vlan 40
[SW1-Vlan-interface40]ip add 192.168.40.1 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

SW2

[SW2]vlan 10
[SW2-vlan10]vlan 20
[SW2-vlan20]vlan 30
[SW2-vlan30]vlan 40
[SW2-vlan40]qu

[SW2]int vlan 10
[SW2-Vlan-interface10]ip add 192.168.10.2 24
[SW2-Vlan-interface10]int vlan 20
[SW2-Vlan-interface20]ip add 192.168.20.2 24
[SW2-Vlan-interface20]int vlan 30
[SW2-Vlan-interface30]ip add 192.168.30.2 24
[SW2-Vlan-interface30]int vlan 40
[SW2-Vlan-interface40]ip add 192.168.40.2 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

SWA

[H3C]vlan 10
[H3C-vlan10]vlan 20
[H3C-vlan20]vlan 30
[H3C-vlan30]vlan 40
[H3C-vlan40]qu
[H3C]vlan 10
[H3C-vlan10]port GigabitEthernet 1/0/5
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

SWB

[SW4]vlan 10
[SW4]vlan 20
[SW4-vlan20]vlan 30
[SW4-vlan30]vlan 40
[SW4-vlan40]qu
[SW4]vlan 20
[SW4-vlan20]port GigabitEthernet 1/0/5
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

SWC

[H3C]vlan 10
[H3C-vlan10]vlan 20
[H3C-vlan20]vlan 30
[H3C-vlan30]vlan 40
[H3C-vlan40]qu
[H3C]vlan 30
[H3C-vlan30]port GigabitEthernet 1/0/5
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

SWD

[H3C]vlan 10
[H3C-vlan10]vlan 20
[H3C-vlan20]vlan 30
[H3C-vlan30]vlan 40
[H3C-vlan40]qu
[H3C]vlan 40
[H3C-vlan40]port GigabitEthernet 1/0/5
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

完成 Trunk 基本配置

SW1

[SW1]int range FortyGigE 1/0/53 to FortyGigE 1/0/54
[SW1-if-range]port link-type trunk
[SW1-if-range]undo port trunk permit vlan 1
[SW1-if-range]port trunk permit vlan 10 20 30 40

[SW1]int range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/4
[SW1-if-range]port link-type trunk
[SW1-if-range]undo port trunk permit vlan 1
[SW1-if-range]port trunk permit vlan 10 20 30 40
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

SW2

[SW2]int range FortyGigE 1/0/53 to FortyGigE 1/0/54
[SW2-if-range]port link-type trunk
[SW2-if-range]undo port  trunk permit vlan 1
[SW2-if-range]port trunk permit vlan 10 20 30 40

[SW2]int range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/4
[SW2-if-range]port link-type trunk
[SW2-if-range]undo port trunk permit vlan 1
[SW2-if-range]port trunk permit vlan 10 20 30 40
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

SWA

[H3C]int range GigabitEthernet 1/0/1 GigabitEthernet 1/0/3
[H3C-if-range]port link-type trunk
[H3C-if-range]undo port trunk permit vlan 1
[H3C-if-range]port trunk permit vlan 10 20 30 40
  • 1
  • 2
  • 3
  • 4

SWB

[H3C]int range GigabitEthernet 1/0/2 GigabitEthernet 1/0/4
[H3C-if-range]port link-type trunk
[H3C-if-range]undo port trunk permit vlan 1
[H3C-if-range]port trunk permit vlan 10 20 30 40
  • 1
  • 2
  • 3
  • 4

SWC

[H3C]int range GigabitEthernet 1/0/3 GigabitEthernet 1/0/1
[H3C-if-range]port link-type trunk
[H3C-if-range]undo port trunk permit vlan 1
[H3C-if-range]port trunk permit vlan 10 20 30 40
  • 1
  • 2
  • 3
  • 4

SWD

[H3C]int range GigabitEthernet 1/0/2 GigabitEthernet 1/0/4
[H3C-if-range]port link-type trunk
[H3C-if-range]undo port trunk permit vlan 1
[H3C-if-range]port trunk permit vlan 10 20 30 40
  • 1
  • 2
  • 3
  • 4

步骤二:配置聚合口

SW1

[SW1]int Bridge-Aggregation 1
[SW1-Bridge-Aggregation1]port link-type trunk
[SW1-Bridge-Aggregation1]undo port trunk permit vlan 1
[SW1-Bridge-Aggregation1]port trunk permit vlan 10 20 30 40
  • 1
  • 2
  • 3
  • 4

SW2

[SW2]int Bridge-Aggregation 1
[SW2-Bridge-Aggregation1]port link-type trunk
[SW2-Bridge-Aggregation1]undo port trunk permit vlan 1
[SW2-Bridge-Aggregation1]port trunk permit vlan 10 20 30 40
  • 1
  • 2
  • 3
  • 4

步骤三:配置 VRRP 组

SW1

[SW1]int vlan 10
[SW1-Vlan-interface10]vrrp vrid 10 virtual-ip 192.168.10.1    //创建 VRRP 备份组10,并配置 VRRP 备份组 1 的虚拟 IP 地址为 192.168.10.1
[SW1-Vlan-interface10]vrrp vrid 10 priority 120    //设置 SW1 在 VRRP 备份组 1 中的优先级为110,高于 SW2 的优先级 100 ,以保证 SW1 成为 Master 负责转发流量。
[SW1-Vlan-interface10]vrrp vrid 10 preempt-mode delay 500    //设置 SW1 工作在抢占方式,以保证 SW1 故障恢复后,能再次抢占成为 Master ,即只要 SW1 正常工作,就由 SW1 负责转发流量。为了避免频繁地进行状态切换,配置抢占延迟时间为 500 厘秒。
[SW1-Vlan-interface10]qu

[SW1]int vlan 20
[SW1-Vlan-interface20]vrrp vrid 20 virtual-ip 192.168.20.1
[SW1-Vlan-interface20]vrrp vrid 20 priority 120
[SW1-Vlan-interface20]vrrp vrid 20 preempt-mode delay 500
[SW1-Vlan-interface20]qu

[SW1]int vlan 30
[SW1-Vlan-interface30]vrrp vrid 30 virtual-ip 192.168.30.1
[SW1-Vlan-interface30]vrrp vrid 30 priority 120
[SW1-Vlan-interface30]vrrp vrid 30 preempt-mode delay 500

[SW1-Vlan-interface30]int vlan 40
[SW1-Vlan-interface40]vrrp vrid 40 virtual-ip 192.168.40.1
[SW1-Vlan-interface40]vrrp vrid 40 priority 120
[SW1-Vlan-interface40]vrrp vrid 40 preempt-mode delay 500
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

SW2

[SW2-if-range]int vlan 10
[SW2-Vlan-interface10]vrrp vrid 10 virtual-ip 192.168.10.1
[SW2-Vlan-interface10]vrrp vrid 10 priority 100
[SW2-Vlan-interface10]vrrp vrid 10 preempt-mode delay 500
[SW2-Vlan-interface10]qu

[SW2]int vlan 20
[SW2-Vlan-interface20]vrrp vrid 20 virtual-ip 192.168.20.1
[SW2-Vlan-interface20]vrrp vrid 20 priority 100
[SW2-Vlan-interface20]vrrp vrid 20 preempt-mode delay 500

[SW2-Vlan-interface20]int vlan 30
[SW2-Vlan-interface30]vrrp vrid 30 virtual-ip 192.168.30.1
[SW2-Vlan-interface30]vrrp vrid 30 priority 100
[SW2-Vlan-interface30]vrrp vrid 30 preempt-mode delay 500

[SW2-Vlan-interface30]int vlan 40
[SW2-Vlan-interface40]vrrp vrid 40 virtual-ip 192.168.40.1
[SW2-Vlan-interface40]vrrp vrid 40 priority 100
[SW2-Vlan-interface40]vrrp vrid 40 preempt-mode delay 500
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

步骤四:检查 VRRP 端口

在这里插入图片描述
SW1 为 VRRP 组 Master 设备,备份组 10 的虚拟 IP 地址为 192.168.10.1
在这里插入图片描述
SW2 为 VRRP 组 Backup 设备,备份组 10 的虚拟 IP 地址为 192.168.10.1

步骤五:测试连通性

给4台 PC 机加上 IP 地址子网掩码和网关
PC 机的 IP 地址是相应 VLAN 可用的地址段,网关是该 VLAN 的 IP 地址
4台PC机可以相互ping 通
在这里插入图片描述

步骤六:配置 STP

[SW1]stp instance 0 priority 0    //配置当前交换机的桥的优先级
  • 1
[SW2]stp instance 0 priority 4096
  • 1

步骤七:配置 DHCP

SW1

[SW1]dhcp enable    //使能 DHCP
[SW1]dhcp server forbidden-ip 192.168.10.1 192.168.10.2    //配置 DHCP 地址池中不参与自动分配的 IP地址
[SW1]dhcp server forbidden-ip 192.168.20.1 192.168.20.2
[SW1]dhcp server forbidden-ip 192.168.30.1 192.168.30.2
[SW1]dhcp server forbidden-ip 192.168.40.1 192.168.40.2

[SW1]dhcp server ip-pool 10    //创建 DHCP 地址池
[SW1-dhcp-pool-10]gateway-list 192.168.10.1    //配置 DHCP 客户端分配的网关地址
[SW1-dhcp-pool-10]network 192.168.10.0 mask 255.255.255.0    //配置动态分配的 IP 地址范围
[SW1-dhcp-pool-10]qu
[SW1]dhcp server ip-pool 20
[SW1-dhcp-pool-20]gateway-list 192.168.20.1
[SW1-dhcp-pool-20]network 192.168.20.0 mask 255.255.255.0
[SW1-dhcp-pool-20]qu
[SW1]dhcp server ip-pool 30
[SW1-dhcp-pool-30]gateway-list 192.168.30.1
[SW1-dhcp-pool-30]network 192.168.30.0 mask 255.255.255.0
[SW1-dhcp-pool-30]dhcp server ip-pool 40
[SW1-dhcp-pool-40]gateway-list 192.168.40.1
[SW1-dhcp-pool-40]network 192.168.40.0 mask 255.255.255.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

SW2

[SW2]dhcp enable
[SW2]dhcp server forbidden-ip 192.168.10.1 192.168.10.2
[SW2]dhcp server forbidden-ip 192.168.20.1 192.168.20.2
[SW2]dhcp server forbidden-ip 192.168.30.1 192.168.30.2
[SW2]dhcp server forbidden-ip 192.168.40.1 192.168.40.2

[SW2]dhcp server ip-pool 10
[SW2-dhcp-pool-10]gateway-list 192.168.10.1
[SW2-dhcp-pool-10]network 192.168.10.0 mask 255.255.255.0
[SW2-dhcp-pool-10]dhcp server ip-pool 20
[SW2-dhcp-pool-20]gateway-list 192.168.20.1
[SW2-dhcp-pool-20]network 192.168.20.0 mask 255.255.255.0
[SW2-dhcp-pool-20]dhcp server ip-pool 30
[SW2-dhcp-pool-30]gateway-list 192.168.30.1
[SW2-dhcp-pool-30]network 192.168.30.0 mask 255.255.255.0
[SW2-dhcp-pool-30]dhcp server ip-pool 40
[SW2-dhcp-pool-40]gateway-list 192.168.40.1
[SW2-dhcp-pool-40]network 192.168.40.0 mask 255.255.255.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

配置完完成后 PC 机可以通过 DHCP 获取到 IP 地址
在这里插入图片描述
接着测试PC之间的连通性
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/961629
推荐阅读
相关标签
  

闽ICP备14008679号