配置VRRP与MSTP协议

实验要求

网络拓扑图

STP的使用

STP的主要目的是在网络中提供冗余路径的同时避免环路。

STP作用:通过阻塞端口来消除环路,并能够实现链路备份。

STP操作:

  1. 选举一个根桥    (优先级+MAC地址)

  2. 每个非根交换机选举一个根端口

  3. 每个网段选举一个指定端口

  4. 阻塞非根、非指定端口

VRRP的使用

VRRP的主要目的是实现路由器的冗余,以提高网络的可靠性。

通过配置虚拟路由器的IP地址为默认网关,VRRP可以在不改变组网的情况下,将多台路由器虚拟成一个虚拟路由器。

VRRP的基本结构:

VRRP组:由多个路由器接口组成,共用一个虚拟IP地址。

Master路由器:处于活动状态的路由器,承担实际的数据流量转发任务。

Backup路由器:处于备份状态的路由器,侦听Master路由器的状态,并在Master路由器发生故障时接替其工作。

网络规划

  • 交换机之间的接口全部为 Trunk 类型。

  • 在 SW1和 SW2 上配置 VRRP,Master 路由器优先级为 150,Backup 路由器优先级为 110。当Master 路由器的上行接口出现故障,其优先级减少 70,实现由 Master 路由器到 Backup 路由器的切换。

  • Sw1 交换机上配置 VLAN 接口IP地址:

    VLAN2 接口的 IP地址: 192.168.72.1/24

    VLAN3 接口的 IP地址: 192.168.73.1/24

    VLAN4 接口的 IP地址: 192.168.74.1/24

    VLAN7 接口的 IP地址: 192.168.77.1/24

    VLAN8 接口的 IP地址: 192.168.78.1/24

    VLAN100 接口的 IP地址: 192.168.100.1/24

  • Sw2 交换机上配置 VLAN 接口IP地址:

    VLAN2 接口的IP地址: 192.168.72.2/24

    VLAN3 接口的 IP地址: 192.168.73.2/24

    VLAN4 接口的IP地址: 192.168.74.2/24

    VLAN7 接口的 IP地址: 192.168.77.2/24

    VLAN8 接口的 IP地址: 192.168.78.2/24

    VLAN100 接口的 IP地址: 192.168.100.5/24

  • PC的IP地址及网关如下:

    PC1的IP地址: 192.168.72.10/24,网关为 192.168.72.254/24

    PC2的IP地址: 192.168.73.10/24,网关为192.168.73.254/24

    PC3的IP地址: 192.168.72.11/24,网关为 192.168.72.254/24

    PC4的IP地址: 192.168.74.10/24,网关为 192.168.74.254/24

    PC6的IP地址: 192.168.77.11/24,网关为 192.168.77.254/24

    PC7的IP地址: 192.168.78.10/24,网关为 192.168.78.254/24

  • SW1 与 NAT 网段: 192.168.100.0/30,SW2 与NAT 网段: 192.168.100.4/30,NAT 上用 Loopback0 模拟 Internet,IP地址为 222.103.255.1/30

网络协作概述

  • R1作为核心路由器,配置了多个静态路由,用于指导到达不同子网的数据包流向。

  • S1和S2作为边缘设备,配置了到达R1特定接口的静态路由。这些路由允许S1和S2上的设备通过R1访问其他网络。

  • LoopBack 0 (模拟Internet) 接口的配置在R1上很常见,用于路由协议中的稳定标识。在这里,它还被用作静态路由的下一跳地址,在实际部署中,更常见的是使用直接连接的接口地址作为下一跳。

  • 配置中的子网掩码长度(30位)意味着每个接口只有两个可用的IP地址(一个用于接口本身,另一个用于对端设备)。

实验设备

  1. 交换机S3700×2台,S5700×2台;
  2. 个人PC×4台;
  3. 路由器×1台

实验内容:

配置S1和S2的VLAN接口和VRRP

S1配置

sys

sysname S1

undo info enable

vlan batch 2 3 4 100

interface vlanif 2

ip address 192.168.72.1 24

vrrp vrid 2 virtual-ip 192.168.72.254

vrrp vrid 2 priority 150

vrrp vrid 2 preempt-mode timer delay 1

vrrp vrid 2 timer advertise 1

vrrp vrid 2 track interface GigabitEthernet 0/0/1 reduced 70

interface vlanif 3

ip address 192.168.73.1 24

vrrp vrid 3 virtual-ip 192.168.73.254

vrrp vrid 3 priority 110

vrrp vrid 3 preempt-mode timer delay 1

vrrp vrid 3 timer advertise 1

interface vlanif 4

ip address 192.168.74.1 24

vrrp vrid 4 virtual-ip 192.168.74.254

vrrp vrid 4 priority 110

vrrp vrid 4 preempt-mode timer delay 1

vrrp vrid 4 timer advertise 1

interface vlanif 7

ip address 192.168.77.1 24

vrrp vrid 7 virtual-ip 192.168.77.254

vrrp vrid 7 priority 110

vrrp vrid 7 preempt-mode timer delay 1

vrrp vrid 7 timer advertise 1

interface vlanif 8

ip address 192.168.78.1 24

vrrp vrid 8 virtual-ip 192.168.78.254

vrrp vrid 8 priority 110

vrrp vrid 8 preempt-mode timer delay 1

vrrp vrid 8 timer advertise 1

S2配置

sys

sysname S2

undo info enable

vlan batch 2 3 4 100

interface vlanif 2

ip address 192.168.72.2 24

vrrp vrid 2 virtual-ip 192.168.72.254

vrrp vrid 2 priority 110

vrrp vrid 2 preempt-mode timer delay 1

vrrp vrid 2 timer advertise 1

interface vlanif 3

ip address 192.168.73.2 24

vrrp vrid 3 virtual-ip 192.168.73.254

vrrp vrid 3 priority 150

vrrp vrid 3 preempt-mode timer delay 1

vrrp vrid 3 timer advertise 1

vrrp vrid 3 track interface GigabitEthernet 0/0/1 reduced 70

interface vlanif 4

ip address 192.168.74.2 24

vrrp vrid 4 virtual-ip 192.168.74.254

vrrp vrid 4 priority 150

vrrp vrid 4 preempt-mode timer delay 1

vrrp vrid 4 timer advertise 1

vrrp vrid 4 track interface GigabitEthernet 0/0/1 reduced 70

interface vlanif 7

ip address 192.168.77.1 24

vrrp vrid 7 virtual-ip 192.168.77.254

vrrp vrid 7 priority 110

vrrp vrid 7 preempt-mode timer delay 1

vrrp vrid 7 timer advertise 1

interface vlanif 8

ip address 192.168.78.1 24

vrrp vrid 8 virtual-ip 192.168.78.254

vrrp vrid 8 priority 110

vrrp vrid 8 preempt-mode timer delay 1

vrrp vrid 8 timer advertise 1

配置S1、S2、S3、S4的链路

S1配置

interface vlanif 100

ip address 192.168.100.1 30

interface GigabitEthernet 0/0/1

port link-type access

port default vlan 100

interface GigabitEthernet 0/0/13

port link-type trunk

port trunk allow-pass vlan all

interface GigabitEthernet 0/0/14

port link-type trunk

port trunk allow-pass vlan all

interface GigabitEthernet 0/0/15

port link-type trunk

port trunk allow-pass vlan all

interface GigabitEthernet 0/0/9

port link-type trunk

port trunk allow-pass vlan all

S2配置

interface vlanif 100

ip address 192.168.100.5 30

interface GigabitEthernet 0/0/1

port link-type access

port default vlan 100

interface GigabitEthernet 0/0/13

port link-type trunk

port trunk allow-pass vlan all

interface GigabitEthernet 0/0/14

port link-type trunk

port trunk allow-pass vlan all

interface GigabitEthernet 0/0/15

port link-type trunk

port trunk allow-pass vlan all

interface GigabitEthernet 0/0/9

port link-type trunk

port trunk allow-pass vlan all

S3配置

sys

sysname S3

undo info enable

vlan batch 2 3 4 100

interface Ethernet0/0/13

port link-type trunk

port trunk allow-pass vlan all

interface Ethernet0/0/14

port link-type trunk

port trunk allow-pass vlan all

interface Ethernet 0/0/1

port link-type access

port default vlan 2

interface Ethernet 0/0/2

port link-type access

port default vlan 3

interface Ethernet 0/0/18

port link-type trunk

port trunk allow-pass vlan all

S4配置

sys

sysname S4

undo info enable

vlan batch 2 3 4 100

interface Ethernet0/0/13

port link-type trunk

port trunk allow-pass vlan all

interface Ethernet0/0/14

port link-type trunk

port trunk allow-pass vlan all

interface Ethernet 0/0/1

port link-type access

port default vlan 2

interface Ethernet 0/0/2

port link-type access

port default vlan 4

interface Ethernet 0/0/19

port link-type trunk

port trunk allow-pass vlan all

S5配置

sys

sysname S5

undo info enable

vlan batch 2 3 4 7 8 100

interface Ethernet0/0/9

port link-type trunk

port trunk allow-pass vlan all

interface Ethernet0/0/10

port link-type trunk

port trunk allow-pass vlan all

interface Ethernet 0/0/5

port link-type access

port default vlan 7

interface Ethernet 0/0/6

port link-type access

port default vlan 8

interface Ethernet 0/0/18

port link-type trunk

port trunk allow-pass vlan all

interface Ethernet 0/0/19

port link-type trunk

port trunk allow-pass vlan all

配置S1、S2、S3、S4的MSTP

S1配置

stp region-configuration

region-name STP

instance 1 vlan 2

instance 2 vlan 3 4

instance 3 vlan 7 8

revision-level 1

active region-configuration

stp root primary

S2配置

stp region-configuration

region-name STP

instance 1 vlan 2

instance 2 vlan 3 4

instance 3 vlan 7 8

revision-level 1

active region-configuration

stp root secondary

S3配置

stp region-configuration

region-name STP

instance 1 vlan 2

instance 2 vlan 3 4

instance 3 vlan 7 8

revision-level 1

active region-configuration

stp instance 1 root primary

stp instance 2 root secondary

S4配置

stp region-configuration

region-name STP

instance 1 vlan 2

instance 2 vlan 3 4

instance 3 vlan 7 8

revision-level 1

active region-configuration

stp instance 2 root primary

stp instance 1 root secondary

S5配置

stp region-configuration

region-name STP

instance 1 vlan 2

instance 2 vlan 3 4

instance 3 vlan 7 8

revision-level 1

active region-configuration

stp instance 3 root primary

stp instance 1 root secondary

配置R1的参数以及R1、S1、S2的静态路由

R1配置

sys

undo info-center enable

sysname R1

interface GigabitEthernet 0/0/0

ip address 192.168.100.6 30

interface GigabitEthernet 0/0/1

ip address 192.168.100.2 30

interface LoopBack 0

ip address 222.103.225.1 30

ip route-static 192.168.72.0 24 192.168.100.1

ip route-static 192.168.73.0 24 192.168.100.5

ip route-static 192.168.74.0 24 192.168.100.5

ip route-static 192.168.77.0 24 192.168.100.1

ip route-static 192.168.78.0 24 192.168.100.1

S1配置

ip route-static 192.168.100.4 30 192.168.100.2

ip route-static 222.103.225.0 30 192.168.100.2

S2配置

ip route-static 192.168.100.0 30 192.168.100.6

ip route-static 222.103.225.0 30 192.168.100.6

测试

查看MSTP

查看MSTP可以用display stp brief

查看VRRP

查看VRRP可以用display vrrp brief

查看PC端是否可以ping通全网以及LoopBack的外网

PC1-->LoopBack的外网

PC1 e0/0/1端口-->S3 e0/0/1-->S3 e0/0/14-->S1 g0/0/14-->S1 g0/0/1-->R1 g0/0/0

P4-->LoopBack的外网

PC4 e0/0/1端口-->S4 e0/0/2-->S4 e0/0/14-->S2 g0/0/14-->S2 g0/0/1-->R1 g0/0/1

PC1-->PC4

PC2 e0/0/1端口-->S3 e0/0/2-->S3 e0/0/14-->S1 g0/0/14-->S1 g0/0/13-->S4 e0/0/13-->S4 e0/0/1-->PC3 e0/0/1

PC6-->LoopBack的外网

PC7-->LoopBack的外网

PC6-->PC1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值