• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 关于我们

12-可靠性配置指导

目录

09-多机备份配置

本章节下载 09-多机备份配置  (479.32 KB)

09-多机备份配置


1 多机备份

1.1  多机备份简介

多机备份在部署了主备协议(例如VRRP、S-Trunk)的场景下,为多种用户业务在主备设备之间的冗余备份建立了统一的备份平台,属于设备级网络可靠性解决方案中的重要技术。

多机备份功能遵循VSRP(Virtual Service Redundancy Protocol,虚拟业务冗余协议)协议。当主备设备正常运行时,业务模块通过多机备份功能将主用设备上的用户业务数据备份到备用设备。以便当主用设备或者链路出现故障时,用户业务能够快速切换至备用设备;当主用设备或者链路的故障恢复时,用户业务能够顺利由备用设备回切至主用设备,保证用户业务的不中断。

1.1.1  多机备份的概念

·     多机备份组:承担多机备份任务的两台设备组成一个多机备份组。

·     多机备份对端:多机备份组包含两台设备,其中的每一台设备都叫做另一台设备的多机备份对端。管理员需要在这两台设备上分别配置对端设备的IP地址等信息,多机备份组才能创建成功。

·     多机备份实例:业务需要与多机备份实例相关联,才能开启多机备份功能,保障业务运行的可靠性。

·     多机备份通道:多机备份的主用设备和备用设备之间需要使用通道进行多机备份状态数据和业务数据的同步。通道使用TCP连接的方式创建。多机备份系统的通道包括以下两种:

¡     控制通道:通过在多机备份组中的两台设备之间建立TCP连接实现的。控制通道实时同步多机备份实例的状态变化信息给备用设备。在一个多机备份组中,所有的多机备份实例使用同一个控制通道。

¡     业务数据通道:当业务与多机备份实例相关联的时候,在该多机备份实例两端的设备上会创建一个业务数据通道,业务数据通道用来同步该业务的实时状态和业务运行信息,以保证当主用设备故障时,备用设备能够代替主用设备,使业务不会中断。

·     以上两种通道的创建过程相同,都是IP地址较大的设备建立TCP监听,而IP地址较小的设备向对端设备发起建立TCP的连接。TCP连接建立成功后,开始实时向对端设备同步信息。

1.1.2  多机备份的实现机制

多机备份组中的两台设备,其中一台叫做主用设备,另一台叫做备用设备。主用设备为业务提供支持,转发业务流量,并可在达到某一时间或一定的流量阈值后向备用设备发送业务备份信息;备用设备除接收主用设备的业务备份信息,在主用设备发生故障后,备用设备会转换成主用设备,继续转发业务流量,使业务不会中断。

属于同一个多机备份组的两台设备上需要创建同一个VRRP备份组(此处以IPv4 VRRP备份组为例,IPv6 VRRP备份组同理)。多机备份实例中的主用设备和VRRP备份组中的Master路由器对应,执行业务数据转发的工作,备用设备和VRRP备份组中的Backup路由器对应,监听主用设备的状态,同步主用设备上的业务数据,在主用设备发生故障时,备用设备切换成主用设备,保证当前运行的业务不被中断。VRRP的详细介绍,请参见“可靠性配置指导”中的“VRRP”。

多机备份组网如图1-1所示。

图1-1 多机备份组网图

 

 

1.1.3  多机备份模式

多机备份的备份模式包括热备份和温备份两种:

·     热备份:当备用设备收到主用设备的备份信息后,立即下发备份信息到转发平面。这样,主用设备发生故障时,备用设备能马上指导报文转发,可以实现业务快速切换到备用设备,这种形式适用于1+1备份的情况。

·     温备份:当备用设备收到主用设备的备份信息后,不会立即下发备份信息到转发平面,当主用设备发生故障后,设备的主备状态发生切换,备用设备才开始下发备份信息到转发平面,并指导报文转发。业务切换到备用设备上的时间比热备份切换时间稍长,这种形式适用于N+1备份的情况。

1.1.4  控制通道的快速检测

缺省情况下,多机备份组中的两台设备依靠TCP连接的状态来检查控制通道是否可用。为了快速检测出当前控制通道是否可用,可以采用NQA(Network Quality Analyzer,网络质量分析)、BFD(Bidirectional Forwarding Detection,双向转发检测)等监测主用设备和备用设备之间的链路状态,并通过Track功能在多机备份通道状态和NQA/BFD之间建立关联。当关联Track状态为Positive或Notready时,多机备份模块才会尝试与对端设备建立控制TCP连接;当关联Track的状态为Negative时,断开与对端设备的控制TCP连接。

1.1.5  支持多机备份的业务

双机备份为多种用户业务在主备设备之间的冗余备份建立了统一的备份平台。目前支持多机备份功能的业务特性包括DHCPv4和DHCPv6。

1.2  多机备份配置限制和指导

建议配置多机备份功能的接口,本端主接口/子接口的配置和对端主接口/子接口的配置保持一致,包括但不限于子接口的编号、VLAN配置以及VPN配置等,以免接口配置不同导致备份的数据不一致。

对于单板丝印前缀为LSXM1的单板,不支持多机备份功能。

1.3  多机备份配置任务简介

多机备份配置任务如下:

(1)     配置多机备份对端

(2)     配置多机备份实例

(3)     配置IPv6虚拟地址

对DHCPv6必选。

(4)     配置业务支持多机备份功能

¡     配置DHCPv4服务器支持多机备份功能

¡     配置DHCPv6服务器支持多机备份功能

1.4  多机备份配置准备

在多机备份组成员设备上需进行如下配置:

(1)     ‍配置设备上的VRRP的工作模式为标准协议模式;

(2)     配置一个VRRP备份组,VRRP备份组中的Master设备对应多机备份组的主用设备;VRRP备份组中的Backup设备对应多机备份组的备用设备。

当多机备份组绑定了已经存在的VRRP备份组时,被绑定的VRRP备份组的功能不受影响。

1.5  配置多机备份对端

(1)     ‍进入系统视图。

system-view

(2)     创建多机备份对端并进入多机备份对端视图。

vsrp peer peer-name

(3)     配置TCP连接。请选择其中一项进行配置。

¡     配置IPv4 TCP连接。

peer peer-ip-address local local-ip-address [ port port-id ]

¡     配置IPv6 TCP连接。

peer ipv6 peer-ipv6-address local local-ipv6-address [ port port-id ]

监听端口号不能与已有的TCP或IPv6 TCP监听服务冲突。

(4)     (可选)配置监视指定的Track项。

track track-entry-number

1.6  配置多机备份实例

1. 功能简介

多机备份实例用来指导业务备份行为。业务通过关联多机备份实例来完成业务备份功能。

在该多机备份组内,使用备份ID标识多机备份实例。

当业务持续转发时间达到流量备份时间间隔或转发业务的流量达到阈值时,多机备份实例会对该业务模块数据进行备份操作。

2. 配置限制和指导

用户可以在多机备份实例下配置业务逻辑IP地址、业务逻辑接口和业务逻辑主机名,使互为备份的设备上发送给RADIUS(Remote Authentication Dial-In User Service,远程认证拨号用户服务)服务器报文的NAS-IP-Address、NAS-Port属性以及上送给DHCP服务器报文的Option82字段信息保持一致。这样在多机备份组内设备发生主备切换后不需要再进行认证操作。

3. 配置步骤

(1)     ‍进入系统视图。

system-view

(2)     创建多机备份实例并进入多机备份实例视图。

vsrp instance instance-name

(3)     配置在多机备份组内的备份ID。

backup id backup-id peer peer-name

缺省情况下,未配置在多机备份组内的备份ID。

(4)     配置绑定VRRP备份组。请选择其中一项进行配置。

¡     配置绑定IPv4 VRRP备份组。

bind vrrp vrid virtual-router-id interface interface-type interface-number

缺省情况下,未绑定IPv4 VRRP备份组。

¡     配置绑定IPv6 VRRP备份组。

bind vrrp ipv6 vrid virtual-router-id interface interface-type interface-number

缺省情况下,未绑定IPv6 VRRP备份组。

(5)     配置备份模式。

backup mode { hot | warm }

缺省情况下,备份模式为热备份。

(6)     (可选)配置备份时间间隔或流量阈值。

traffic backup { interval interval-value | threshold threshold-value } *

缺省情况下,备份时间间隔为10分钟,流量阈值为50MB。

(7)     (可选)配置NAS(Network Access Server,网络接入服务)参数。

nas { id host-name | ip ip-address | port interface-type interface-number }

缺省情况下,未配置NAS参数。

1.7  配置IPv6虚拟地址

1. 功能简介

在某些特殊组网中IPv6实现需要在业务作用的接口下配置IPv6虚拟地址功能:多机备份组中的主用设备和备用设备在相同的多机备份实例下需要配置相同的IPv6虚拟地址。主用设备会将该IPv6地址添加到RA报文中发送给用户,从而实现将用户的业务流量引导到主用设备的目的。在配置DHCPv6的多机备份功能时,必须与此功能配合使用。

2. 配置步骤

(1)     ‍进入系统视图。

system-view

(2)     进入接口视图。

interface interface-type interface-number

可支持三层以太网接口和VLAN接口。

(3)     配置IPv6虚拟地址,并绑定多机备份实例。

ipv6 virtual-address ipv6-address vsrp vsrp-instance

缺省情况下,接口上未手工配置的IPv6虚拟地址。

1.8  配置DHCPv4服务器支持多机备份功能

1.8.1  功能简介

两台DHCPv4服务器上存在相同的地址池信息,只有主用DHCPv4服务器才能为DHCP客户端分配地址租约;备用DHCPv4服务器不能为客户端分配租约,只能接收主用DHCPv4服务器发送过来的业务数据(包括合法租约和冲突租约)。关于DHCPv4的详细介绍,请参见“三层技术-IP业务”中的“DHCP”。

1.8.2  配置DHCPv4服务器地址池绑定的多机备份实例

(1)     ‍进入系统视图。

system-view

(2)     创建DHCP地址池,并进入地址池视图。

dhcp server ip-pool pool-name

(3)     配置DHCPv4服务器地址池绑定的多机备份实例。

vsrp-instance vsrp-instance-name

缺省情况下,DHCPv4服务器地址池未绑定多机备份实例。

配置地址池绑定多机备份实例,绑定的多机备份实例为主用状态时,该地址池所在的DHCPv4服务器为主用设备,否则地址池所在的DHCPv4服务器为备用设备。

1.8.3  配置接口绑定多机备份实例

1. 功能简介

配置DHCP服务器多机备份功能时,当用户连接的主用设备和备用设备的接口名不相同时,需要通过该命令进行主用设备和备用设备接口匹配。如果主用设备和备用设备连接用户的接口的接口名相同,则不需要再配置该命令。

2. 配置步骤

(1)     ‍进入系统视图。

system-view

(2)     进入接口视图。

interface interface-type interface-number

可支持三层以太网接口。

(3)     在DHCP服务器上连接DHCP客户端的接口绑定多机备份实例。

dhcp vsrp-instance vsrp-instance-name

缺省情况下,DHCP服务器上连接DHCP客户端的接口未绑定多机备份实例。

1.8.4  配置DHCPv4多机备份的业务数据TCP通道的端口号

1. 功能简介

在进行DHCPv4服务器的业务数据备份之前,主用和备用DHCPv4服务器之间需要先建立一条DHCPv4数据备份通道,此通道为TCP连接。通过下面的配置可以调整这个TCP连接使用的端口号,配置后设备不再使用之前的数据备份通道。

2. 配置限制和指导

主用设备和备用设备上配置的对应端口号必须一致,否则TCP连接将建立失败,数据备份通道不通。

3. 配置步骤

(1)     ‍进入系统视图。

system-view

(2)     配置DHCPv4服务器数据备份通道的TCP端口号。

dhcp vsrp port port-number

缺省情况下,DHCPv4服务器数据备份通道的TCP端口号为60037。

主用设备和备用设备上配置的对应端口号必须一致,否则TCP连接将建立失败,数据备份通道不通。

1.9  配置DHCPv6服务器支持多机备份功能

1.9.1  功能简介

两台DHCPv6服务器上存在相同的地址池信息,只有主用DHCPv6服务器才能为DHCPv6客户端分配地址租约;备用DHCPv6服务器不能为客户端分配租约,只能接收主用DHCPv6服务器发送过来的业务数据(包括合法租约,冲突租约)。关于DHCPv6的详细介绍,请参见“三层技术-IP业务”中的“DHCPv6”。

配置地址池绑定多机备份实例,绑定的多机备份实例为主用状态时,该地址池所在的DHCPv6服务器为主用设备,否则该地址池所在的DHCPv6服务器为备用设备。

1.9.2  配置限制和指导

开启DHCPv6服务器支持多机备份功能要求需生成DHCPv6服务器使用的虚拟DUID。如果不配置该命令,DHCPv6服务器缺省使用本设备的实际DUID。这样会导致多机备份功能主用设备和备用设备切换后,DHCPv6客户端无法正常续约和释放DHCPv6地址。

1.9.3  配置DHCPv6服务器地址池绑定的多机备份实例

(1)     ‍进入系统视图。

system-view

(2)     创建DHCPv6地址池,并进入DHCPv6地址池视图。

ipv6 dhcp pool pool-name

(3)     配置DHCPv6服务器地址池绑定的多机备份实例。

vsrp-instance vsrp-instance-name

缺省情况下,DHCPv6服务器地址池未绑定多机备份实例。

(4)     指定DHCPv6服务器使用的虚拟DUID。

virtual-duid { enterprise-number enterprise-number identifier identifier | hardware-type hardware-type address address }

缺省情况下,未指定DHCPv6服务器使用的虚拟DUID,DHCPv6服务器使用实际DUID。

1.9.4  配置接口绑定的多机备份实例

1. 功能简介

配置DHCPv6服务器多机备份功能时,当用户连接的主用设备和备用设备的接口名不相同时,需要通过该命令进行主用设备和备用设备接口匹配。如果主用设备和备用设备连接用户的接口的接口名相同,则不需要再配置该命令。

主用设备和备用设备认为连接同一个用户的接口的接口名相同,通过接口名进行接口匹配。

2. 配置步骤

(1)     ‍进入系统视图。

system-view

(2)     进入接口视图。

interface interface-type interface-number

可支持三层以太网接口。

(3)     在DHCPv6服务器上连接DHCPv6客户端的接口绑定的多机备份实例。

ipv6 dhcp vsrp-instance vsrp-instance-name

缺省情况下,DHCPv6服务器上连接DHCPv6客户端的接口未绑定多机备份实例。

1.9.5  配置DHCPv6多机备份的业务数据TCP通道的端口号

1. 功能简介

在进行DHCPv6服务器的业务数据备份之前,主用和备用DHCPv6服务器之间需要先建立一条DHCPv6数据备份通道,此通道为TCP连接。通过下面的配置可以调整这个TCP连接使用的端口号,配置后不再使用之前的数据备份通道。

2. 配置限制和指导

主用设备和备用设备上配置的对应端口号必须一致,否则TCP连接将建立失败,数据备份通道不通。

3. 配置步骤

(1)     进入系统视图。

system-view

(2)     配置DHCPv6 服务器数据备份通道的TCP端口号。

ipv6 dhcp vsrp port port-number

缺省情况下,DHCPv6 数据备份通道的TCP端口号为60039。

主用设备和备用设备上配置的对应端口号必须一致,否则TCP连接将建立失败,数据备份通道不通。

1.10  多机备份显示和维护

在完成上述配置后,在任意视图下执行display命令可以显示配置后多机备份功能的运行情况,通过查看显示信息验证配置的效果。

表1-1 多机备份显示和维护

操作

命令

显示多机备份实例信息

display vsrp instance [ instance-name ]

 

1.11  业务的多机备份功能配置举例

1.11.1  DHCP server横连双机备份配置举例(DHCP server+MSTP+VRRP+VSRP)

1. 组网需求

图1-2所示的场景中,接入层设备双归接入汇聚层设备。考虑到组网可靠性:

·     Device A和Device B采用二层聚合接口互联以及下行。

·     Device A和Device B组建VRRP备份组,作为内网的网关。

·     需要在组网中部署链路冗余,使得Device C的上行流量能够在两条上行链路上进行负载分担,将来自Host A(属于VLAN 20)的流量发往Device A、将来自Host B(属于VLAN 30)的流量发往Device B。

·     能够在一条上行链路断开时,所有流量都能够切换到另一条上行链路上转发。

·     需要避免冗余部署带来的二层网络环路问题。

图1-2 DHCP server多机备份配置组网图

本举例中的IP地址规划如表1-2所示。

表1-2 数据规划表

配置项

数据

Device A

VLAN-interface 20

GE 1/0/3、GE 1/0/4、GE 1/0/5和GE 1/0/6允许VLAN 20通过,VLAN接口20的IP地址为10.1.20.2/24

VLAN接口20开启DHCP server功能,可分配的网段为10.1.20.0/24,可分配的IP地址区间为10.1.20.10~10.1.20.250

VLAN-interface 30

GE 1/0/3、GE 1/0/4、GE 1/0/5和GE 1/0/6允许VLAN 30通过,VLAN接口30的IP地址为10.1.30.2/24

VLAN接口30开启DHCP server功能,可分配的网段为10.1.30.0/24,可分配的IP地址区间为10.1.30.10~10.1.30.250

Device B

VLAN-interface 20

GE 1/0/3、GE 1/0/4、GE 1/0/5和GE 1/0/6允许VLAN 20通过,VLAN接口20的IP地址为10.1.20.3/24

VLAN接口20开启DHCP server功能,可分配的网段为10.1.20.0/24,可分配的IP地址区间为10.1.20.10~10.1.20.250

VLAN-interface 30

GE 1/0/3、GE 1/0/4、GE 1/0/5和GE 1/0/6允许VLAN 30通过,VLAN接口30的IP地址为10.1.30.3/24

VLAN接口30开启DHCP server功能,可分配的网段为10.1.30.0/24,可分配的IP地址区间为10.1.30.10~10.1.30.250

 

2. 配置思路

·     在Device A、Device B和Device C之间部署MSTP,消除网络中的环路,并通过划分生成树实例,使得VLAN 20和VLAN 30的网络拓扑不同。

·     在Devcie A和Device B上部署VRRP,实现链路的冗余备份,并通过创建多个VRRP备份组来实现三层流量的负载分担。

¡     VRRP备份组forvlan20虚拟IP地址为10.1.20.1/24,作为VLAN 20内主机的网关。VRRP备份组forvlan20中Device A为Master,Device B为Backup。

¡     VRRP备份组forvlan30虚拟IP地址为10.1.30.1/24,作为VLAN 30内主机的网关。VRRP备份组forvlan20中Device A为Backup,Device B为Master。

·     分别在Devcie A和Device B部署地址池20,给VLAN 20内的设备分配IP地址;部署地址池30,给VLAN 30内的设备分配IP地址。

·     分别在Devcie A和Device B部署VSRP(多机备份),来实现DHCP地址池的双机热备。

3. 配置注意事项

在本配置中,所有设备的以太网接口都需要工作在二层模式,如果未工作在二层模式,请执行port link-mode bridge命令将以太网接口切换到二层工作模式,

4. 在Device A上配置MSTP

(1)     配置二层聚合接口

# 配置二层聚合接口2,绑定物理接口GigabitEthernet1/0/3和GigabitEthernet1/0/4,用于横连Device B;配置二层聚合接口3,绑定物理接口GigabitEthernet1/0/5和GigabitEthernet1/0/6,用于下行连接Device C。

<DeviceA> system-view

[DeviceA] interface bridge-aggregation 2

[DeviceA-Bridge-Aggregation2] quit

[DeviceA] interface range gigabitethernet 1/0/3 gigabitethernet 1/0/4

[DeviceA-if-range] port link-aggregation group 2

[DeviceA-if-range] undo shutdown

[DeviceA-if-range] quit

[DeviceA] interface bridge-aggregation 3

[DeviceA-Bridge-Aggregation3] quit

[DeviceA] interface range gigabitethernet 1/0/5 gigabitethernet 1/0/6

[DeviceA-if-range] port link-aggregation group 3

[DeviceA-if-range] undo shutdown

[DeviceA-if-range] quit

# 创建VLAN 20、30。配置二层聚合接口2为动态聚合模式,配置接口的链路类型配置为Trunk,允许VLAN 20和30通过;配置二层聚合接口3为动态聚合模式,配置接口的链路类型配置为Trunk,允许VLAN 20和30通过。

[DeviceA] vlan 20 30

[DeviceA] interface bridge-aggregation 2

[DeviceA-Bridge-Aggregation2] link-aggregation mode dynamic

[DeviceA-Bridge-Aggregation2] port link-type trunk

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceA-Bridge-Aggregation2] port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceA-Bridge-Aggregation2] undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceA-Bridge-Aggregation2] quit

[DeviceA] interface bridge-aggregation 3

[DeviceA-Bridge-Aggregation3] link-aggregation mode dynamic

[DeviceA-Bridge-Aggregation3] port link-type trunk

Configuring GigabitEthernet1/0/5 done.

Configuring GigabitEthernet1/0/6 done.

[DeviceA-Bridge-Aggregation3] port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/5 done.

Configuring GigabitEthernet1/0/6 done.

[DeviceA-Bridge-Aggregation3] undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/5 done.

Configuring GigabitEthernet1/0/6 done.

[DeviceA-Bridge-Aggregation3] quit

(2)     配置MSTP参数

# 配置MST域。

[DeviceA] stp region-configuration

[DeviceA-mst-region] region-name reg

[DeviceA-mst-region] instance 20 vlan 20

[DeviceA-mst-region] instance 30 vlan 30

# 激活MST域的配置。

[DeviceA-mst-region] active region-configuration

[DeviceA-mst-region] quit

# 配置Device A为MSTI 20的根桥、MSTI 30的备份根桥。

[DeviceA] stp instance 20 root primary

[DeviceA] stp instance 30 root secondary

# 在下行接口二层聚合接口3上开启根保护功能,避免其他设备非法抢占根。

[DeviceA] interface bridge-aggregation 3

[DeviceA-Bridge-Aggregation3] stp root-protection

[DeviceA-Bridge-Aggregation3] quit

# 配置生成树协议的模式为MSTP,并全局开启生成树协议。

[DeviceA] stp mode mstp

[DeviceA] stp global enable

5. 在Device B上配置MSTP

(1)     配置二层聚合接口

# 配置二层聚合接口2,绑定物理接口GigabitEthernet1/0/3和GigabitEthernet1/0/4,用于横连Device A;配置二层聚合接口3,绑定物理接口GigabitEthernet1/0/5和GigabitEthernet1/0/6,用于下行连接Device C。

<DeviceB> system-view

[DeviceB] interface bridge-aggregation 2

[DeviceB-Bridge-Aggregation2] quit

[DeviceB] interface range gigabitethernet 1/0/3 gigabitethernet 1/0/4

[DeviceB-if-range] port link-aggregation group 2

[DeviceB-if-range] undo shutdown

[DeviceB-if-range] quit

[DeviceB] interface bridge-aggregation 3

[DeviceB-Bridge-Aggregation3] quit

[DeviceB] interface range gigabitethernet 1/0/5 gigabitethernet 1/0/6

[DeviceB-if-range] port link-aggregation group 3

[DeviceB-if-range] undo shutdown

[DeviceB-if-range] quit

# 创建VLAN 20、30。配置二层聚合接口2为动态聚合模式,的链路类型配置为Trunk,允许VLAN 20和30通过;配置二层聚合接口3为动态聚合模式,的链路类型配置为Trunk,允许VLAN 20和30通过。

[DeviceB] vlan 20 30

[DeviceB] interface bridge-aggregation 2

[DeviceB-Bridge-Aggregation2] link-aggregation mode dynamic

[DeviceB-Bridge-Aggregation2] port link-type trunk

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceB-Bridge-Aggregation2] port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceB-Bridge-Aggregation2] undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceB-Bridge-Aggregation2] quit

[DeviceB] interface bridge-aggregation 3

[DeviceB-Bridge-Aggregation3] link-aggregation mode dynamic

[DeviceB-Bridge-Aggregation3] port link-type trunk

Configuring GigabitEthernet1/0/5 done.

Configuring GigabitEthernet1/0/6 done.

[DeviceB-Bridge-Aggregation3] port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/5 done.

Configuring GigabitEthernet1/0/6 done.

[DeviceB-Bridge-Aggregation3] undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/5 done.

Configuring GigabitEthernet1/0/6 done.

[DeviceB-Bridge-Aggregation3] quit

(2)     配置MSTP参数

# 配置MST域。

[DeviceB] stp region-configuration

[DeviceB-mst-region] region-name reg

[DeviceB-mst-region] instance 20 vlan 20

[DeviceB-mst-region] instance 30 vlan 30

# 激活MST域的配置。

[DeviceB-mst-region] active region-configuration

[DeviceB-mst-region] quit

# 配置Device B为MSTI 30的根桥、MSTI 20的备份根桥。

[DeviceB] stp instance 30 root primary

[DeviceB] stp instance 20 root secondary

# 在端口下行接口二层聚合接口3上开启根保护功能,避免其他设备非法抢占根。

[DeviceB] interface bridge-aggregation 3

[DeviceB-Bridge-Aggregation3] stp root-protection

[DeviceB-Bridge-Aggregation3] quit

# 配置生成树协议的模式为MSTP,并全局开启生成树协议。

[DeviceB] stp mode mstp

[DeviceB] stp global enable

6. 在Device C上配置MSTP

(1)     配置二层聚合接口作为上行接口

# 配置聚合接口1,绑定物理接口GigabitEthernet1/0/1和GigabitEthernet1/0/2,用于上行连接Device A;配置聚合接口2,绑定物理接口GigabitEthernet1/0/3和GigabitEthernet1/0/4,用于上行连接Device B。

<DeviceC> system-view

[DeviceC] vlan 20 30

[DeviceC] interface bridge-aggregation 1

[DeviceC-Bridge-Aggregation1] quit

[DeviceC] interface range gigabitethernet 1/0/1 gigabitethernet 1/0/2

[DeviceC-if-range] port link-aggregation group 1

[DeviceC-if-range] undo shutdown

[DeviceC-if-range] quit

[DeviceC] interface bridge-aggregation 1

[DeviceC-Bridge-Aggregation1] link-aggregation mode dynamic

[DeviceC-Bridge-Aggregation1] port link-type trunk

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceC-Bridge-Aggregation1] port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceC-Bridge-Aggregation1] undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceC-Bridge-Aggregation1] quit

[DeviceC] interface bridge-aggregation 2

[DeviceC-Bridge-Aggregation2] quit

[DeviceC] interface range gigabitethernet 1/0/3 gigabitethernet 1/0/4

[DeviceC-if-range] port link-aggregation group 2

[DeviceC-if-range] undo shutdown

[DeviceC-if-range] quit

[DeviceC] interface bridge-aggregation 2

[DeviceC-Bridge-Aggregation2] link-aggregation mode dynamic

[DeviceC-Bridge-Aggregation2] port link-type trunk

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceC-Bridge-Aggregation2] port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceC-Bridge-Aggregation2] undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceC-Bridge-Aggregation2] quit

(2)     配置下行接口GigabitEthernet1/0/5和GigabitEthernet1/0/6

# 将端口GigabitEthernet1/0/5的链路类型配置为Access,并允许VLAN 20通过。

[DeviceC] interface gigabitethernet 1/0/5

[DeviceC-GigabitEthernet1/0/5] port link-type access

[DeviceC-GigabitEthernet1/0/5] port access vlan 20

[DeviceC-GigabitEthernet1/0/5] undo shutdown

[DeviceC-GigabitEthernet1/0/5] quit

# 将端口GigabitEthernet1/0/6的链路类型配置为Access,并允许VLAN 30通过。

[DeviceC] interface gigabitethernet 1/0/6

[DeviceC-GigabitEthernet1/0/6] port link-type access

[DeviceC-GigabitEthernet1/0/6] port access vlan 30

[DeviceC-GigabitEthernet1/0/6] undo shutdown

[DeviceC-GigabitEthernet1/0/6] quit

(3)     配置MSTP参数

# 配置MST域。

[DeviceC] stp region-configuration

[DeviceC-mst-region] region-name reg

[DeviceC-mst-region] instance 20 vlan 20

[DeviceC-mst-region] instance 30 vlan 30

# 激活MST域的配置。

[DeviceC-mst-region] active region-configuration

[DeviceC-mst-region] quit

# 配置将GigabitEthernet1/0/5和GigabitEthernet1/0/6配置为边缘端口,并开启BPDU保护功能以免边缘端口收到BPDU影响生成树拓扑计算。

[DeviceC] interface range gigabitethernet 1/0/5 to gigabitethernet 1/0/6

[DeviceC-if-range] stp edged-port

Edge port should only be connected to terminal. It will cause temporary loops if port GigabitEthernet1/0/5 is connected to bridges. Please use it carefully.

Edge port should only be connected to terminal. It will cause temporary loops if port GigabitEthernet1/0/6 is connected to bridges. Please use it carefully.

[DeviceC-if-range] stp port bpdu-protection enable

[DeviceC-if-range] quit

# 配置生成树协议的模式为MSTP,并全局开启生成树协议。

[DeviceC] stp mode mstp

[DeviceC] stp global enable

7. 在Device A上配置VRRP

# 创建VLAN接口20,并配置IP地址为10.1.20.2/24。创建VRRP备份组20,该备份组的虚拟IP地址为10.1.20.1。Device A在该备份组1中的优先级为120,成为Master设备,并工作在抢占模式,抢占延迟时间为90000厘秒(15分钟)。

[DeviceA] interface vlan-interface 20

[DeviceA-Vlan-interface20] ip address 10.1.20.2 24

[DeviceA-Vlan-interface20] vrrp vrid 20 virtual-ip 10.1.20.1

[DeviceA-Vlan-interface20] vrrp vrid 20 priority 120

[DeviceA-Vlan-interface20] vrrp vrid 20 preempt-mode delay 90000

[DeviceA-Vlan-interface20] quit

# 创建VLAN接口30,并配置IP地址为10.1.30.2/24。创建VRRP备份组30,该备份组的虚拟IP地址为10.1.30.1。

[DeviceA] interface vlan-interface 30

[DeviceA-Vlan-interface30] ip address 10.1.30.2 24

[DeviceA-Vlan-interface30] vrrp vrid 30 virtual-ip 10.1.30.1

[DeviceA-Vlan-interface30] quit

8. 在Device B上配置VRRP

# 创建VLAN接口20,并配置IP地址为10.1.20.3/24。创建VRRP备份组20,该备份组的虚拟IP地址为10.1.20.1。

[DeviceB] interface vlan-interface 20

[DeviceB-Vlan-interface20] ip address 10.1.20.3 24

[DeviceB-Vlan-interface20] vrrp vrid 20 virtual-ip 10.1.20.1

[DeviceB-Vlan-interface20] quit

# 创建VLAN接口30,并配置IP地址为10.1.30.3/24。创建VRRP备份组30,该备份组的虚拟IP地址为10.1.30.1。Device B在该备份组30中的优先级为120,成为Master设备,并工作在抢占模式,抢占延迟时间为90000厘秒(15分钟)。

[DeviceB-Vlan-interface20] interface vlan-interface 30

[DeviceB-Vlan-interface30] ip address 10.1.30.3 24

[DeviceB-Vlan-interface30] vrrp vrid 30 virtual-ip 10.1.30.1

[DeviceB-Vlan-interface30] vrrp vrid 30 priority 120

[DeviceB-Vlan-interface30] vrrp vrid 30 preempt-mode delay 90000

[DeviceB-Vlan-interface30] quit

9. 在Device A上配置VSRP

(1)     配置多机备份实例forvlan20,用于备份VLAN 20的地址池。

# 创建名字为forvlan20的多机备份对端,并进入多机备份对端视图。配置多机备份对端地址为10.1.20.3,本地地址为10.1.20.2。

[DeviceA] vsrp peer forvlan20

[DeviceA-vsrp-peer-forvlan20] peer 10.1.20.3 local 10.1.20.2

[DeviceA-vsrp-peer-forvlan20] quit

# 创建名字为forvlan20的多机备份实例,并进入多机备份实例视图。配置备份ID为1,关联的多机备份对端名称为forvlan20。配置多机备份实例forvlan20绑定VLAN接口20上的VRRP备份组20。

[DeviceA] vsrp instance forvlan20

[DeviceA-vsrp-instance-forvlan20] backup id 1 peer forvlan20

[DeviceA-vsrp-instance-forvlan20] bind vrrp vrid 20 interface Vlan-interface 20

[DeviceA-vsrp-instance-forvlan20] quit

[DeviceA] interface vlan-interface 20

[DeviceA-Vlan-interface20] dhcp vsrp forvlan20

[DeviceA-Vlan-interface20] quit

(2)     配置多机备份实例forvlan30,用于备份VLAN 30的地址池。

# 创建名字为forvlan30的多机备份对端,并进入多机备份对端视图。配置多机备份对端地址为10.1.30.3,本地地址为10.1.30.2。

[DeviceA] vsrp peer forvlan30

[DeviceA-vsrp-peer-forvlan30] peer 10.1.30.3 local 10.1.30.2

[DeviceA-vsrp-peer-forvlan30] quit

# 创建名字为forvlan30的多机备份实例,并进入多机备份实例视图。配置备份ID为1,关联的多机备份对端名称为forvlan30。配置多机备份实例forvlan30绑定VLAN接口30上的VRRP备份组30。

[DeviceA] vsrp instance forvlan30

[DeviceA-vsrp-instance-forvlan30] backup id 1 peer forvlan30

[DeviceA-vsrp-instance-forvlan30] bind vrrp vrid 30 interface Vlan-interface 30

[DeviceA-vsrp-instance-forvlan30] quit

[DeviceA] interface vlan-interface 30

[DeviceA-Vlan-interface30] dhcp vsrp forvlan30

[DeviceA-Vlan-interface30] quit

10. 在Device B上配置VSRP

(1)     配置多机备份实例forvlan20,用于备份VLAN 20的地址池。

# 创建名字为forvlan20的多机备份对端,并进入多机备份对端视图。配置多机备份对端地址为10.1.20.2,本地地址为10.1.20.3。

[DeviceB] vsrp peer forvlan20

[DeviceB-vsrp-peer-forvlan20] peer 10.1.20.2 local 10.1.20.3

[DeviceB-vsrp-peer-forvlan20] quit

# 创建名字为forvlan20的多机备份实例,并进入多机备份实例视图。配置备份ID为1,关联的多机备份对端名称为forvlan20。配置多机备份实例forvlan20绑定VLAN接口20上的VRRP备份组20。

[DeviceB] vsrp instance forvlan20

[DeviceB-vsrp-instance-forvlan20] backup id 1 peer forvlan20

[DeviceB-vsrp-instance-forvlan20] bind vrrp vrid 20 interface Vlan-interface 20

[DeviceB-vsrp-instance-forvlan20] quit

[DeviceB] interface vlan-interface 20

[DeviceB-Vlan-interface20] dhcp vsrp forvlan20

[DeviceB-Vlan-interface20] quit

(2)     配置多机备份实例forvlan30,用于备份VLAN 30的地址池。

# 创建名字为forvlan30的多机备份对端,并进入多机备份对端视图。配置多机备份本地地址为10.1.30.3,对端地址为10.1.30.2。

[DeviceB] vsrp peer forvlan30

[DeviceB-vsrp-peer-forvlan30] peer 10.1.30.2 local 10.1.30.3

[DeviceB-vsrp-peer-forvlan30] quit

# 创建名字为forvlan30的多机备份实例,并进入多机备份实例视图。配置备份ID为1,关联的多机备份对端名称为forvlan30。配置多机备份实例forvlan30绑定VLAN接口30上的VRRP备份组30。

[DeviceB] vsrp instance forvlan30

[DeviceB-vsrp-instance-forvlan30] backup id 1 peer forvlan30

[DeviceB-vsrp-instance-forvlan30] bind vrrp vrid 30 interface Vlan-interface 30

[DeviceB-vsrp-instance-forvlan30] quit

[DeviceB] interface vlan-interface 30

[DeviceB-Vlan-interface30] dhcp vsrp forvlan30

[DeviceB-Vlan-interface30] quit

11. 在Device A上配置DHCP地址池

(1)     配置地址池20,为VLAN 20内的设备分配IP地址。

# 配置地址池20,网段为10.1.20.0/24,可动态分配的IP地址为10.1.20.10~10.1.20.250,其它地址预留给服务器等设备使用。网关为备份组VRRP备份组20的虚拟IP地址10.1.20.1。

[DeviceA] dhcp server ip-pool 20

[DeviceA-dhcp-pool-20] network 10.1.20.0 mask 255.255.255.0

[DeviceA-dhcp-pool-20] address range 10.1.20.10 10.1.20.250

[DeviceA-dhcp-pool-20] expired day 30

[DeviceA-dhcp-pool-20] dns-list 10.1.20.1

[DeviceA-dhcp-pool-20] gateway-list 10.1.20.1

[DeviceA-dhcp-pool-20] vsrp-instance forvlan20

[DeviceA-dhcp-pool-20] quit

[DeviceA] interface vlan-interface 20

[DeviceA-Vlan-interface20] dhcp select server

[DeviceA-Vlan-interface20] quit

(2)     配置地址池30,为VLAN 30内的设备分配IP地址。

# 配置地址池30,网段为10.1.30.0/24,可动态分配的IP地址为10.1.30.10~10.1.30.250,其它地址预留给服务器等设备使用。网关为备份组VRRP备份组30的虚拟IP地址10.1.30.1。

[DeviceA] dhcp server ip-pool 30

[DeviceA-dhcp-pool-30] network 10.1.30.1 mask 255.255.255.0

[DeviceA-dhcp-pool-30] address range 10.1.30.10 10.1.30.250

[DeviceA-dhcp-pool-30] expired day 30

[DeviceA-dhcp-pool-30] dns-list 10.1.30.1

[DeviceA-dhcp-pool-30] gateway-list 10.1.30.1

[DeviceA-dhcp-pool-30] vsrp-instance forvlan30

[DeviceA-dhcp-pool-30] quit

[DeviceA] interface vlan-interface 30

[DeviceA-Vlan-interface30] dhcp select server

[DeviceA-Vlan-interface30] quit

(3)     全局开启DHCP功能。

[DeviceA] dhcp enable

[DeviceA] dhcp server request-ip-address check

12. 在Device B上配置DHCP地址池

(1)     配置地址池20,为VLAN 20内的设备分配IP地址。

# 配置地址池20,网段为10.1.20.0/24,可动态分配的IP地址为10.1.20.10~10.1.20.250,其它地址预留给服务器等设备使用。网关为备份组VRRP备份组20的虚拟IP地址10.1.20.1。

[DeviceB] dhcp server ip-pool 20

[DeviceB-dhcp-pool-20] network 10.1.20.0 mask 255.255.255.0

[DeviceB-dhcp-pool-20] address range 10.1.20.10 10.1.20.250

[DeviceB-dhcp-pool-20] expired day 30

[DeviceB-dhcp-pool-20] dns-list 10.1.20.1

[DeviceB-dhcp-pool-20] gateway-list 10.1.20.1

[DeviceB-dhcp-pool-20] vsrp-instance forvlan20

[DeviceB-dhcp-pool-20] quit

[DeviceB] interface vlan-interface 20

[DeviceB-Vlan-interface20] dhcp select server

[DeviceB-Vlan-interface20] quit

(2)     配置地址池30,为VLAN 30内的设备分配IP地址。

# 配置地址池30,网段为10.1.30.0/24,可动态分配的IP地址为10.1.30.10~10.1.30.250,其它地址预留给服务器等设备使用。网关为备份组VRRP备份组30的虚拟IP地址10.1.30.1。

[DeviceB] dhcp server ip-pool 30

[DeviceB-dhcp-pool-30] network 10.1.30.1 mask 255.255.255.0

[DeviceB-dhcp-pool-30] address range 10.1.30.10 10.1.30.250

[DeviceB-dhcp-pool-30] expired day 30

[DeviceB-dhcp-pool-30] dns-list 10.1.30.1

[DeviceB-dhcp-pool-30] gateway-list 10.1.30.1

[DeviceB-dhcp-pool-30] vsrp-instance forvlan30

[DeviceB-dhcp-pool-30] quit

[DeviceB] interface vlan-interface 30

[DeviceB-Vlan-interface30] dhcp select server

[DeviceB-Vlan-interface30] quit

(3)     全局开启DHCP功能。

[DeviceB] dhcp enable

[DeviceB] dhcp server request-ip-address check

13. 配置Host

(1)     在Host A上,配置自动获取IP地址,缺省网关为10.1.20.1。(具体步骤略)

(2)     在Host B上,配置自动获取IP地址,缺省网关为10.1.30.1。(具体步骤略)

14. 验证MSTP配置

说明

因为本举例涉及多个特性,建议完成一项功能的配置后,先验证这个功能是否运行正常,如果不正常,先定位解决问题。再配置下一个功能。例如,先配置并验证MSTP之后,再配置并验证VRRP。

 

(1)     在Device A上验证MSTP。

Device A上的所有端口应该处于转发状态,二层聚合接口2应该为MSTP实例30的根端口。

[DeviceA] display stp brief

 MST ID   Port                                Role  STP State   Protection

 0        Bridge-Aggregation2                 DESI  FORWARDING  NONE

 0        Bridge-Aggregation3                 DESI  FORWARDING  NONE

 20       Bridge-Aggregation2                 DESI  FORWARDING  NONE

 20       Bridge-Aggregation3                 DESI  FORWARDING  NONE

 30       Bridge-Aggregation2                 ROOT  FORWARDING  NONE

 30       Bridge-Aggregation3                 DESI  FORWARDING  NONE

(2)     在Device B上验证MSTP

Device B上的所有端口应该处于转发状态,二层聚合接口2应该为MSTP实例20的根端口。

[DeviceB] display stp brief

 MST ID   Port                                Role  STP State   Protection

 0        Bridge-Aggregation2                 ROOT  FORWARDING  NONE

 0        Bridge-Aggregation3                 DESI  FORWARDING  NONE

 20       Bridge-Aggregation2                 ROOT  FORWARDING  NONE

 20       Bridge-Aggregation3                 DESI  FORWARDING  NONE

 30       Bridge-Aggregation2                 DESI  FORWARDING  NONE

 30       Bridge-Aggregation3                 DESI  FORWARDING  NONE

(3)     在Device C上验证MSTP

Device C上二层聚合接口2应该为MSTP实例20的阻塞端口,二层聚合接口1应该为MSTP实例30的阻塞端口。

[DeviceC] display stp brief

 MST ID   Port                                Role  STP State   Protection

 0        Bridge-Aggregation1                 ROOT  FORWARDING  NONE

 0        Bridge-Aggregation2                 ALTE  DISCARDING  NONE

 0        GigabitEthernet1/0/5                DESI  FORWARDING  NONE

 20       Bridge-Aggregation1                 ROOT  FORWARDING  NONE

 20       Bridge-Aggregation2                 ALTE  DISCARDING  NONE

 20       GigabitEthernet1/0/5                DESI  FORWARDING  NONE

 30       Bridge-Aggregation1                 ALTE  DISCARDING  NONE

 30       Bridge-Aggregation2                 ROOT  FORWARDING  NONE

15. 验证VRRP配置

(1)     在Device A上验证VRRP。

Device A在VRRP备份组20中应该为Master,在VRRP备份组30中应该为Backup。

[DeviceA] display vrrp

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 2

 Interface          VRID  State        Running Adver   Auth             Virtual

                                       Pri     Timer   Type                IP

 ----------------------------------------------------------------------------

 Vlan20             20    Master       120     100     Not supported    10.1.20.1

 Vlan30             30    Backup       100     100     Not supported    10.1.30.1

(2)     在Device B上验证VRRP。

Device B在VRRP备份组20中应该为Backup,在VRRP备份组30中应该为Master。

[DeviceB] display vrrp

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 2

 Interface          VRID  State        Running Adver   Auth             Virtual

                                       Pri     Timer   Type                IP

 ----------------------------------------------------------------------------

 Vlan20             20    Backup       100     100     Not supported    10.1.20.1

 Vlan30             30    Master       120     100     Not supported    10.1.30.1

16. 验证DHCP地址池备份效果

禁用Host A的网卡,再启用Host A的网卡,可以在Device A给Host A分配了IP地址10.1.20.10,Device B上也可以查询到该信息。查看Device A和Device B的VSRP日志记录,可以发现,Device A将DHCP地址信息备份给了Device B。

[DeviceA] display dhcp server ip-in-use

IP address       Client-identifier/    Lease expiration      Type

                 Hardware address

10.1.20.10       0108-0027-0038-f1     Jun 29 17:09:10 2024  Auto(C)

[DeviceB] display dhcp server ip-in-use

IP address       Client-identifier/    Lease expiration      Type

                 Hardware address

10.1.20.10       0108-0027-0038-f1     Jun 29 17:08:38 2024  Auto(C)

1.11.2  DHCP server跨三层设备互联双机备份配置举例(DHCP server+三层网络+VRRP+VSRP)

1. 组网需求

图1-3所示的场景中,接入层设备双归接入汇聚层设备Device A和Device B。Device A和Device B通过三层接口连接Device D,考虑到组网可靠性:

·     Device A和Device B采用二层聚合接口下行。

·     Device A和Device B组建VRRP备份组,作为内网的网关。

·     需要在组网中部署链路冗余,使得Device C的上行流量能够在两条上行链路上进行负载分担,将来自Host A(属于VLAN 20)的流量发往Device A、将来自Host B(属于VLAN 30)的流量发往Device B。

·     能够在一条上行链路断开时,所有流量都能够切换到另一条上行链路上转发。

图1-3 DHCP server跨三层设备互联双机备份配置举例组网图

本举例中的IP地址规划如表1-3所示。

表1-3 数据规划表

配置项

数据

Device A

VLAN-interface 20

GE 1/0/3、GE 1/0/4、GE 1/0/5和GE 1/0/6允许VLAN 20通过,VLAN接口20的IP地址为10.1.20.2/24

VLAN接口20开启DHCP server功能,可分配的网段为10.1.20.0/24,可分配的IP地址区间为10.1.20.10~10.1.20.250

VLAN-interface 30

GE 1/0/3、GE 1/0/4、GE 1/0/5和GE 1/0/6允许VLAN 30通过,VLAN接口30的IP地址为10.1.30.2/24

VLAN接口30开启DHCP server功能,可分配的网段为10.1.30.0/24,可分配的IP地址区间为10.1.30.10~10.1.30.250

Device B

VLAN-interface 20

GE 1/0/3、GE 1/0/4、GE 1/0/5和GE 1/0/6允许VLAN 20通过,VLAN接口20的IP地址为10.1.20.3/24

VLAN接口20开启DHCP server功能,可分配的网段为10.1.20.0/24,可分配的IP地址区间为10.1.20.10~10.1.20.250

VLAN-interface 30

GE 1/0/3、GE 1/0/4、GE 1/0/5和GE 1/0/6允许VLAN 30通过,VLAN接口30的IP地址为10.1.30.3/24

VLAN接口30开启DHCP server功能,可分配的网段为10.1.30.0/24,可分配的IP地址区间为10.1.30.10~10.1.30.250

 

2. 配置思路

·     在Device A、Device B和Device D之间部署OSPF,使得它们之间路由可达。

·     在Devcie A和Device B上部署VRRP,实现链路的冗余备份,并通过创建多个VRRP备份组来实现三层流量的负载分担。

¡     VRRP备份组forvlan20虚拟IP地址为10.1.20.1/24,作为VLAN 20内主机的网关。VRRP备份组forvlan20中Device A为Master,Device B为Backup。

¡     VRRP备份组forvlan30虚拟IP地址为10.1.30.1/24,作为VLAN 30内主机的网关。VRRP备份组forvlan20中Device A为Backup,Device B为Master。

·     分别在Devcie A和Device B部署地址池20,给VLAN 20内的设备分配IP地址;部署地址池30,给VLAN 30内的设备分配IP地址。

·     分别在Devcie A和Device B部署VSRP(多机备份),来实现DHCP地址池的双机热备。

3. 配置注意事项

在本配置中,所有设备的以太网接口都需要工作在二层模式,如果未工作在二层模式,请执行port link-mode bridge命令将以太网接口切换到二层工作模式,

4. 在Device A上配置VRRP

(1)     配置二层聚合接口

# 配置二层聚合接口1,绑定物理接口Ten-GigabitEthernet1/0/1和Ten-GigabitEthernet1/0/1,用于下行连接Device C。

<DeviceA>system-view

System View: return to User View with Ctrl+Z.

[DeviceA]interface bridge-aggregation 1

[DeviceA-Bridge-Aggregation1]quit

[DeviceA]interface range ten-gigabitethernet 1/0/1 ten-gigabitethernet 1/0/2

[DeviceA-if-range]port link-aggregation group 1

[DeviceA-if-range]undo shutdown

[DeviceA-if-range]quit

# 创建VLAN 20、30。配置二层聚合接口1为动态聚合模式,的链路类型配置为Trunk,允许VLAN 20和30通过。

[DeviceA]vlan 20 30

[DeviceA]interface bridge-aggregation 1

[DeviceA-Bridge-Aggregation1]link-aggregation mode dynamic

[DeviceA-Bridge-Aggregation1]port link-type trunk

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceA-Bridge-Aggregation1]port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceA-Bridge-Aggregation1]undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceA-Bridge-Aggregation1]quit

(2)     配置VRRP功能

# 创建VLAN接口20,并配置IP地址为10.1.20.2/24。创建VRRP备份组20,该备份组的虚拟IP地址为10.1.20.1。Device A在该备份组1中的优先级为120,成为Master设备,并工作在抢占模式,抢占延迟时间为90000厘秒(15分钟)。

[DeviceA] interface vlan-interface 20

[DeviceA-Vlan-interface20] ip address 10.1.20.2 24

[DeviceA-Vlan-interface20] vrrp vrid 20 virtual-ip 10.1.20.1

[DeviceA-Vlan-interface20] vrrp vrid 20 priority 120

[DeviceA-Vlan-interface20] vrrp vrid 20 preempt-mode delay 90000

[DeviceA-Vlan-interface20] quit

# 创建VLAN接口30,并配置IP地址为10.1.30.2/24。创建VRRP备份组30,该备份组的虚拟IP地址为10.1.30.1。

[DeviceA] interface vlan-interface 30

[DeviceA-Vlan-interface30] ip address 10.1.30.2 24

[DeviceA-Vlan-interface30] vrrp vrid 30 virtual-ip 10.1.30.1

[DeviceA-Vlan-interface30] quit

5. 在Device B上配置VRRP

(1)     配置二层聚合接口

# 配置二层聚合接口1,绑定物理接口GigabitEthernet1/0/1和GigabitEthernet1/0/2,用于下行连接Device C。

<DeviceB>system-view

System View: return to User View with Ctrl+Z.

[DeviceB]interface bridge-aggregation 1

[DeviceB-Bridge-Aggregation1]quit

[DeviceB]interface range gigabitethernet 1/0/1 gigabitethernet 1/0/2

[DeviceB-if-range]port link-aggregation group 1

[DeviceB-if-range]undo shutdown

[DeviceB-if-range]quit

# 创建VLAN 20、30。配置二层聚合接口1为动态聚合模式,的链路类型配置为Trunk,允许VLAN 20和30通过。

[DeviceB]vlan 20 30

[DeviceB]interface bridge-aggregation 1

[DeviceB-Bridge-Aggregation1]link-aggregation mode dynamic

[DeviceB-Bridge-Aggregation1]port link-type trunk

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceB-Bridge-Aggregation1]port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceB-Bridge-Aggregation1]undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceB-Bridge-Aggregation1]quit

(2)     配置VRRP功能

# 创建VLAN接口20,并配置IP地址为10.1.20.3/24。创建VRRP备份组20,该备份组的虚拟IP地址为10.1.20.1。

[DeviceB] interface vlan-interface 20

[DeviceB-Vlan-interface20] ip address 10.1.20.3 24

[DeviceB-Vlan-interface20] vrrp vrid 20 virtual-ip 10.1.20.1

[DeviceB-Vlan-interface20] quit

# 创建VLAN接口30,并配置IP地址为10.1.30.3/24。创建VRRP备份组30,该备份组的虚拟IP地址为10.1.30.1。Device B在该备份组30中的优先级为120,成为Master设备,并工作在抢占模式,抢占延迟时间为90000厘秒(15分钟)。

[DeviceB-Vlan-interface20] interface vlan-interface 30

[DeviceB-Vlan-interface30] ip address 10.1.30.3 24

[DeviceB-Vlan-interface30] vrrp vrid 30 virtual-ip 10.1.30.1

[DeviceB-Vlan-interface30] vrrp vrid 30 priority 120

[DeviceB-Vlan-interface30] vrrp vrid 30 preempt-mode delay 90000

[DeviceB-Vlan-interface30] quit

6. 在Device C上配置VRRP

(1)     配置二层聚合接口作为上行接口

# 配置聚合接口1,绑定物理接口GigabitEthernet1/0/1和GigabitEthernet1/0/2,用于上行连接Device A;配置聚合接口2,绑定物理接口GigabitEthernet1/0/3和GigabitEthernet1/0/4,用于上行连接Device B。

<DeviceC> system-view

[DeviceC] vlan 20 30

[DeviceC] interface bridge-aggregation 1

[DeviceC-Bridge-Aggregation1] quit

[DeviceC] interface range gigabitethernet 1/0/1 gigabitethernet 1/0/2

[DeviceC-if-range] port link-aggregation group 1

[DeviceC-if-range] undo shutdown

[DeviceC-if-range] quit

[DeviceC] interface bridge-aggregation 1

[DeviceC-Bridge-Aggregation1] link-aggregation mode dynamic

[DeviceC-Bridge-Aggregation1] port link-type trunk

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceC-Bridge-Aggregation1] port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceC-Bridge-Aggregation1] undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/1 done.

Configuring GigabitEthernet1/0/2 done.

[DeviceC-Bridge-Aggregation1] quit

[DeviceC] interface bridge-aggregation 2

[DeviceC-Bridge-Aggregation2] quit

[DeviceC] interface range gigabitethernet 1/0/3 gigabitethernet 1/0/4

[DeviceC-if-range] port link-aggregation group 2

[DeviceC-if-range] undo shutdown

[DeviceC-if-range] quit

[DeviceC] interface bridge-aggregation 2

[DeviceC-Bridge-Aggregation2] link-aggregation mode dynamic

[DeviceC-Bridge-Aggregation2] port link-type trunk

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceC-Bridge-Aggregation2] port trunk permit vlan 20 30

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceC-Bridge-Aggregation2] undo port trunk permit vlan 1

Configuring GigabitEthernet1/0/3 done.

Configuring GigabitEthernet1/0/4 done.

[DeviceC-Bridge-Aggregation2] quit

(2)     配置下行接口GigabitEthernet1/0/5和GigabitEthernet1/0/6

# 将端口GigabitEthernet1/0/5的链路类型配置为Access,并允许VLAN 20通过。

[DeviceC] interface gigabitethernet 1/0/5

[DeviceC-GigabitEthernet1/0/5] port link-type access

[DeviceC-GigabitEthernet1/0/5] port access vlan 20

[DeviceC-GigabitEthernet1/0/5] undo shutdown

[DeviceC-GigabitEthernet1/0/5] quit

# 将端口GigabitEthernet1/0/6的链路类型配置为Access,并允许VLAN 30通过。

[DeviceC] interface gigabitethernet 1/0/6

[DeviceC-GigabitEthernet1/0/6] port link-type access

[DeviceC-GigabitEthernet1/0/6] port access vlan 30

[DeviceC-GigabitEthernet1/0/6] undo shutdown

[DeviceC-GigabitEthernet1/0/6] quit

7. 在Device A上配置上行三层网络

(1)     配置上行口Ten-GigabitEthernet1/0/32的IP地址为10.1.1.2/24。

[DeviceA] interface ten-gigabitethernet 1/0/32

[DeviceA-Ten-GigabitEthernet1/0/32] port link-mode route

The configuration of the interface will be restored to the default. Continue? [Y/N]:y

[DeviceA-Ten-GigabitEthernet1/0/32] ip address 10.1.1.2 24

[DeviceA-Ten-GigabitEthernet1/0/32] quit

(2)     配置OSPF功能。

[DeviceA] router id 1.1.1.1

[DeviceA] ospf

[DeviceA-ospf-1] area 0

[DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[DeviceA-ospf-1-area-0.0.0.0] network 10.1.20.0 0.0.0.255

[DeviceA-ospf-1-area-0.0.0.0] network 10.1.30.0 0.0.0.255

[DeviceA-ospf-1-area-0.0.0.0] quit

[DeviceA-ospf-1] quit

8. 在Device D上配置三层网络

(1)     配置下行口Ten-GigabitEthernet1/0/31的IP地址为10.1.1.1/24,用于连接Device A;配置下行口Ten-GigabitEthernet1/0/32的IP地址为10.1.2.1/24,用于连接Device B。

<DeviceD> system-view

[DeviceD] interface ten-gigabitethernet 1/0/31

[DeviceD-Ten-GigabitEthernet1/0/31] port link-mode route

The configuration of the interface will be restored to the default. Continue? [Y/N]:y

[DeviceD-Ten-GigabitEthernet1/0/31] ip address 10.1.1.1 24

[DeviceD-Ten-GigabitEthernet1/0/31] quit

[DeviceD] interface ten-gigabitethernet 1/0/32

[DeviceD-Ten-GigabitEthernet1/0/32] port link-mode route

The configuration of the interface will be restored to the default. Continue? [Y/N] y

[DeviceD-Ten-GigabitEthernet1/0/32] ip address 10.1.2.1 24

[DeviceD-Ten-GigabitEthernet1/0/32] quit

(2)     配置OSPF功能。

[DeviceD] router id 4.4.4.4

[DeviceD] ospf

[DeviceD-ospf-1] area 0

[DeviceD-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[DeviceD-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255

[DeviceD-ospf-1-area-0.0.0.0] quit

[DeviceD-ospf-1] quit

9. 在Device A上配置VSRP

(1)     配置多机备份实例forvlan20,用于备份VLAN 20的地址池。

# 创建名字为fordhcppool的多机备份对端,并进入多机备份对端视图。配置多机备份对端地址为10.1.2.2,本地地址为10.1.1.2。

[DeviceA] vsrp peer fordhcppool

[DeviceA-vsrp-peer-fordhcppool] peer 10.1.2.2 local 10.1.1.2

[DeviceA-vsrp-peer-fordhcppool] quit

# 创建名字为forvlan20的多机备份实例,并进入多机备份实例视图。配置备份ID为1,关联的多机备份对端名称为fordhcppool。配置多机备份实例forvlan20绑定VLAN接口20上的VRRP备份组20。

[DeviceA] vsrp instance forvlan20

[DeviceA-vsrp-instance-forvlan20] backup id 1 peer fordhcppool

[DeviceA-vsrp-instance-forvlan20] bind vrrp vrid 20 interface Vlan-interface 20

[DeviceA-vsrp-instance-forvlan20] quit

[DeviceA] interface vlan-interface 20

[DeviceA-Vlan-interface20] dhcp vsrp forvlan20

[DeviceA-Vlan-interface20] quit

(2)     配置多机备份实例forvlan30,用于备份VLAN 30的地址池。

# 创建名字为forvlan30的多机备份实例,并进入多机备份实例视图。配置备份ID为2,关联的多机备份对端名称为fordhcppool。配置多机备份实例forvlan30绑定VLAN接口30上的VRRP备份组30。

[DeviceA] vsrp instance forvlan30

[DeviceA-vsrp-instance-forvlan30] backup id 2 peer fordhcppool

[DeviceA-vsrp-instance-forvlan30] bind vrrp vrid 30 interface Vlan-interface 30

[DeviceA-vsrp-instance-forvlan30] quit

[DeviceA] interface vlan-interface 30

[DeviceA-Vlan-interface30] dhcp vsrp forvlan30

[DeviceA-Vlan-interface30] quit

10. 在Device B上配置VSRP

(1)     配置多机备份实例forvlan20,用于备份VLAN 20的地址池。

# 创建名字为fordhcppool的多机备份对端,并进入多机备份对端视图。配置多机备份对端地址为10.1.1.2,本地地址为10.1.2.2。

[DeviceB] vsrp peer fordhcppool

[DeviceB-vsrp-peer-fordhcppool] peer 10.1.1.2 local 10.1.2.2

[DeviceB-vsrp-peer-fordhcppool] quit

# 创建名字为forvlan20的多机备份实例,并进入多机备份实例视图。配置备份ID为1,关联的多机备份对端名称为fordhcppool。配置多机备份实例forvlan20绑定VLAN接口20上的VRRP备份组20。

[DeviceB] vsrp instance forvlan20

[DeviceB-vsrp-instance-forvlan20] backup id 1 peer fordhcppool

[DeviceB-vsrp-instance-forvlan20] bind vrrp vrid 20 interface Vlan-interface 20

[DeviceB-vsrp-instance-forvlan20] quit

[DeviceB] interface vlan-interface 20

[DeviceB-Vlan-interface20] dhcp vsrp forvlan20

[DeviceB-Vlan-interface20] quit

(2)     配置多机备份实例forvlan30,用于备份VLAN 30的地址池。

# 创建名字为forvlan30的多机备份实例,并进入多机备份实例视图。配置备份ID为2,关联的多机备份对端名称为fordhcppool。配置多机备份实例forvlan30绑定VLAN接口30上的VRRP备份组30。

[DeviceB] vsrp instance forvlan30

[DeviceB-vsrp-instance-forvlan30] backup id 2 peer fordhcppool

[DeviceB-vsrp-instance-forvlan30] bind vrrp vrid 30 interface Vlan-interface 30

[DeviceB-vsrp-instance-forvlan30] quit

[DeviceB] interface vlan-interface 30

[DeviceB-Vlan-interface30] dhcp vsrp forvlan30

[DeviceB-Vlan-interface30] quit

11. 在Device A上配置DHCP地址池

(1)     配置地址池20,为VLAN 20内的设备分配IP地址。

# 配置地址池20,网段为10.1.20.0/24,可动态分配的IP地址为10.1.20.10~10.1.20.250,其它地址预留给服务器等设备使用。网关为备份组VRRP备份组20的虚拟IP地址10.1.20.1。

[DeviceA] dhcp server ip-pool 20

[DeviceA-dhcp-pool-20] network 10.1.20.0 mask 255.255.255.0

[DeviceA-dhcp-pool-20] address range 10.1.20.10 10.1.20.250

[DeviceA-dhcp-pool-20] expired day 30

[DeviceA-dhcp-pool-20] dns-list 10.1.20.1

[DeviceA-dhcp-pool-20] gateway-list 10.1.20.1

[DeviceA-dhcp-pool-20] vsrp-instance forvlan20

[DeviceA-dhcp-pool-20] quit

[DeviceA] interface vlan-interface 20

[DeviceA-Vlan-interface20] dhcp select server

[DeviceA-Vlan-interface20] quit

(2)     配置地址池30,为VLAN 30内的设备分配IP地址。

# 配置地址池30,网段为10.1.30.0/24,可动态分配的IP地址为10.1.30.10~10.1.30.250,其它地址预留给服务器等设备使用。网关为备份组VRRP备份组30的虚拟IP地址10.1.30.1。

[DeviceA] dhcp server ip-pool 30

[DeviceA-dhcp-pool-30] network 10.1.30.1 mask 255.255.255.0

[DeviceA-dhcp-pool-30] address range 10.1.30.10 10.1.30.250

[DeviceA-dhcp-pool-30] expired day 30

[DeviceA-dhcp-pool-30] dns-list 10.1.30.1

[DeviceA-dhcp-pool-30] gateway-list 10.1.30.1

[DeviceA-dhcp-pool-30] vsrp-instance forvlan30

[DeviceA-dhcp-pool-30] quit

[DeviceA] interface vlan-interface 30

[DeviceA-Vlan-interface30] dhcp select server

[DeviceA-Vlan-interface30] quit

(3)     全局开启DHCP功能。

[DeviceA] dhcp enable

[DeviceA] dhcp server request-ip-address check

12. 在Device B上配置DHCP地址池

(1)     配置地址池20,为VLAN 20内的设备分配IP地址。

# 配置地址池20,网段为10.1.20.0/24,可动态分配的IP地址为10.1.20.10~10.1.20.250,其它地址预留给服务器等设备使用。网关为备份组VRRP备份组20的虚拟IP地址10.1.20.1。

[DeviceB] dhcp server ip-pool 20

[DeviceB-dhcp-pool-20] network 10.1.20.0 mask 255.255.255.0

[DeviceB-dhcp-pool-20] address range 10.1.20.10 10.1.20.250

[DeviceB-dhcp-pool-20] expired day 30

[DeviceB-dhcp-pool-20] dns-list 10.1.20.1

[DeviceB-dhcp-pool-20] gateway-list 10.1.20.1

[DeviceB-dhcp-pool-20] vsrp-instance forvlan20

[DeviceB-dhcp-pool-20] quit

[DeviceB] interface vlan-interface 20

[DeviceB-Vlan-interface20] dhcp select server

[DeviceB-Vlan-interface20] quit

(2)     配置地址池30,为VLAN 30内的设备分配IP地址。

# 配置地址池30,网段为10.1.30.0/24,可动态分配的IP地址为10.1.30.10~10.1.30.250,其它地址预留给服务器等设备使用。网关为备份组VRRP备份组30的虚拟IP地址10.1.30.1。

[DeviceB] dhcp server ip-pool 30

[DeviceB-dhcp-pool-30] network 10.1.30.1 mask 255.255.255.0

[DeviceB-dhcp-pool-30] address range 10.1.30.10 10.1.30.250

[DeviceB-dhcp-pool-30] expired day 30

[DeviceB-dhcp-pool-30] dns-list 10.1.30.1

[DeviceB-dhcp-pool-30] gateway-list 10.1.30.1

[DeviceB-dhcp-pool-30] vsrp-instance forvlan30

[DeviceB-dhcp-pool-30] quit

[DeviceB] interface vlan-interface 30

[DeviceB-Vlan-interface30] dhcp select server

[DeviceB-Vlan-interface30] quit

(3)     全局开启DHCP功能。

[DeviceB] dhcp enable

[DeviceB] dhcp server request-ip-address check

13. 配置Host

(1)     在Host A上,配置自动获取IP地址,缺省网关为10.1.20.1。(具体步骤略)

(2)     在Host B上,配置自动获取IP地址,缺省网关为10.1.30.1。(具体步骤略)

14. 验证VRRP配置

说明

因为本举例涉及多个特性,建议完成一项功能的配置后,先验证这个功能是否运行正常,如果不正常,先定位解决问题。再配置下一个功能。例如,先配置并验证之后,再配置并验证上行三层网络配置。

 

(1)     在Device A上验证VRRP。

Device A在VRRP备份组20中应该为Master,在VRRP备份组30中应该为Backup。

[DeviceA] display vrrp

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 2

 Interface          VRID  State        Running Adver   Auth             Virtual

                                       Pri     Timer   Type                IP

 ----------------------------------------------------------------------------

 Vlan20             20    Master       120     100     Not supported    10.1.20.1

 Vlan30             30    Backup       100     100     Not supported    10.1.30.1

(2)     在Device B上验证VRRP。

Device B在VRRP备份组20中应该为Backup,在VRRP备份组30中应该为Master。

[DeviceB] display vrrp

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 2

 Interface          VRID  State        Running Adver   Auth             Virtual

                                       Pri     Timer   Type                IP

 ----------------------------------------------------------------------------

 Vlan20             20    Backup       100     100     Not supported    10.1.20.1

 Vlan30             30    Master       120     100     Not supported    10.1.30.1

15. 验证DHCP地址池备份效果

禁用Host A的网卡,再启用Host A的网卡,可以在Device A给Host A分配了IP地址10.1.20.10,Device B上也可以查询到该信息。查看Device A和Device B的VSRP日志记录,可以发现,Device A将DHCP地址信息备份给了Device B。

[DeviceA] display dhcp server ip-in-use

IP address       Client-identifier/    Lease expiration      Type

                 Hardware address

10.1.20.10       0108-0027-0038-f1     Jun 29 17:09:10 2024  Auto(C)

[DeviceB] display dhcp server ip-in-use

IP address       Client-identifier/    Lease expiration      Type

                 Hardware address

10.1.20.10       0108-0027-0038-f1     Jun 29 17:08:38 2024  Auto(C)

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们