示例:在单个 MX 系列路由器上的专用 VLAN 中配置 IRB 接口
出于安全原因,限制广播和未知单播流量的流动,甚至限制已知主机之间的通信通常很有用。MX 系列路由器上的专用 VLAN (PVLAN) 功能允许管理员将广播域拆分为多个独立的广播子域,实质上是将 VLAN 置于 VLAN 中。
此示例介绍如何在与单个 MX 系列路由器上的虚拟交换机实例关联的 PVLAN 桥接域中创建集成路由和桥接 (IRB) 接口:
不支持在 PVLAN 接口上配置 IP 语音 (VoIP) VLAN。
要求
此示例使用以下硬件和软件组件:
一个处于增强型 LAN 模式的 MX 系列路由器。
适用于 MX 系列路由器的 Junos OS 15.1 或更高版本
在开始配置 PVLAN 之前,请确保您已:
创建并配置了必要的 VLAN。请参阅 配置 VLAN 和扩展 VLAN 封装 和 启用 VLAN 标记。
通过在层次结构级别输入
network-services lan
语句[edit chassis]
,将 MX240、MX480 和 MX960 路由器配置为在增强型 LAN 模式下运行。
概述和拓扑
在具有多座建筑物和 VLAN 的大型办公室中,出于安全原因或对广播域进行分区,您可能需要隔离某些工作组或其他端点。此配置示例显示了一个简单的拓扑,用于说明如何创建具有一个主 VLAN 和四个公共组 VLAN 以及两个隔离端口的 PVLAN。
假设有一个部署示例,其中名为 VP 的主 VLAN 包含端口 p1、p2、t1、t2、i1、i2、cx1 和 cx2。这些已配置端口的端口类型如下:
混合端口 = p1、p2
ISL 端口 = t1、t2
隔离端口 = i1、i2
公共组 VLAN = Cx
社区端口 = cx1, cx2
IRB 接口 irb.0 已配置并映射到虚拟交换机实例中的桥接域。
为每个 VLAN(即 Vp、Vi 和 Vcx)调配桥接域。假设桥接域配置如下:
Vp —BD_primary_Vp(包含的端口为 p1、t1、i1、i2、cx1、cx2)
Vi—BD_isolate_Vi(包含的端口为 p1、t1、*i1、*i2)
Vcx — BD_community_Vcx(包含的端口为 p1、t1、cx1、cx2)
当您配置具有中继接口、接入接口或交换机间链路的桥接域时,系统会在内部自动创建公共组、主 VLAN 和隔离 VLAN 的桥接域。桥接域包含与 VLAN 对应的相同 VLAN ID。要将桥接域用于 PVLAN,必须配置以下附加属性:
配置
要在 PVLAN 中配置 IRB 接口,请执行以下操作:
CLI 快速配置
要快速创建和配置 PVLAN,并在与虚拟交换机实例关联的 PVLAN 桥接域中包含 IRB 接口,请复制以下命令并将其粘贴到路由器终端窗口中:
配置 IRB 接口
set interfaces irb unit 0 family inet address 22.22.22.1/24
配置混合端口、ISL、隔离端口和社区端口
set interfaces ge-0/0/9 unit 0 family bridge interface-mode trunk set interfaces ge-0/0/9 unit 0 family bridge vlan-id 100 set interfaces ge-0/0/13 unit 0 family bridge interface-mode trunk set interfaces ge-0/0/13 unit 0 family bridge vlan-id 100 set interfaces ge-0/0/10 unit 0 family bridge interface-mode access set interfaces ge-0/0/10 unit 0 family bridge vlan-id 10 set interfaces ge-0/0/12 unit 0 family bridge interface-mode access set interfaces ge-0/0/12 unit 0 family bridge vlan-id 10 set interfaces ge-0/0/1 unit 0 family bridge interface-mode access set interfaces ge-0/0/1 unit 0 family bridge vlan-id 50 set interfaces ge-0/0/2 unit 0 family bridge interface-mode access set interfaces ge-0/0/2 unit 0 family bridge vlan-id 50 set interfaces ge-0/0/3 unit 0 family bridge interface-mode access set interfaces ge-0/0/3 unit 0 family bridge vlan-id 60 set interfaces ge-0/0/4 unit 0 family bridge interface-mode access set interfaces ge-0/0/4 unit 0 family bridge vlan-id 60
使用桥接域接口配置虚拟交换机实例
set routing-instances vs-1 instance-type virtual-switch set routing-instances vs-1 interface ge-0/0/1.0 set routing-instances vs-1 interface ge-0/0/2.0 set routing-instances vs-1 interface ge-0/0/3.0 set routing-instances vs-1 interface ge-0/0/4.0 set routing-instances vs-1 interface ge-0/0/9.0 set routing-instances vs-1 interface ge-0/0/10.0 set routing-instances vs-1 interface ge-0/0/12.0 set routing-instances vs-1 interface ge-0/0/13.0 set routing-instances vs-1 bridge-domains bd1
指定桥接域中的 IRB 接口以及主 VLAN ID 、隔离 ID 和社区 VLAN ID
set routing-instances vs1 bridge-domains bd1 vlan-id 100 set routing-instances vs1 bridge-domains bd1 isolated-vlan 10 set routing-instances vs1 bridge-domains bd1 community-vlans [50 60] set routing-instances vs1 bridge-domains bd1 routing-interface irb.0
程序
分步过程
要配置 PVLAN 的交换机间链路 (ISL)、PVLAN 端口类型和 PVLAN 的辅助 VLAN,请执行以下操作:
创建 IRB 接口。
[edit interfaces] user@host# set interfaces irb unit 0 family inet address 22.22.22.1/24
为 PVLAN 创建混合端口。
[edit interfaces] user@host# set ge-0/0/9 unit 0 family bridge interface-mode trunk user@host# set ge-0/0/9 unit 0 family bridge vlan-id 100
为 PVLAN 创建交换机间链路 (ISL) 中继端口。
[edit interfaces] user@host# set ge-0/0/13 unit 0 family bridge interface-mode trunk inter-switch-link user@host# set ge-0/0/13 unit 0 family bridge vlan-id 100
为 PVLAN 创建隔离端口。
[edit interfaces] user@host# set ge-0/0/10 unit 0 family bridge interface-mode access user@host# set ge-0/0/10 unit 0 family bridge vlan-id 10 user@host# set ge-0/0/12 unit 0 family bridge interface-mode access user@host# set ge-0/0/12 unit 0 family bridge vlan-id 10
为 PVLAN 创建公共组端口。
[edit interfaces] user@host# set ge-0/0/1 unit 0 family bridge interface-mode access user@host# set ge-0/0/1 unit 0 family bridge vlan-id 50 user@host# set ge-0/0/2 unit 0 family bridge interface-mode access user@host# set ge-0/0/2 unit 0 family bridge vlan-id 50 user@host# set ge-0/0/3 unit 0 family bridge interface-mode access user@host# set ge-0/0/3 unit 0 family bridge vlan-id 60 user@host# set ge-0/0/4 unit 0 family bridge interface-mode access user@host# set ge-0/0/4 unit 0 family bridge vlan-id 60
创建具有桥接域的虚拟交换机实例并关联逻辑接口。
[edit routing-instances] user@host# set vs-1 instance-type virtual-switch user@host# set vs-1 interface ge-0/0/1.0 user@host# set vs-1 interface ge-0/0/2.0 user@host# set vs-1 interface ge-0/0/3.0 user@host# set vs-1 interface ge-0/0/4.0 user@host# set vs-1 interface ge-0/0/9.0 user@host# set vs-1 interface ge-0/0/10.0 user@host# set vs-1 interface ge-0/0/12.0 user@host# set vs-1 interface ge-0/0/13.0 user@host# set vs-1 bridge-domains bd1
指定 IRB 接口、主 VLAN ID、隔离 VLAN 和社区 VLAN ID,并将 VLAN 与桥接域关联。
[edit routing-instances vs1 bridge-domains bd1] user@host# set vlan-id 100 user@host# set isolated-vlan 10 user@host# set community-vlans [50 60] user@host# set routing-interface irb.0
结果
检查配置结果:
[edit] [interfaces] ge-0/0/9 { unit 0 { family bridge { interface-mode trunk; vlan-id 100; Promiscuous port by vlan id } } } ge-0/0/13 { unit 0 { family bridge { interface-mode trunk inter-switch-link; ISL trunk vlan-id 100; } } } ge-0/0/10 { unit 0 { family bridge { interface-mode access; vlan-id 10; isolated port by vlan ID } } } ge-0/0/12 { unit 0 { family bridge { interface-mode access; vlan-id 10; isolated port by vlan ID } } } ge-0/0/1 { unit 0 { family bridge { interface-mode access; vlan-id 50; community port by vlan ID } } } ge-0/0/2 { unit 0 { family bridge { interface-mode access; vlan-id 50; community port by vlan ID } } } ge-0/0/3 { unit 0 { family bridge { interface-mode access; vlan-id 60; community port by vlan ID } } } ge-0/0/4 { unit 0 { family bridge { interface-mode access; vlan-id 60; community port by vlan ID } } } irb { unit 0 { family inet { address 22.22.22.1/24; } } }
[edit] routing-instances { vs-1 { instance-type virtual-switch; interface ge-0/0/1.0; interface ge-0/0/2.0; interface ge-0/0/3.0; interface ge-0/0/4.0; interface ge-0/0/9.0; interface ge-0/0/10.0; interface ge-0/0/12.0; interface ge-0/0/13.0; bridge-domains { bd1 { vlan-id 100; /* primary vlan */ isolated-vlan 10; community-vlans [50 60] routing-interface irb.0 /* IRB interface */ } } }
验证
要确认配置工作正常,请执行以下任务:
验证是否已创建专用 VLAN 和辅助 VLAN
目的
验证是否已在交换机上正确创建主 VLAN 和辅助 VLAN。
操作
show bridge domain
使用以下命令:
user@host> show bridge domain Routing instance Bridge domain VLAN ID Interfaces default-switch bd1-primary-100 100 ge-0/0/9.0 ge-0/0/10.0 ge-0/0/12.0 ge-0/0/13.0 ge-0/0/1.0 ge-0/0/2.0 ge-0/0/3.0 ge-0/0/4.0 default-switch bd1-isolation-10 10 ge-0/0/9.0 ge-0/0/10.0 ge-0/0/12.0 ge-0/0/13.0 default-switch bd1-comunity-50 50 ge-0/0/9.0 ge-0/0/13.0 ge-0/0/1.0 ge-0/0/2.0 default-switch bd1-comunity-60 60 ge-0/0/9.0 ge-0/0/13.0 ge-0/0/3.0 ge-0/0/4.0
意义
输出显示主 VLAN 已创建,并标识与其关联的接口和辅助 VLAN。