示例:将第 2 层电路与第 2 层 VPN 互连
此示例提供用于配置和验证将第 2 层电路连接到第 2 层 VPN 的分步过程和命令。它包含以下部分:
要求
此示例使用以下硬件和软件组件:
Junos OS 9.3 或更高版本
2 个 MX 系列 5G 通用路由平台
2 M Series 多服务边缘路由器
1 T Series 核心路由器
1 EX 系列以太网交换机
概述和拓扑
配置
在任何配置会话中,最好定期验证是否可以使用命令提交 commit check 配置。
在此示例中,使用以下命令提示符标识要配置的路由器:
CE1标识客户边缘 1 (CE1) 路由器PE1标识提供商边缘 1 (PE1) 路由器CE3标识客户边缘 3 (CE3) 路由器PE3标识提供商边缘 3 (PE3) 路由器CE5标识客户边缘 5 (CE5) 路由器PE5标识提供商边缘 5 (PE5) 路由器
此示例由以下部分组成:
在 PE 和 P 路由器上配置协议
分步程序
在此示例中,所有 PE 路由器和 P 路由器均配置了 OSPF 作为 IGP 协议。除 fxp.0 之外,所有接口均启用了 MPLS、LDP 和 BGP 协议。通过 MPLS 地址和 inet 地址启用面向核心的接口。
将所有 PE 和 P 路由器配置为 OSPF 作为 IGP。在除 以外的所有接口
fxp.0上启用 MPLS、LDP 和 BGP 协议。LDP 在路由器 PE1 上用作第 2 层电路的信令协议。以下配置片段显示了路由器 PE1 的协议配置:[edit] protocols { mpls { interface all; interface fxp0.0 { disable; } } bgp { group RR { type internal; local-address 192.0.2.1; family l2vpn { signaling; } neighbor 192.0.2.7; } } ospf { traffic-engineering; area 0.0.0.0 { interface all; interface fxp0.0 { disable; } } } ldp { interface all; interface fxp0.0 { disable; } } }将 PE 和 P 路由器配置为 OSPF 作为 IGP。在除 以外的所有接口
fxp.0上启用 MPLS、LDP 和 BGP 协议。BGP 用作第 2 层 VPN 路由器 PE3 上的信令协议。以下配置片段显示路由器 PE3 的协议配置:[edit] protocols { mpls { interface all; interface fxp0.0 { disable; } } bgp { group RR { type internal; local-address 192.0.2.3; family l2vpn { signaling; } neighbor 192.0.2.7; } } ospf { traffic-engineering; area 0.0.0.0 { interface all; interface fxp0.0 { disable; } } } ldp { interface all; interface fxp0.0 { disable; } } }
分步程序
配置接口
在路由器 PE1 上,配置
ge-1/0/0接口封装。要配置接口封装,请包含encapsulation该语句并指定ethernet-ccc选项(还支持 vlan-ccc 封装)。为电路交叉连接功能配置ge-1/0/0.0逻辑接口家族。要配置逻辑接口家族,请包含family该语句并指定该ccc选项。对于第 2 层电路域中的所有路由器,封装配置方法应相同。[edit interfaces] ge-1/0/0 { encapsulation ethernet-ccc; unit 0 { family ccc; } } lo0 { unit 0 { family inet { address 192.0.2.1/24; } } }路由器 PE5 是使用互连接口将第 2 层电路拼 接 到第 2 层 VPN 的路由器。对等单元接口的配置是进行互连的要素。
在路由器 PE5 上,使用两个逻辑接口配置
iw0接口。要配置接口,iw0请包含interfaces该语句并指定iw0为接口名称。对于单元 0 逻辑接口,请包含peer-unit该语句,并将逻辑接口unit 1指定为对等接口。对于单元 1 逻辑接口,请包含peer-unit该语句,并将逻辑接口unit 0指定为对等接口。[edit interfaces] iw0 { unit 0 { encapsulation ethernet-ccc; peer-unit 1; } unit 1 { encapsulation ethernet-ccc; peer-unit 0; } }在路由器 PE5 上,配置逻辑环路接口。环路接口用于建立到路由器 PE1 和 PE5 的目标 LDP 会话。
[edit interfaces] lo0 { unit 0 { family inet { address 192.0.2.5/24; } } }
分步程序
配置第 2 层电路协议
在路由器 PE1 上,使用
neighbor语句配置远程 PE 路由器的 IP 地址。PE 邻接方的环路地址和路由器 ID 通常是邻接方的 IP 地址。要允许建立第 2 层电路,即使 PE 路由器上配置的最大传输单元 (MTU) 与远程 PE 路由器上配置的 MTU 不匹配,请包含该ignore-mtu-mismatch语句。[edit] protocols { l2circuit { neighbor 192.0.2.5 { interface ge-1/0/0.0 { virtual-circuit-id 100; no-control-word; ignore-mtu-mismatch; } } } }在路由器 PE5 上,配置远程 PE 路由器的 IP 地址。要配置远程 PE 路由器的 IP 地址,请包含
neighbor该语句,并指定路由器 PE1 上环路接口的 IP 地址。将虚拟电路 ID 配置为与邻接方路由器上的虚拟电路 ID 相同。要允许建立第 2 层电路,即使本地 PE 路由器上配置的 MTU 与远程 PE 路由器上配置的 MTU 不匹配,请包含该ignore-mtu-mismatch语句。此外,通过包含no-control-word语句来禁用控制字进行多路分离。[edit protocols] l2circuit { neighbor 192.0.2.1 { interface iw0.0 { virtual-circuit-id 100; no-control-word; ignore-mtu-mismatch; } } }在路由器 PE5 上,通过在层次结构级别包含
l2vpn[edit routing-instances routing-instances-name protocols]语句来配置第 2 层 VPN 协议。要配置接口,iw0请包含interfaces该语句并指定iw0为接口名称。iw0接口在第 2 层 VPN 协议下进行配置,以便从逻辑接口接收环iw0.1路数据包。该l2vpn协议在路由器 PE5 上配置,站点 CE5 在 BGP L2VPN 路由实例中配置。路由器 CE1 通过路由器 PE5 上的第 2 层互连配置与路由器 CE5 通信。[edit] routing-instances { L2VPN { instance-type l2vpn; interface ge-2/0/0.0; interface iw0.1; route-distinguisher 65000:5; vrf-target target:65000:2; protocols { l2vpn { no-control-word; encapsulation-type ethernet; site CE5 { site-identifier 5; interface ge-2/0/0.0 { remote-site-id 3; } } site l2-circuit { site-identifier 6; interface iw0.1 { remote-site-id 3; } } } } } }除了接口配置之外
iw0,还必须配置第 2 层互连l2iw协议。如果没有l2iw协议配置,无论是否存在任何iw接口,都不会形成第 2 层互连路由。在路由器 PE5 上,配置
l2iw协议。要配置协议,请在层次结构级别包含l2iw[edit protocols]该语句。[edit] protocols { l2iw; }
验证
分步程序
验证路由器 PE1 上的第 2 层电路连接。
在路由器 PE1 上,使用命令
show l2circuit connections验证从路由器 PE1 到路由器 PE5 的第 2 层电路是否正确。Upuser@PE1> show l2circuit connections Layer-2 Circuit Connections: Legend for connection status (St) EI -- encapsulation invalid NP -- interface h/w not present MM -- mtu mismatch Dn -- down EM -- encapsulation mismatch VC-Dn -- Virtual circuit Down CM -- control-word mismatch Up -- operational VM -- vlan id mismatch CF -- Call admission control failure OL -- no outgoing label IB -- TDM incompatible bitrate NC -- intf encaps not CCC/TCC TM -- TDM misconfiguration BK -- Backup Connection ST -- Standby Connection CB -- rcvd cell-bundle size bad XX -- unknown SP -- Static Pseudowire Legend for interface status Up -- operational Dn -- down Neighbor: 192.0.2.5 Interface Type St Time last up # Up trans ge-1/0/0.0(vc 100) rmtUpJan 3 22:00:49 2010 1 Remote PE: 192.0.2.5, Negotiated control-word: No Incoming label: 301328, Outgoing label: 300192 Local interface: ge-1/0/0.0, Status: Up, Encapsulation: ETHERNET在路由器 PE5 上,使用命令验证
show l2vpn connections第 2 层 VPN 连接Up是否使用iw0第 2 层电路的对等接口。user@PE5> show l2vpn connections Instance: L2VPN Local site: CE5 (5) connection-site Type St Time last up # Up trans l2-circuit (6) loc OR 3 rmtUpJan 3 22:51:12 2010 1 Remote PE: 192.0.2.3, Negotiated control-word: No Incoming label: 800258, Outgoing label: 800000 Local interface: ge-2/0/0.0, Status: Up, Encapsulation: ETHERNET Local site: l2-circuit (6) connection-site Type St Time last up # Up trans CE5 (5) loc OR 3 rmt Up Jan 3 22:56:38 2010 1 Remote PE: 192.0.2.3, Negotiated control-word: No Incoming label: 800262, Outgoing label: 800001 Local interface:iw0.1, Status:Up, Encapsulation: ETHERNET
分步程序
验证第 2 层电路是否终止到第 2 层 VPN 连接。
在路由器 PE5 上,使用命令
show l2circuit connections验证第 2 层电路是否Up正在使用该iw0接口。这将通过iwo.1接口循环到第 2 层 VPN。user@PE5> show l2circuit connections Layer-2 Circuit Connections: Neighbor: 192.0.2.1 Interface Type St Time last up # Up transiw0.0(vc 100) rmtUpJan 3 21:59:07 2010 1 Remote PE: 192.0.2.1, Negotiated control-word: No Incoming label: 300192, Outgoing label: 301328在路由器 PE 5 上,使用命令
show route table mpls.0验证第 2 层电路和第 2 层 VPN 路由。在以下示例中,第 2 层电路与 LDP 标签301328相关联,第 2 层 VPN 与 LDP 标签800001相关联。请注意用于第 2 层互连路由的两个iw0接口。user@PE5>show route table mpls.0 mpls.0: 18 destinations, 20 routes (18 active, 2 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0 *[MPLS/0] 5d 20:07:31, metric 1 Receive 1 *[MPLS/0] 5d 20:07:31, metric 1 Receive 2 *[MPLS/0] 5d 20:07:31, metric 1 Receive 299776 *[LDP/9] 2d 03:00:51, metric 1 300048 *[LDP/9] 2d 03:00:49, metric 1 > to 10.10.6.1 via xe-0/1/0.0, Pop 300048(S=0) *[LDP/9] 2d 03:00:49, metric 1 > to 10.10.6.1 via xe-0/1/0.0, Pop 300192 *[L2IW/6] 19:11:05, metric2 1 > to 10.10.6.1 via xe-0/1/0.0, Swap 800001 [L2CKT/7] 20:08:36 > via iw0.0, Pop 800258 *[L2VPN/7] 19:16:31 > via ge-2/0/0.0, Pop Offset: 4800262 *[L2IW/6] 19:11:05, metric2 1 > to 10.10.3.1 via xe-1/1/0.0, Swap 301328 [L2VPN/7] 19:11:05 > via iw0.1, Pop Offset: 4ge-2/0/0.0 *[L2VPN/7] 19:16:31, metric2 1 > to 10.10.6.1 via xe-0/1/0.0, Push 800000 Offset: -4 iw0.0 *[L2CKT/7]20:08:36, metric2 1 > to 10.10.3.1 via xe-1/1/0.0, Push301328iw0.1 *[L2VPN/7]19:11:05, metric2 1 > to 10.10.6.1 via xe-0/1/0.0, Push800001Offset: -4

