示例:配置 IS-IS 的第 2 层映射
此示例说明如何为 IS-IS 配置第 2 层映射,即将第 2 层 MAC 地址映射到转发下一跃点的 IPv4 地址。在激活以太网链路的同时,第 2 层映射可最大限度减少流量丢失,提供更好的安全性,并减少核心链路上的第 2 层分辨率处理。
要求
此示例使用以下硬件和软件组件:
两台 MX 系列路由器
在所有设备上运行的 Junos OS 16.1 或更高版本
概述
第 2 层映射可确保转发下一跃点解析由拓扑驱动,而非由流量驱动。IS-IS LAN 和点对点 Hellos 提供所有相关的第 2 层和第 3 层绑定地址信息,以便进行地址解析。接收端的设备可以使用这些信息填充内核的 ARP 或邻居发现缓存,甚至可以在路由安装之前进行填充。启用第 2 层映射后,IS-IS 会将 ARP 或邻接方发现下一跃点条目安装到转发表中。由于这会提前提供第 2 层下一跃点绑定,因此 IS-IS 网络在建立链路时不会出现流量丢失的情况。
拓扑学
在 图 1 中,路由器 R1 连接到路由器 R2。在路由器 R1 上启用了第 2 层映射。路由器 R2 从路由器 R1 接收第 2 层信息并更新转转发表。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层 [edit]
级的 CLI 中,然后从配置模式进入 commit
。
路由器 R1
set interfaces ge-1/0/3 description R0–>R1_1 set interfaces ge-1/0/3 unit 0 family inet address 192.10.1.1/24 set interfaces ge-1/0/3 unit 0 family iso set interfaces ge-1/0/3 unit 0 family inet6 address 0000:0000:0000:0000:192:10:1:1/120 set interfaces ge-1/0/3 unit 0 family mpls set interfaces ge-1/0/7 description R0–>RT0 set interfaces ge-1/0/7 unit 0 family inet address 193.1.1.1/30 set interfaces ge-1/0/7 unit 0 family iso set interfaces ge-1/0/7 unit 0 family inet6 address 0000:0000:0000:0000:193:1:1:1/120 set interfaces ge-1/0/7 unit 0 family mpls set interfaces ge-1/1/1 description R0–>R1_2 set interfaces ge-1/1/1 unit 0 family inet address 192.10.2.1/30 set interfaces ge-1/1/1 unit 0 family iso set interfaces ge-1/1/1 unit 0 family inet6 address 0000:0000:0000:0000:192:10:2:1/120 set interfaces ge-1/1/1 unit 0 family mpls set lo0 unit 0 family inet address 10.255.162.100/32 set routing-options router-id 10.255.162.100 set protocols rsvp interface all set protocols rsvp interface lo0.0 set protocols rsvp interface fxp0.0 disable set protocols mpls interface all set protocols mpls interface lo0.0 set protocols mpls interface fxp0.0 disable set protocols isis layer2-map set protocols isis interface ge-1/0/3.0 level 2 disable set protocols ldp interface all set protocols ldp interface fxp0.0 disable set protocols ldp interface lo0.0
路由器 R2
set interfaces ge-0/0/2 descriptionR0–>R1_1 set interfaces ge-0/0/2 unit 0 family inet address 192.10.1.2/24 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family inet6 address 0000:0000:0000:0000:192:10:1:2/120 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-2/0/3 description R1–>RT0 set interfaces ge-2/0/3 unit 0 family inet address 193.2.1.1/30 set interfaces ge-2/0/3 unit 0 family iso set interfaces ge-2/0/3 unit 0 family inet6 address 0000:0000:0000:0000:193:2:1:1/120 set interfaces ge-2/0/3 unit 0 family mpls set interfaces ge-2/0/8 description R0–>R1_2 set interfaces ge-2/0/8 unit 0 family inet address 192.10.2.2/30 set interfaces ge-2/0/8 unit 0 family iso set interfaces ge-2/0/8 unit 0 family inet6 address 0000:0000:0000:0000:192:10:2:2/120 set interfaces ge-2/0/8 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.162.102/32 set routing-options router-id 10.255.162.109 set protocols rsvp interface all set protocols rsvp interface lo0.0 set protocols rsvp interface fxp0.0 disable set protocols mpls interface all set protocols mpls interface lo0.0 set protocols mpls interface fxp0.0 disable set protocols isis interface ge-0/0/2.0 level 2 disable set protocols ldp interface all set protocols ldp interface fxp0.0 disable set protocols ldp interface lo0.0
程序
分步过程
下面的示例要求您在各个配置层级中进行导航。有关 CLI 导航的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要在路由器 R1 上配置第 2 层映射:
在修改相应的接口名称、地址和其他参数后,对路由器 2 重复此过程。
配置设备接口。
[edit interfaces] user@R1# set ge-1/0/3 description R0–>R1_1 user@R1# set ge-1/0/3 unit 0 family inet address 192.10.1.1/24 user@R1# set ge-1/0/3 unit 0 family iso user@R1# set ge-1/0/3 unit 0 family inet6 address 0000:0000:0000:0000:192:10:1:1/120 user@R1# set ge-1/0/3 unit 0 family mpls user@R1# set ge-1/0/7 description R0–>RT0 user@R1# set ge-1/0/7 unit 0 family inet address 193.1.1.1/30 user@R1# set ge-1/0/7 unit 0 family iso user@R1# set ge-1/0/7 unit 0 family inet6 address 0000:0000:0000:0000:193:1:1:1/120 user@R1# set ge-1/0/7 unit 0 family mpls user@R1# set ge-1/1/1 description R0–>R1_2 user@R1# set ge-1/1/1 unit 0 family inet address 192.10.2.1/30 user@R1# set ge-1/1/1 unit 0 family iso user@R1# set ge-1/1/1 unit 0 family inet6 address 0000:0000:0000:0000:192:10:2:1/120 user@R1# set ge-1/1/1 unit 0 family mpls
配置环路接口。
[edit interfaces] user@R1# set lo0 unit 0 family inet address 10.255.162.100/32
配置路由器 ID。
[edit routing-options] user@R1# set router-id 10.255.162.100
在所有接口上配置 RSVP、MPLS 和 LDP,管理接口除外。
[edit protocols] user@R1# set rsvp interface all user@R1# set rsvp interface lo0.0 user@R1# set rsvp interface fxp0.0 disable user@R1# set mpls interface all user@R1# set mpls interface lo0.0 user@R1# set mpls interface fxp0.0 disable user@R1# set ldp interface all user@R1# set ldp interface fxp0.0 disable user@R1# set ldp interface lo0.0
启用第 2 层映射。
[edit protocols] user@R1# set isis layer2-map
禁用接口 ge-1/0/3.0 上的 2 级 IS-IS。
[edit protocols] user@R1# set isis interface ge-1/0/3.0 level 2 disable
结果
在配置模式下,输入show interfaces
show protocols
、和show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
[edit] user@R1# show interfaces ge-1/0/3 { description 0–>R1_1; unit 0 { family inet { address 192.10.1.1/24; } family iso; family inet6 { address 0000:0000:0000:0000:192:10:1:1/120; } family mpls; } } ge-1/0/7 { description R0–>RT0; unit 0 { family inet { address 193.1.1.1/30; } family iso; family inet6 { address 0000:0000:0000:0000:193:1:1:1/120; } family mpls; } } ge-1/1/1 { description R0–>R1_2; unit 0 { family inet { address 192.10.2.1/30; } family iso; family inet6 { address 0000:0000:0000:0000:192:10:2:1/120; } family mpls; } } lo0 { unit 0 { family inet { address 10.255.162.100/32; } } }
[edit] user@R1# show protocols rsvp { interface all; interface lo0.0; interface fxp0.0 { disable; } } mpls { interface all; interface lo0.0; interface fxp0.0 { disable; } } isis { layer2-map; } ldp { interface all; interface fxp0.0 { disable; } interface lo0.0; }
[edit] user@R1# show routing-options router-id 10.255.162.100;
如果完成设备配置,请提交配置。
user@R1# commit
验证
确认配置工作正常。
验证 IS-IS 邻接
目的
验证路由器 R1 和路由器 R2 之间是否已形成预期的邻接。
行动
在作模式下,在路由器 R1 上运行 show isis adjacency 命令。
user@R1> show isis adjacency Interface System L State Hold (secs) SNPA ge-1/0/3.0 R2 1 Up 8 88:e0:f3:5e:e8:2
意义
路由器 R1 上的接口 ge-1/0/3.0 已与路由器 R2 建立邻接关系。
验证是否已启用第 2 层映射
目的
验证路由器 R1 上是否已启用第 2 层映射。
行动
在作模式下,在路由器 R1 上运行 show isis interface detail 命令。
user@R1> show isis interface detail IS-IS interface database: ge-1/0/3.0 Index: 196612, State: 0x6, Circuit id: 0x1, Circuit type: 1 LSP interval: 100 ms, CSNP interval: 10 s Adjacency advertisement: Advertise, Layer2-map: Enabled Level Adjacencies Priority Metric Hello (s) Hold (s) Designated Router 1 1 64 10 9.000 27 R2.02 (not us) 2 0 64 10 Disabled
意义
输出确认路由器 R1 上已启用第 2 层映射。
验证是否映射了第 2 层地址
目的
在内核中显示路由实例的第 3 层下一跃点和映射的数据链路地址。
行动
在作模式下,在路由器 R1 上运行 show isis layer2-map 命令。
user@R1> show isis layer2-map Layer2 mapping database for instance master IP Address Interface SNPA Refresh State 192.10.1.2 ge-1/0/3.0 88:e0:f3:5e:e8:2 00:11:54 fe80::8ae0:f3ff:fe5e:e802 ge-1/0/3.0 88:e0:f3:5e:e8:2 00:04:02 IPv4 records: 1 IPv6 records: 1
意义
下一跃点的第 2 层 MAC 地址映射到内核中接口 ge-1/0/3.0 的 IP 地址。