示例:在 MX 系列路由器上使用 MVRP 配置自动 VLAN 管理
第 2 层网络中使用多个 VLAN 注册协议 (MVRP) 来动态共享虚拟 LAN (VLAN) 信息并自动配置必要的 VLAN 信息。根据当前网络配置根据端口自动配置 VLAN,可确保路由器不会将流量发送至网络上具有非活动 VLAN 的接口。通过这种方式,MVRP 仅将广播、未知单播和组播 (BUM) 流量限制至相关设备,从而减少了网络开销。MVRP 还支持快速修复网络故障,而不中断对未受影响 VLAN 的服务,并缩短融合时间。
MVRP 是基于 IEEE 标准 802.1ak 修订 802.1Q-2005 第 2 层网络协议, 即本地和城域网虚拟桥接局域网标准 - 修订 07:多注册协议。
此示例介绍如何使用 MVRP 自动管理网络中的 VLAN 成员变更并动态创建 VLAN:
要求
此示例使用以下硬件和软件组件:
两个作为边缘交换机的 MX 系列路由器
一台作为聚合交换机的 MX 系列路由器
MX 系列路由器的 Junos OS 10.1 或更高版本
概述和拓扑
VLAN 在用作边缘交换机的 MX 系列路由器上的接入接口上静态配置。通过在两个中继接口上启用 MVRP,VLAN 成员信息传播到作为核心聚合交换机的 MX 系列路由器:一个将边缘交换机 1 (ES1) 连接到聚合交换机 1 (AS1),另一个将 ES2 连接到 AS1。在网络中每个 MX 系列路由器的中继接口上启用 MVRP,可确保网络中路由器的活动 VLAN 信息通过中继接口(MVRP 的默认注册模式)传播到每个路由器。
MVRP 可确保随着边缘交换机的接入接口变得活动或无效,中继接口上的 VLAN 成员信息更新。
您无需将 VLAN 显式绑定到中继接口。启用 MVRP 时,中继接口将通告该交换机上的所有活动(绑定到接入接口)的 VLAN。支持 MVRP 的中继接口不会通告已在交换机上配置但当前未绑定到接入接口的 VLAN。例如,拓扑中的 ES1 不会将流量转发至 ES2 上的非活动 VLAN 300。
快速生成树协议 (RSTP) 也在中继接口上配置,以推广无环路拓扑。
此示例显示了使用 VLAN 100、200 和 300 的两个客户站点(站点–1 和站点–2)的网络。
ES1 支持所有三个 VLANS,并且所有三个 VLANS 均处于活动状态,并与 连接到站点 1 中三个客户的接口绑定:
ge-11/2/6 — 连接客户3-site1、VLAN ID 100 的接入端口。
ge-11/2/7 — 连接客户2-site1、VLAN ID 200 的接入端口。
ge-11/2/8 — 连接客户1-site1、VLAN ID 300 的接入端口。
ge-11/3/0 — 将 ES1 连接到 AS1 的中继端口。
ES2 已配置为支持两个 VLANS,并且两个 VLANS 均处于活动状态,并与连接到 站点上的两个客户的接口绑定 – 2:
ge-0/1/1 — 连接客户1-site2、VLAN ID 100 的接入端口。
ge-0/2/0 — 连接客户2-site2、VLAN ID 200 的接入端口。
ge-0/0/5 — 将 ES2 连接到 AS1 的中继端口。
AS1 通过与边缘交换机的连接使用 MVRP 动态学习 VLAN。AS1 有两个中继接口:
ge-3/3/0 —将路由器连接到接口 ge-11/3/0 上的边缘交换机 ES1。
ge-3/0/5 —将路由器连接到接口 ge-0/0/5 上的边缘交换机 ES2。
默认 MVRP 接口注册模式 正常 ,在此示例中使用。当路由器上启用 MVRP 时,正常注册模式下的接口将参与 MVRP。有关更改 MVRP 注册模式的信息,请参阅 在 MVRP 配置中控制 VLAN 的管理状态 。
拓扑
图 1 显示了在三个 MX 系列路由器上配置的 MVRP:两个作为边缘交换机运行的路由器和一个作为聚合交换机运行的路由器。

表 1 解释了示例拓扑的组件。
属性 | 设置 |
---|---|
MX 系列路由器 |
|
与桥接域 bd 关联的 VLAN 标记 ID |
100、 200 和 300 |
ES1 接口 |
ES1 接口:
|
ES2 接口 |
ES2 接口:
|
AS1 接口 |
AS1 接口:
|
配置
要在中继接口上启用 MVRP 和 RSTP,以及配置 ES1 接入接口和桥接域,请执行以下任务:
在 ES1 上配置 MVRP
CLI 快速配置
要为 MVRP 快速配置 ES1,请复制以下命令并将其粘贴到 ES1 的交换机终端窗口中:
[edit] set interfaces ge-11/2/6 description "connected to customer3-site-1" set interfaces ge-11/2/6 unit 0 family bridge interface-mode access set interfaces ge-11/2/6 unit 0 family bridge vlan-id 300 set interfaces ge-11/2/7 description "connected to customer2-site-1" set interfaces ge-11/2/7 unit 0 family bridge interface-mode access set interfaces ge-11/2/7 unit 0 family bridge vlan-id 200 set interfaces ge-11/2/8 description "connected to customer1-site-1" set interfaces ge-11/2/8 unit 0 family bridge interface-mode access set interfaces ge-11/2/8 unit 0 family bridge vlan-id 100 set interfaces ge-11/3/0 description "connected to AS1 interface ge-3/3/0" set interfaces ge-11/3/0 unit 0 family bridge interface-mode trunk set bridge-domains bd vlan-id-list [100 200 300] set protocols mvrp interface ge-11/3/0 set protocols rstp interface ge-11/3/0
正如我们建议的最佳做法一样,此示例中使用默认 MVRP 定时器。与每个 MVRP 计时器关联的默认值为加入计时器 200 毫秒,离开计时器为 1000 毫秒,离休器为 10000 毫秒。将计时器修改为不适当的值可能会导致 MVRP 操作失衡。
逐步过程
要在 ES1 上配置 MVRP:
在客户站点 1 和连接 ES1 到 AS1 的中继接口上为客户配置接入接口:
[edit interfaces] user@es1# set ge-11/2/6 description "connected to customer3-site-1" user@es1# set ge-11/2/6 unit 0 family bridge interface-mode access user@es1# set ge-11/2/6 unit 0 family bridge vlan-id 300 user@es1# set ge-11/2/7 description "connected to customer2-site-1" user@es1# set ge-11/2/7 unit 0 family bridge interface-mode access user@es1# set ge-11/2/7 unit 0 family bridge vlan-id 200 user@es1# set ge-11/2/8 description "connected to customer1-site-1" user@es1# set ge-11/2/8 unit 0 family bridge interface-mode access user@es1# set ge-11/2/8 unit 0 family bridge vlan-id 100 user@es1# set ge-11/3/0 description "connected to AS1 interface ge-3/3/0" user@es1# set ge-11/3/0 unit 0 family bridge interface-mode trunk
配置桥接域 bd 和与桥接域关联的 VLAN ID:
[edit bridge-domains] user@es1# set bd vlan-id-list [100 200 300]
在中继接口上启用 MVRP:
[edit protocols] user@es1# set mvrpinterface ge-11/3/0
在中继接口上启用 RSTP:
[edit protocols] user@es1# set rstp interface ge-11/3/0
结果
检查配置结果:
user@es1> show configuration interfaces { ge-11/2/6 { description "connected to customer3-site-1"; unit 0 { family bridge { interface-mode access; vlan-id 300; } } } ge-11/2/7 { description "connected to customer2-site-1"; unit 0 { family bridge { interface-mode access; vlan-id 200; } } } ge-11/2/8 { description "connected to customer1-site-1"; unit 0 { family bridge { interface-mode access; vlan-id 100; } } } ge-11/3/0 { description "connected to AS1 interface ge-3/3/0"; unit 0 { family bridge { interface-mode trunk; } } } } bridge-domains { bd { vlan-id-list [ 100 200 300 ]; } } protocols { mvrp { interface ge-11/3/0; } rstp { interface ge-11/3/0; } }
在 ES2 上配置 MVRP
CLI 快速配置
要为 MVRP 快速配置 ES2,请复制以下命令并将其粘贴到 ES2 的交换机终端窗口中:
[edit] set interfaces ge-0/0/5 description "connected to AS1 interface ge-3/0/5" set interfaces ge-0/0/5 unit 0 family bridge interface-mode trunk set interfaces ge-0/1/1 description "connected to customer1-site-2" set interfaces ge-0/1/1 unit 0 family bridge interface-mode access set interfaces ge-0/1/1 unit 0 family bridge vlan-id 100 set interfaces ge-0/2/0 description "connected to customer2-site-2" set interfaces ge-0/2/0 unit 0 family bridge interface-mode access set interfaces ge-0/2/0 unit 0 family bridge vlan-id 200 set bridge-domains bd vlan-id-list [100 200] set protocols mvrp interface ge-0/0/5 set protocols rstp interface ge-0/0/5
正如我们建议的最佳做法一样,此示例中使用默认 MVRP 定时器。与每个 MVRP 计时器关联的默认值为加入计时器 200 毫秒,离开计时器为 1000 毫秒,离休器为 10000 毫秒。将计时器修改为不适当的值可能会导致 MVRP 操作失衡。
逐步过程
要在中继接口上启用 MVRP 和 RSTP,以及配置 ES2 接入接口和桥接域:
在客户 站点-2 和连接 ES2 到 AS1 的中继接口为客户配置接入接口:
[edit interfaces] user@es2# set ge-0/0/5 description "connected to AS1 interface ge-3/0/5" user@es2# set ge-0/0/5 unit 0 family bridge interface-mode trunk user@es2# set ge-0/1/1 description "connected to customer1-site-2" user@es2# set ge-0/1/1 unit 0 family bridge interface-mode access user@es2# set ge-0/1/1 unit 0 family bridge vlan-id 100 user@es2# set ge-0/2/0 description "connected to customer2-site-2" user@es2# set ge-0/2/0 unit 0 family bridge interface-mode access user@es2# set ge-0/2/0 unit 0 family bridge vlan-id 200
配置桥接域 bd 和与桥接域关联的 VLAN ID:
[edit bridge-domains] user@es2# set bd vlan-id-list [100 200]
在中继接口上启用 MVRP:
[edit protocols] user@es2# set mvrpinterface ge-0/0/5
在中继接口上启用 RSTP:
[edit protocols] user@es2# set rstp interface ge-0/0/5
结果
检查配置结果:
user@es2> show configuration interfaces { ge-0/0/5 { description "connected to AS1 interface ge-3/0/5"; unit 0 { family bridge { interface-mode trunk; } } } ge-0/1/1 { description "connected to customer1-site-2"; unit 0 { family bridge { interface-mode access; vlan-id 100; } } } ge-0/2/0 { description "connected to customer2-site-2"; unit 0 { family bridge { interface-mode access; vlan-id 200; } } } } bridge-domains { bd { vlan-id-list [ 100 200 ]; } } protocols { mvrp { interface ge-0/0/5; } rstp { interface ge-0/0/5; } }
在 AS1 上配置 MVRP
CLI 快速配置
要为 MVRP 快速配置 AS1,请复制以下命令并将其粘贴到 AS1 的交换机终端窗口中:
[edit] set interfaces ge-3/0/5 description "connected to ES2 interface ge-0/0/5” set interfaces ge-3/0/5 unit 0 family bridge interface-mode trunk set interfaces ge-3/3/0 description "connected to ES1 interface ge-11/3/0" set interfaces ge-3/3/0 unit 0 family bridge interface-mode trunk set protocols mvrp interface ge-3/0/5 set protocols mvrp interface ge-3/3/0 set protocols rstp bridge-priority 0 set protocols rstp interface ge-3/0/5 set protocols rstp interface ge-3/3/0
正如我们建议的最佳做法一样,此示例中使用默认 MVRP 定时器。与每个 MVRP 计时器关联的默认值为加入计时器 200 毫秒,离开计时器为 1000 毫秒,离休器为 10000 毫秒。将计时器修改为不适当的值可能会导致 MVRP 操作失衡。
逐步过程
要在 AS1 的中继接口上启用 MVRP 和 RSTP:
配置将 AS1 连接到 ES1 和 ES2 的中继接口:
[edit interfaces] user@as1# set ge-3/0/5 description "connected to ES2 interface ge-0/0/5” user@as1# set ge-3/0/5 unit 0 family bridge interface-mode trunk user@as1# set ge-ge-3/3/0 description "connected to ES1 interface ge-11/3/0" user@as1# set ge-3/3/0 unit 0 family bridge interface-mode trunk
在中继接口上启用 MVRP:
[edit protocols] user@as1# set mvrp interface ge-3/0/5 user@as1# set mvrp interface ge-3/3/0
在中继接口上启用 RSTP:
[edit protocols] user@as1# set rstp bridge-priority 0 user@as1# set rstp interface ge-3/0/5 user@as1# set rstp interface ge-3/3/0
结果
检查配置结果:
user@as1> show configuration interfaces { ge-3/0/5 { description "connected to ES2 interface ge-0/0/5"; unit 0 { family bridge { interface-mode trunk; } } } ge-3/3/0 { description "connected to ES1 interface ge-11/3/0"; unit 0 { family bridge { interface-mode trunk; } } } } protocols { mvrp { interface ge-3/0/5; interface ge-3/3/0; } rstp { bridge-priority 0; interface ge-3/0/5; interface ge-3/3/0; } }
验证
要确认配置更新了 VLAN 成员资格,请执行以下任务:
- 验证 ES1 上是否启用了 MVRP
- 验证 ES1 上的 MVRP 注册
- 验证 ES1 上的动态 VLAN 成员
- 验证 ES2 上是否启用了 MVRP
- 验证 ES2 上的 MVRP 注册
- 验证 ES2 上的动态 VLAN 成员
- 验证 AS1 上是否启用了 MVRP
- 验证 AS1 上的 MVRP 注册
- 验证 MVRP 是否在 AS1 上更新 VLAN 成员资格
验证 ES1 上是否启用了 MVRP
目的
验证 ES1 上是否启用了 MVRP。
行动
显示 MVRP 申请人状态:
user@es1> show mvrp applicant-state MVRP applicant state for routing instance 'default-switch' (VO) Very anxious observer, (VP) Very anxious passive, (VA) Very anxious new, (AN) Anxious new, (AA) Anxious active, (QA) Quiet active, (LA) Leaving active, (AO) Anxious observer, (QO) Quiet observer, (LO) Leaving observer, (AP) Anxious passive, (QP) Quiet passive VLAN Id Interface State 100 ge-11/3/0 Declaring (QA) 200 ge-11/3/0 Declaring (QA) 300 ge-11/3/0 Declaring (QA)
意义
显示的输出显示,ES1 上的中继接口 ge-11/3/0 正在声明(发送)对 VLAN ID 100、 200 和 300 的兴趣。
验证 ES1 上的 MVRP 注册
目的
验证在 ES1 上注册的 VLAN。
行动
在注册状态中列出 VLAN:
user@es1> show mvrp registration-state MVRP registration state for routing instance 'default-switch' VLAN Id Interface Registrar Forced Managed STP State State State State 100 ge-11/3/0 Registered Registered Normal Forwarding 200 ge-11/3/0 Registered Registered Normal Forwarding 300 ge-11/3/0 Empty Empty Normal Forwarding
意义
显示的输出显示 VLAN 的注册注册符状态 100 和 200 已 注册,表示这些 VLAN 正在接收来自客户站点站点-2 的流量。VLAN 300 处于 空 状态,未接收来自站点 2 的流量。
验证 ES1 上的动态 VLAN 成员
目的
验证未注册的 VLAN 上未发生泛洪。
行动
列出动态 VLAN 成员资格:
user@es1> show mvrp dynamic-vlan-memberships MVRP dynamic vlans for routing instance 'default-switch' (s) static vlan, (f) fixed registration VLAN Id Interfaces 100 (s) ge-11/3/0 200 (s) ge-11/3/0 300 (s)
意义
显示的输出显示,VLAN 300 与连接到 AS1 的中继接口 ge-11/3/0 无关。没有不必要的流量会将 VLAN 300 的接口泛洪到 ES2 站点-2。
验证 ES2 上是否启用了 MVRP
目的
验证 ES2 上是否启用了 MVRP。
行动
显示 MVRP 申请人状态:
user@es2> show mvrp applicant-state MVRP applicant state for routing instance 'default-switch' (VO) Very anxious observer, (VP) Very anxious passive, (VA) Very anxious new, (AN) Anxious new, (AA) Anxious active, (QA) Quiet active, (LA) Leaving active, (AO) Anxious observer, (QO) Quiet observer, (LO) Leaving observer, (AP) Anxious passive, (QP) Quiet passive VLAN Id Interface State 100 ge-0/0/5 Declaring (QA) 200 ge-0/0/5 Declaring (QA) 300 ge-0/0/5 Idle (VO)
意义
显示的输出显示,ES2 上的中继接口 ge-0/0/5 正在声明(发送)对 VLAN ID 100 和 200 感兴趣,但未声明对 VLAN 300 感兴趣。VLAN 300 显示的状态为 Idle。
验证 ES2 上的 MVRP 注册
目的
验证正在 ES2 上注册的 VLAN。
行动
在注册状态中列出 VLAN:
user@es2> show mvrp registration-state MVRP registration state for routing instance 'default-switch' VLAN Id Interface Registrar Forced Managed STP State State State State 100 ge-0/0/5 Registered Registered Normal Forwarding 200 ge-0/0/5 Registered Registered Normal Forwarding 300 ge-0/0/5 Registered Registered Normal Forwarding
意义
显示的输出显示,VLAN 100、200 和 300 的注册注册状态表示这些 VLAN 接收来自客户站点站点-1 的流量。
验证 ES2 上的动态 VLAN 成员
目的
验证动态 VLAN 成员资格。
行动
列出动态 VLAN 成员资格:
user@es2> show mvrp dynamic-vlan-memberships MVRP dynamic vlans for routing instance 'default-switch' (s) static vlan, (f) fixed registration VLAN Id Interfaces 100 (s) ge-0/0/5 200 (s) ge-0/0/5 300 ge-0/0/5
意义
显示的输出显示 VLAN 300 不是静态 VLAN。静态 VLAN 由 VLAN ID 旁边表示 。添加到 ES2 的 VLAN 300 显示正在更新 VLAN 成员资格。
验证 AS1 上是否启用了 MVRP
目的
验证 MVRP 是否在 AS1 上启用。
行动
显示 MVRP 申请人状态:
user@es2> show mvrp applicant-state MVRP applicant state for routing instance 'default-switch' (VO) Very anxious observer, (VP) Very anxious passive, (VA) Very anxious new, (AN) Anxious new, (AA) Anxious active, (QA) Quiet active, (LA) Leaving active, (AO) Anxious observer, (QO) Quiet observer, (LO) Leaving observer, (AP) Anxious passive, (QP) Quiet passive VLAN Id Interface State 100 ge-3/3/0 Declaring (QA) ge-3/0/5 Declaring (QA) 200 ge-3/3/0 Declaring (QA) ge-3/0/5 Declaring (QA) 300 ge-3/3/0 Idle (VO) ge-3/0/5 Declaring (QA)
意义
显示的输出显示,中继接口 ge-3/3/0(连接到 ES1)和 ge-3/0/5(连接到 ES2)正在声明(发送)对 VLAN ID 100 和 200 的兴趣。接口 ge-3/0/5 正在声明对 VLAN 300 感兴趣(面向 ES2),但未在接口 ge-3/3/0 上声明 VLAN 300 的兴趣(面向 ES1)。
验证 AS1 上的 MVRP 注册
目的
验证在 AS1 上注册的 VLAN。
行动
在注册状态中列出 VLAN:
user@as1> show mvrp registration-state MVRP registration state for routing instance 'default-switch' VLAN Id Interface Registrar Forced Managed STP State State State State 100 ge-3/3/0 Registered Registered Normal Forwarding ge-3/0/5 Registered Registered Normal Forwarding 200 ge-3/3/0 Registered Registered Normal Forwarding ge-3/0/5 Registered Registered Normal Forwarding 300 ge-3/3/0 Registered Registered Normal Forwarding ge-3/0/5 Empty Empty Normal Forwarding
意义
显示的输出显示,VLAN 100 和 200 的注册方状态在 AS1 (ES1 和 ES2) 两侧注册,表示通过这些 VLAN 在客户站点-1 和站点-2 之间传输和接收流量。VLAN 300 的注册注册状态在接口 ge-3/3/0(连接到 ES1)上注册,但不在接口 ge-3/0/5 上(连接到 ES2)。
验证 MVRP 是否在 AS1 上更新 VLAN 成员资格
目的
通过在 AS1 上显示动态 VLAN 成员资格,验证 MVRP 是否在 AS1 上更新 VLAN 成员资格。
行动
列出使用 MVRP 动态创建的 AS1 上的 VLAN:
user@as1> show mvrp dynamic-vlan-memberships MVRP dynamic vlans for routing instance 'default-switch' (s) static vlan, (f) fixed registration VLAN Id Interfaces 100 ge-3/3/0 ge-3/0/5 200 ge-3/3/0 ge-3/0/5 300 ge-3/3/0
意义
VLAN 仅在边缘交换机上静态配置。显示的输出显示,所有 VLAN 都是动态学习的。 VLAN ID 旁边没有添加任何节点,表示它们是动态创建的,而不是静态添加的。