示例:基于以太网的第 2 层 电路配置
在图 1 中,在路由器 PE1 和 PE2 之间建立了第 2 层电路,以便在客户路由器 CE1 和 CE2 之间传递第 2 层 流量。仅在 PE 路由器上配置第 2 层 电路 VC 连接。客户边缘 路由器不需要特殊配置,提供商核心 P0 路由器只需要相应接口上的 MPLS 和 LDP,即可在 PE 路由器之间共享标签。
在路由器 CE1 上,配置快速以太网接口以处理 VLAN 流量。请务必在此处和路由器 CE2 的快速以太网接口上使用相同的 VLAN ID。
路由器 CE1
[edit] interfaces { fe-1/1/2 { description "to PE1 fe-1/1/0"; vlan-tagging; unit 600 { vlan-id 600; # Be sure this VLAN ID matches the VLAN ID of your CE neighbor. family inet { address 10.1.1.1/24; } } } }
在路由器 PE1 上,使用您选择的 CCC 封装类型配置基于以太网的面向 CE 的接口。如果使用 VLAN CCC,请在 /pic
/port]
层次结构级别包含ethernet-interface-fpc
vlan-tagging
[edit interfaces
语句。此外,在 /pic
/ 和 [edit interfaces
ethernet-interface-fpc
// unit
unit-number]
port]
pic
port
层次结构级别都包含encapsulation vlan-ccc
[edit interfaces
ethernet-interface-fpc
语句。
通过在层次结构级别配置l2circuit
[edit protocols]
语句来建立第 2 层 电路。请记住在第 2 层 电路配置中包含远程 PE 邻居的 IP 地址(通常是邻居的环路地址)、连接到客户边缘路由器的接口以及此 VC 的虚拟电路标识符。然后,配置 MPLS、LDP 和 IGP(例如 OSPF),为第 2 层 电路启用信令。
路由器 PE1
[edit] interfaces { so-0/1/0 { description "to P0 so-0/0/0"; unit 0 { family inet { address 192.168.245.22/30; } family mpls; # Include the MPLS family on core-facing interfaces. } } fe-1/1/0 { description "to CE1 fe-1/1/2"; vlan-tagging; encapsulation vlan-ccc; # Configure CCC encapsulation on CE-facing interfaces. unit 600 { encapsulation vlan-ccc; # Enable this encapsulation on the logical interface. vlan-id 600; } } lo0 { unit 0 { family inet { address 10.245.14.173/32; } } } } protocols { ospf { traffic-engineering; area 0.0.0.0 { interface so-0/1/0.0; interface lo0.0; } } ldp { # LDP is required as the signaling protocol for Layer 2 circuits. interface so-0/1/0.0; interface lo0.0;# You must include the loopback address in LDP. } l2circuit { neighbor 10.245.14.179 { # This points to the loopback of the PE neighbor. interface fe-1/1/0.600 { # Here you include the local CE-facing interface. virtual-circuit-id 5; # Be sure this ID matches the ID of your PE neighbor. } } } }
在路由器 P0 上,在连接到 PE 路由器的接口上配置 LDP、MPLS 和 OSPF。核心路由器提供将第 2 层 流量从入口 PR 路由器隧道传输到出口 PE 路由器所需的 MPLS 主干网。
路由器 P0
[edit] interfaces { so-0/0/0 { description "to PE1 so-0/1/0"; unit 0 { family inet { address 192.168.245.21/30; } family mpls; # Include the MPLS family on core interfaces. } } t3-0/2/1 { description "to PE2 t3-0/1/0"; unit 0 { family inet { address 192.168.245.17/30; } family mpls; # Include the MPLS family on core interfaces. } } lo0 { unit 0 { family inet { address 10.245.14.171/32; } } } } protocols { ospf { traffic-engineering; area 0.0.0.0 { interface so-0/0/0.0; interface t3-0/2/1.0; } } ldp { # LDP is required as the signaling protocol for Layer 2 circuits. interface so-0/0/0.0; interface t3-0/2/1.0; } }
在路由器 PE2 上,通过配置语句以匹配之前在路由器 PE1 上设置的语句来完成第 2 层 电路。使用 CCC 封装配置基于以太网的面向 CE 的接口。同样,使用 VLAN CCC 时,必须在 //port]
pic
层次结构级别包含ethernet-interface-fpc
vlan-tagging
[edit interfaces
语句。此外,在 /pic
/ 和 [edit interfaces
ethernet-interface-fpc
// unit
unit-number]
port]
pic
port
层次结构级别都包含encapsulation vlan-ccc
[edit interfaces
ethernet-interface-fpc
语句。
通过在层次结构级别配置l2circuit
[edit protocols]
语句来建立第 2 层 电路。请记住在第 2 层 电路配置中包含远程 PE 邻居(路由器 PE1)的 IP 地址、之前在路由器 PE1 上配置的虚拟电路标识符以及连接到客户边缘路由器的接口。最后,配置 MPLS、LDP 和 OSPF,为第 2 层 电路启用信令。
路由器 PE2
[edit] interfaces { t3-0/1/0 { description "P0 t3-0/2/1"; unit 0 { family inet { address 192.168.245.18/30; } family mpls; # Include the MPLS family on core-facing interfaces. } } fe-0/2/0 { description "to CE2 fe-0/2/0"; vlan-tagging; encapsulation vlan-ccc; # Configure CCC encapsulation on CE-facing interfaces. unit 600 { encapsulation vlan-ccc; # Enable this encapsulation on the logical interface. vlan-id 600; } } lo0 { unit 0 { family inet { address 10.245.14.179/32; } } } } protocols { ospf { traffic-engineering; area 0.0.0.0 { interface t3-0/1/0.0; interface lo0.0; } } ldp { # LDP is required as the signaling protocol for Layer 2 circuits. interface t3-0/1/0.0; interface lo0.0; # You must include the loopback address in LDP. } l2circuit { neighbor 10.245.14.173 { # This points to the loopback of the PE neighbor. interface fe-0/2/0.600 { # Here you include the local CE-facing interface. virtual-circuit-id 5; # Be sure this ID matches the ID of your PE neighbor. } } } }
在路由器 CE2 上,配置快速以太网接口以处理 VLAN 流量。确保在此接口上使用与路由器 CE1 快速以太网接口上相同的 VLAN ID。
路由器 CE2
[edit] interfaces { fe-0/2/0 { description "to PE2 fe-0/2/0"; vlan-tagging; unit 600 { vlan-id 600; # Be sure this VLAN ID matches the VLAN ID of your CE neighbor. family inet { address 10.1.1.2/24; } } } }
验证您的工作
要验证第 2 层 电路的正常运行,请使用以下命令:
ping mpls l2circuit interfaceinterface-name
ping mpls l2circuit virtual-circuit virtual-circuit-id neighbor
ip-address
show l2circuit connections
选项:
[brief] | [down] | [extensive] | [history] | [instance] | [local-site] | [remote-site] |[status] | [summary] | [up] | [up-down]
show ldp database
除了显示 IP 前缀的绑定外,该 show ldp database
命令还显示第 2 层 FEC 的绑定。
以下部分显示了与配置示例一起使用的这些命令的输出:
路由器 PE1 状态
user@PE1> show l2circuit connections Layer-2 Circuit Connections: Legend for connection status (St) Legend for interface status EI -- encapsulation invalid UP -- operational MM -- mtu mismatch Dn -- down EM -- encapsulation mismatch NP -- no present OL -- no outgoing label DS -- disabled Dn -- down WE -- wrong encapsulation VC-Dn -- Virtual circuit Down UN -- uninitialized UP -- operational XX -- unknown Neighbor: 10.245.14.179 Interface Type St Time last up # Up trans fe-1/1/0.600 (vc 5) rmt Up Nov 30 00:54:55 2001 1 Local interface: fe-1/1/0.600, Status: Up, Encapsulation: VLAN Remote PE: 10.245.14.179, Negotiated control-word: Yes (Null) Incoming label: 100007, Outgoing label: 100000 user@PE1> show ldp database Input label database, 10.245.14.173:0-10.245.14.171:0 Label Prefix 100019 10.245.14.173/32 100020 10.245.14.179/32 3 10.245.14.171/32 Output label database, 10.245.14.173:0-10.245.14.171:0 Label Prefix 100009 10.245.14.179/32 3 10.245.14.173/32 100008 10.245.14.171/32 Input label database, 10.245.14.173:0-10.245.14.179:0 Label Prefix 100001 10.245.14.171/32 100002 10.245.14.173/32 3 10.245.14.179/32 100000 L2CKT VLAN VC 5 Output label database, 10.245.14.173:0-10.245.14.179:0 Label Prefix 100009 10.245.14.179/32 3 10.245.14.173/32 100008 10.245.14.171/32 100007 L2CKT VLAN VC 5
路由器 P0 状态
user@P0> show ldp database Input label database, 10.245.14.171:0-10.245.14.173:0 Label Prefix 3 10.245.14.173/32 100009 10.245.14.179/32 100008 10.245.14.171/32 Output label database, 10.245.14.171:0-10.245.14.173:0 Label Prefix 100019 10.245.14.173/32 100020 10.245.14.179/32 3 10.245.14.171/32 Input label database, 10.245.14.171:0-10.245.14.179:0 Label Prefix 100001 10.245.14.171/32 3 10.245.14.179/32 100002 10.245.14.173/32 Output label database, 10.245.14.171:0-10.245.14.179:0 Label Prefix 100019 10.245.14.173/32 100020 10.245.14.179/32 3 10.245.14.171/32
路由器 PE2 状态
user@PE2> show l2circuit connections Layer-2 Circuit Connections: Legend for connection status (St) Legend for interface status EI -- encapsulation invalid UP -- operational MM -- mtu mismatch Dn -- down EM -- encapsulation mismatch NP -- no present OL -- no outgoing label DS -- disabled Dn -- down WE -- wrong encapsulation VC-Dn -- Virtual circuit Down UN -- uninitialized UP -- operational XX -- unknown Neighbor: 10.245.14.173 Interface Type St Time last up # Up trans fe-0/2/0.600 (vc 5) rmt Up Nov 30 00:54:54 2001 1 Local interface: fe-0/2/0.600, Status: Up, Encapsulation: VLAN Remote PE: 10.245.14.173, Negotiated control-word: Yes (Null) Incoming label: 100000, Outgoing label: 100007 user@PE2> show ldp database Input label database, 10.245.14.179:0-10.245.14.171:0 Label Prefix 100019 10.245.14.173/32 3 10.245.14.171/32 100020 10.245.14.179/32 Output label database, 10.245.14.179:0-10.245.14.171:0 Label Prefix 100001 10.245.14.171/32 100002 10.245.14.173/32 3 10.245.14.179/32 Input label database, 10.245.14.179:0-10.245.14.173:0 Label Prefix 3 10.245.14.173/32 100008 10.245.14.171/32 100009 10.245.14.179/32 100007 L2CKT VLAN VC 5 Output label database, 10.245.14.179:0-10.245.14.173:0 Label Prefix 100001 10.245.14.171/32 100002 10.245.14.173/32 3 10.245.14.179/32 100000 L2CKT VLAN VC 5