在上一篇文章《Juniper MPLS L2Circuit(Ethernet-CCC)虚拟网线实战》中,我们演示了如何利用 L2Circuit(也称 Pseudo-Wire 或 EoMPLS)提供点对点二层透明连接。但在上一篇的场景中,伪线的 A 端与 Z 端均外接独立设备(服务器或对端路由器)。如果路由器自身就想作为伪线的 Z 端,直接在全局路由表内与远端上游建立三层接口和 BGP 会话,则需要借助 Juniper 的 Logical-Tunnel(lt-) 接口来实现内部对接。
实验拓扑与业务场景
设想这样一个常见骨干网架构场景:核心路由器 CoreRouter(AS 65001,192.168.0.2)需要与运营商 Upstream(AS 65000,100.64.0.2/31)建立 eBGP 会话并接收全表,但 Upstream 只能把物理光缆接入边缘节点 Edge-Extend(192.168.0.1)所在的 POP 机房,而 Edge-Extend 的硬件性能不足以承载互联网全表路由。
因此,我们在 Edge-Extend 的 ge-0/0/0 上配置 ethernet-ccc,通过 MPLS L2Circuit(VC 100)将上游物理链路透明拉回 CoreRouter,并在 CoreRouter 内部利用 Logical-Tunnel 把伪线接入全局路由表(inet.0)直接与 Upstream 建立 BGP 邻居。
一、配置 Edge-Extend 与 CoreRouter 隧道硬件资源
上游路由器 Upstream 已预配置好 eBGP 会话;Edge-Extend 与 CoreRouter 之间已预配置好基于 L-ISIS 的 SR-MPLS 传输层(使用传统 LDP + IS-IS/OSPF 同样适用,同时开启 targeted LDP 用于 RFC 4447 L2Circuit 信令协商)。
首先在 Edge-Extend 上配置 L2Circuit 指向 CoreRouter(192.168.0.2):
protocols {
mpls {
interface ge-0/0/1.0;
}
ldp {
transport-address router-id;
interface ge-0/0/1.0;
interface lo0.0;
}
l2circuit {
neighbor 192.168.0.2 {
interface ge-0/0/0.0 {
virtual-circuit-id 100;
no-control-word;
}
}
}
}
随后在 CoreRouter 上开启 tunnel-services(Logical-Tunnel lt- 接口依赖于 FPC/PIC 上的隧道服务资源),并完成 MPLS 与 LDP 基础配置:
root> show configuration chassis
fpc 0 {
pic 0 {
tunnel-services {
bandwidth 100g;
}
inline-services {
bandwidth 100g;
}
}
} // 打开 tunnel-services 以创建 lt-0/0/0 逻辑隧道接口
ldp {
transport-address router-id;
interface ge-0/0/1.0;
interface lo0.0;
}
mpls {
interface ge-0/0/1.0;
}
二、配置 Logical-Tunnel(lt-0/0/0)并内部对接 L2Circuit
在 CoreRouter 上创建成对互指(peer-unit)的 lt-0/0/0 两个逻辑子接口:unit 0 封装 ethernet-ccc 对接 L2Circuit,unit 1 封装普通以太网并配置三层互联地址 100.64.0.3/31 放入全局路由表(GRT),实现路由器内部闭环:
root> show configuration interfaces lt-0/0/0
unit 0 {
encapsulation ethernet-ccc; // lt 的 unit 0 封装 ethernet-ccc 模式,以便与 L2Circuit VC 对接
peer-unit 1; // unit 0 与 unit 1 组成逻辑隧道两端
family ccc; // 激活 ccc family 对接二层伪线
}
unit 1 {
encapsulation ethernet; // 封装普通以太网模式,让 unit 1 作为虚拟 Z 端接入全局路由表
peer-unit 0; // unit 0 与 unit 1 组成逻辑隧道两端
family inet {
address 100.64.0.3/31; // 配置与 Upstream 对接的三层互联 IP(位于 GRT)
}
} // 此时 A 端在 Edge-Extend ge-0/0/0,Z 端已无缝接入 CoreRouter 的 GRT
root> show configuration protocols l2circuit
neighbor 192.168.0.1 {
interface lt-0/0/0.0 { // 将 lt-0/0/0.0 绑定至 VC 100 伪线
virtual-circuit-id 100;
no-control-word;
}
}
三、验证 L2Circuit 状态、eBGP 邻居与端到端转发
在 CoreRouter 上检查 L2Circuit 连接状态,确认 lt-0/0/0.0(vc 100) 已正常 UP(标签 299776):
root> show l2circuit connections
Layer-2 Circuit Connections:
{..snip..}
Legend for interface status
Up -- operational
Dn -- down
Neighbor: 192.168.0.1
Interface Type St Time last up # Up trans
lt-0/0/0.0(vc 100) rmt Up May 30 10:58:31 2021 1
Remote PE: 192.168.0.1, Negotiated control-word: No
Incoming label: 299776, Outgoing label: 299776
Negotiated PW status TLV: No
Local interface: lt-0/0/0.0, Status: Up, Encapsulation: ETHERNET
Flow Label Transmit: No, Flow Label Receive: No
随后在 CoreRouter 上配置指向 Upstream(100.64.0.2)的 eBGP 会话,并检查邻居状态是否达到 Established:
root> show configuration protocols bgp
group external {
type external;
import accept-all; // 接收来自 Upstream 的路由
export export-direct; // 通告本地 Client 网段路由(生产环境请按需收敛过滤策略)
peer-as 65000;
local-as 65001;
neighbor 100.64.0.2;
}
root> show bgp summary
Threading mode: BGP I/O
Groups: 1 Peers: 1 Down peers: 0
Table Tot Paths Act Paths Suppressed History Damp State Pending
inet.0
1 1 0 0 0 0
Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
100.64.0.2 65000 37 37 0 0 15:38 Established inet.0: 1/1/1/0
最后在下游 Client 主机上对目标服务器 8.8.8.8 执行 ping 与 mtr 测试。从 MTR 路径可以清晰看到:数据包从 Client 到达 CoreRouter 网关 10.0.0.1 后,下一跳直接显示为 Upstream 的 100.64.0.2,中间的 Edge-Extend 与 MPLS 传输层在三层路由跳数上完全透明:
root@localhost:~# ping 8.8.8.8 -c 3 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=62 time=11.9 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=62 time=9.22 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=62 time=12.0 ms --- 8.8.8.8 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 5ms rtt min/avg/max/mdev = 9.221/11.039/11.989/1.289 ms root@localhost:~# mtr 8.8.8.8 --report Start: 2021-05-30T13:02:25+0000 HOST: localhost Loss% Snt Last Avg Best Wrst StDev 1.|-- 10.0.0.1 0.0% 10 11.9 67.7 1.6 373.7 119.6 2.|-- 100.64.0.2 0.0% 10 5.8 6.6 2.9 12.7 3.0 3.|-- 8.8.8.8 0.0% 10 6.5 11.6 6.5 25.3 6.0
至此,CoreRouter 成功借助 Logical-Tunnel 在设备内部完成了与 L2Circuit 伪线的无缝对接,兼顾了边缘 POP 端口扩展灵活性与核心全表路由能力。