示例:配置 IRB 接口的 MAC 地址
此示例说明如何为具有模块化端口集中器 (MPC) 卡的设备配置集成路由和桥接 (IRB) 接口的媒体访问控制 (MAC) 地址。IRB 接口是用于桥接域或虚拟专用 LAN 服务 (VPLS) 路由的第 3 层路由接口。
要求
此示例需要以下硬件和软件组件:
-
带有 MPC 卡的 MX 系列路由器。
-
在所有设备上运行的 Junos OS 13.2 或更高版本。
概述
Junos OS 13.2 及更高版本支持将 MAC 地址分配给 IRB 逻辑接口。IRB 逻辑接口支持在同一桥接域内同时进行第 2 层桥接和第 3 层路由。到达桥接域接口的数据包将根据数据包的目标 MAC 地址进行交换或路由。具有路由器第 2 层虚拟 MAC 地址(手动配置)的数据包将切换到第 2 层接口。
配置 IRB 逻辑接口的 MAC 地址允许在同一交换机上的两个 VLAN 之间使用透明防火墙。如果两个 VLAN 位于同一子网上,并且来自一个 VLAN 的流量需要通过防火墙到达另一个 VLAN 上的主机,则会更改 VLAN 标记以与另一个 VLAN 上的主机通信。
在引入此功能之前,如果两个 VLAN 的 IRB 逻辑接口的 MAC 地址相同,防火墙会丢弃流量。此新功能允许您为不同的 VLAN 配置不同的 MAC 地址,从而促进同一交换机上的两个 VLAN 之间的流量交换。
在 VPLS 多宿主的情况下,如果主提供商边缘 (PE) 路由器故障转移到辅助 PE 路由器,则 IRB 的 MAC 地址会发生变化。连接到客户边缘 (CE) 路由器的主机必须更改其 IRB IP 和 MAC 地址的地址解析协议 (ARP)。此功能允许您为主 PE 路由器和辅助 PE 路由器中的 IRB 接口配置相同的 MAC 地址,并且在发生故障转移时无需更改客户边缘路由器中 IRB 逻辑接口的 ARP 绑定。
图 1 显示了示例拓扑。
拓扑学

此示例将配置 IRB 逻辑接口的 MAC 地址。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit]
中。
路由器 R0
set interfaces ge-1/3/8 vlan-tagging set interfaces ge-1/3/8 encapsulation flexible-ethernet-services set interfaces ge-1/3/8 unit 10 encapsulation vlan-bridge set interfaces ge-1/3/8 unit 10 vlan-id 10 set interfaces irb unit 10 family inet address 10.1.10.1/24 set interfaces irb unit 10 family mpls set interfaces irb unit 10 mac 00:00:00:00:00:01 set interfaces lo0 unit 10 family inet address 192.168.255.10/32 set protocols rsvp interface irb.10 set protocols mpls label-switched-path R0-1-R2 to 192.168.255.2 set protocols mpls label-switched-path R0-1-R2 install 192.168.255.2/32 active set protocols mpls label-switched-path R0-1-R2 no-cspf set protocols mpls interface irb.10 set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 192.168.255.10 set protocols bgp group ibgp neighbor 192.168.255.2 set protocols ospf area 0.0.0.0 interface irb.10 set protocols ospf area 0.0.0.0 interface lo0.10 passive set protocols ldp interface irb.10 set protocols ldp interface lo0.10 set routing-options autonomous-system 400 set bridge-domains lsbd1 vlan-id 10 set bridge-domains lsbd1 interface ge-1/3/8.10 set bridge-domains lsbd1 routing-interface irb.10
路由器 R1
set interfaces ge-1/3/8 vlan-tagging set interfaces ge-1/3/8 encapsulation flexible-ethernet-services set interfaces ge-1/3/8 unit 10 encapsulation vlan-bridge set interfaces ge-1/3/8 unit 10 vlan-id 10 set interfaces ge-1/2/8 vlan-tagging set interfaces ge-1/2/8 encapsulation flexible-ethernet-services set interfaces ge-1/2/8 unit 40 encapsulation vlan-bridge set interfaces ge-1/2/8 unit 40 vlan-id 40 set interfaces irb unit 20 family inet address 10.1.10.2/24 set interfaces irb unit 20 family mpls set interfaces irb unit 20 mac 00:00:00:00:00:02 set interfaces irb unit 30 family inet address 10.1.12.1/24 set interfaces irb unit 30 family mpls set interfaces irb unit 30 mac 00:00:00:00:00:03 set interfaces lo0 unit 20 family inet address 192.168.255.1/32 set protocols rsvp interface irb.20 set protocols rsvp interface irb.30 set protocols mpls interface irb.30 set protocols mpls interface irb.20 set protocols ospf area 0.0.0.0 interface irb.20 set protocols ospf area 0.0.0.0 interface irb.30 set protocols ospf area 0.0.0.0 interface lo0.20 passive set protocols ldp interface irb.20 set protocols ldp interface irb.30 set protocols ldp interface lo0.20 set routing-options autonomous-system 400 set bridge-domains lsbd2 vlan-id 10 set bridge-domains lsbd2 interface ge-1/3/8.10 set bridge-domains lsbd2 routing-interface irb.20 set bridge-domains lsbd3 vlan-id 40 set bridge-domains lsbd3 interface ge-1/2/8.40 set bridge-domains lsbd3 routing-interface irb.30
路由器 R2
set interfaces ge-1/2/8 vlan-tagging set interfaces ge-1/2/8 encapsulation flexible-ethernet-services set interfaces ge-1/2/8 unit 40 encapsulation vlan-bridge set interfaces ge-1/2/8 unit 40 vlan-id 40 set interfaces irb unit 40 family inet address 10.1.12.2/24 set interfaces irb unit 40 family mpls set interfaces irb unit 40 mac 00:00:00:00:00:04 set interfaces lo0 unit 30 family inet address 192.168.255.2/32 set protocols rsvp interface irb.40 set protocols mpls label-switched-path R2-1-R0 to 192.168.255.10 set protocols mpls label-switched-path R2-1-R0 no-cspf set protocols mpls interface irb.40 set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 192.168.255.2 set protocols bgp group ibgp neighbor 192.168.255.10 set protocols ospf area 0.0.0.0 interface irb.40 set protocols ospf area 0.0.0.0 interface lo0.30 passive set protocols ldp interface irb.40 set protocols ldp interface lo0.30 set routing-options autonomous-system 400 set bridge-domains lsbd4 vlan-id 40 set bridge-domains lsbd4 interface ge-1/2/8.40 set bridge-domains lsbd4 routing-interface irb.40
配置 IRB 接口的 MAC 地址
分步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
对瞻博网络路由器 R1 和 R2 重复此过程,修改每个路由器的相应接口名称、地址和任何其他参数。
要在路由器 R0 上配置 IRB 接口的 MAC 地址,请执行以下操作:
配置物理接口。
[edit interfaces ge-1/3/8]
user@R0# set vlan-tagging user@R0# set encapsulation flexible-ethernet-services user@R0# set unit 10 encapsulation vlan-bridge user@R0# set unit 10 vlan-id 10配置 IRB 逻辑接口。
[edit interfaces irb]
user@R0# set unit 10 family inet address 10.1.10.1/24 user@R0# set unit 10 family mpls user@R0# set unit 10 mac 00:00:00:00:00:01 [edit interfaces] user@R0# set lo0 unit 10 family inet address 192.168.255.10/32配置 RSVP 协议。
[edit protocols rsvp]
user@R0# set interface irb.10配置 MPLS 协议。
[edit protocols mpls]
user@R0# set label-switched-path R0-1-R2 to 192.168.255.2 user@R0# set label-switched-path R0-1-R2 install 192.168.255.2/32 active user@R0# set label-switched-path R0-1-R2 no-cspf user@R0# set interface irb.10 user@R0# set interface irb.10配置 BGP 协议。
[edit protocols BGP]
user@R0# set group ibgp type internal user@R0# set group ibgp local-address 192.168.255.10 user@R0# set group ibgp neighbor 192.168.255.2配置 OSPF 协议。
[edit protocols ospf]
user@R0# set area 0.0.0.0 interface irb.10 user@R0# set area 0.0.0.0 interface lo0.10 passive配置 LDP 协议。
[edit protocols ldp]
user@R0# set interface irb.10 user@R0# set interface lo0.10配置自治系统 (AS) 编号。
[edit routing-options]
user@R0# set autonomous-system 400配置桥接域。
[edit]
user@R0# set bridge-domains lsbd1 vlan-id 10 user@R0# set bridge-domains lsbd1 interface ge-1/3/8.10 user@R0# set bridge-domains lsbd1 routing-interface irb.10
结果
在配置模式下,输入 show interfaces、 show protocols 和 show bridge-domains命令并确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。
user@R0# show interfaces ge-1/3/8 { unit 10 { encapsulation vlan-bridge; vlan-id 10; } } irb { unit 10 { family inet { mtu 1450; address 10.1.10.1/24; } family mpls; mac 00:00:00:00:00:01; } } lo0 { unit 10 { family inet { address 192.168.255.10/32; } } } user@R0# show protocols rsvp { interface irb.10; } mpls { label-switched-path R0-1-R2 { to 192.168.255.2; install 192.168.255.2/32 active; no-cspf; } interface irb.10; } bgp { group ibgp { type internal; local-address 192.168.255.10; neighbor 192.168.255.2; } } ospf { area 0.0.0.0 { interface irb.10; interface lo0.10 { passive; } } } ldp { interface irb.10; interface lo0.10; } user@R0# show bridge-domains lsbd1 { vlan-id 10; interface ge-1/3/8.10; routing-interface irb.10; }
如果完成设备配置,请提交配置。
user@host# commit
验证
确认配置工作正常。
验证 IRB 接口的 MAC 地址
目的
验证指定的 MAC 地址是否已分配给 IRB 接口。
操作
在操作模式下,在设备上运行 show interfaces irb
命令。
user@host# show interfaces irb
Physical interface: irb, Enabled, Physical link is Up Interface index: 132, SNMP ifIndex: 505 Type: Ethernet, Link-level type: Ethernet, MTU: 1514 Device flags : Present Running Interface flags: SNMP-Traps Link type : Full-Duplex Link flags : None Current address: 80:71:1f:c2:58:f0, Hardware address: 80:71:1f:c2:58:f0 Last flapped : Never Input packets : 0 Output packets: 0 Logical interface irb.10 (Index 326) (SNMP ifIndex 634) Flags: SNMP-Traps 0x0 Encapsulation: ENET2 MAC: 00:00:00:00:00:01 Bandwidth: 1000mbps Routing Instance: LS1/default Bridging Domain: lsbd1+10 Input packets : 55202 Output packets: 69286 Protocol inet, MTU: 1450 Flags: Sendbcast-pkt-to-re, Is-Primary, User-MTU Addresses, Flags: Is-Preferred Is-Primary Destination: 10.1.10/24, Local: 10.1.10.1, Broadcast: 10.1.10.255 Addresses, Flags: Is-Preferred Destination: 10.1.12/24, Local: 10.1.12.1, Broadcast: 10.1.12.255 Protocol mpls, MTU: 1500, Maximum labels: 3 Flags: Is-Primary Protocol multiservice, MTU: 1500 Logical interface irb.20 (Index 358) (SNMP ifIndex 635) Flags: SNMP-Traps 0x0 Encapsulation: ENET2 MAC: 00:00:00:00:00:02 Bandwidth: 1000mbps Routing Instance: LS2/default Bridging Domain: lsbd2+10 Input packets : 66044 Output packets: 68464 Protocol inet, MTU: 1450 Flags: Sendbcast-pkt-to-re, Is-Primary, User-MTU Addresses, Flags: Is-Preferred Is-Primary Destination: 10.1.10/24, Local: 10.1.10.2, Broadcast: 10.1.10.255 Addresses, Flags: Is-Preferred Destination: 10.1.12/24, Local: 10.1.12.2, Broadcast: 10.1.12.255 Protocol mpls, MTU: 1500, Maximum labels: 3 Flags: Is-Primary Protocol multiservice, MTU: 1500 Logical interface irb.30 (Index 360) (SNMP ifIndex 636) Flags: SNMP-Traps 0x0 Encapsulation: ENET2 MAC: 00:00:00:00:00:03 Bandwidth: 1000mbps Routing Instance: LS2/default Bridging Domain: lsbd3+40 Input packets : 26948 Output packets: 53605 Protocol inet, MTU: 1500 Flags: Sendbcast-pkt-to-re Addresses, Flags: Is-Preferred Is-Primary Destination: 10.1.12/24, Local: 10.1.12.2, Broadcast: 10.1.12.255 Addresses, Flags: Is-Preferred Destination: 10.1.10/24, Local: 10.1.10.1, Broadcast: 10.1.10.255 Protocol mpls, MTU: 1500, Maximum labels: 3 Protocol multiservice, MTU: 1500 Logical interface irb.40 (Index 355) (SNMP ifIndex 632) Flags: SNMP-Traps 0x0 Encapsulation: ENET2 MAC: 00:00:00:00:00:04 Bandwidth: 1000mbps Routing Instance: LS3/default Bridging Domain: lsbd4+40 Input packets : 40575 Output packets: 31128 Protocol inet, MTU: 1500 Flags: Sendbcast-pkt-to-re, Is-Primary Addresses, Flags: Is-Preferred Is-Primary Destination: 10.1.12/24, Local: 10.1.12.1, Broadcast: 10.1.12.255 Protocol mpls, MTU: 1500, Maximum labels: 3 Flags: Is-Primary Protocol multiservice, MTU: 1500
意义
输出在 MAC 字段中显示手动配置的 MAC 地址。
如果未为逻辑接口配置 MAC 地址,则输出不包含此值。但是,设备在数据传输期间使用物理接口的 MAC 地址。