具有第 3 层 VPN 配置的 SCU
在第 3 层 VPN 中配置 SCU

图 1 显示第 3 层 VPN 拓扑。CE1 和 CE2 是客户边缘 (CE) 路由器,通过 VPN 通过提供商路由器 PE1、P0 和 PE2 进行连接。EBGP 在路由器 CE1 和 PE1 之间建立,IBGP 通过 IS-IS/MPLS/LDP 核心连接路由器 PE1 和 PE2,第二个 EBGP 连接在路由器 PE2 和 CE2 之间流动。
在路由器 CE1 上,通过设置到 PE1 的 EBGP 连接来启动您的 VPN。安装 的 10.114.1.0/24 静态路由并将此路由播发到 EBGP 邻居。
路由器 CE1
[edit]
interfaces {
ge-0/0/0 {
unit 0 {
family inet {
address 10.20.250.1/30;
}
}
}
}
routing-options {
static {
route 10.114.1.0/24 reject;
}
autonomous-system 100;
}
protocols {
bgp {
group to-pe1 {
local-address 10.20.250.1;
export inject-direct;
peer-as 300;
neighbor 10.20.250.2;
}
}
}
policy-options {
policy-statement inject-direct {
term 1 {
from {
protocol static;
route-filter 10.114.1.0/24 exact;
}
then accept;
}
term 2 {
from protocol direct;
then accept;
}
}
}
在 PE1 上,通过 VRF 路由实例完成到 CE1 的 EBGP 连接。为 VRF 实例设置导出策略,将 BGP 流量放入社区,并设置接受来自 VPN 邻接方的类似社区流量的导入策略。最后,配置与在 IS-IS、MPLS 和 LDP 核心上运行的路由器 PE2 的 IBGP 关系。
路由器 PE1
[edit]
interfaces {
ge-0/0/1 {
unit 0 {
family inet {
address 10.20.250.2/30;
}
}
}
so-0/2/1 {
unit 0 {
family inet {
address 10.20.251.1/30;
}
family iso;
family mpls;
}
}
lo0 {
unit 0 {
family inet {
address 10.250.245.245/32;
}
family iso;
family mpls;
}
}
}
routing-options {
autonomous-system 300;
}
protocols {
mpls {
interface so-0/2/1;
}
bgp {
group ibgp {
type internal;
local-address 10.250.245.245;
family inet-vpn {
unicast;
}
neighbor 10.250.71.14;
}
}
isis {
interface so-0/2/1;
}
ldp {
interface so-0/2/1;
}
}
policy-options {
policy-statement red-import {
from {
protocol bgp;
community red-com;
}
then accept;
}
policy-statement red-export {
from protocol bgp;
then {
community add red-com;
accept;
}
}
community red-com members target:20:20;
}
routing-instances {
red {
instance-type vrf;
interface ge-0/0/1.0;
route-distinguisher 10.250.245.245:100;
vrf-import red-import;
vrf-export red-export;
protocols {
bgp {
group to-ce1 {
local-address 10.20.250.2;
peer-as 100;
neighbor 10.20.250.1;
}
}
}
}
}
在 P0 上,连接位于 PE1 和 PE2 的 IBGP 邻居。请记住在所有接口上包含与 VPN 相关的协议(MPLS、LDP 和 IGP)。
路由器 P0
[edit]
interfaces {
so-0/1/0 {
unit 0 {
family inet {
address 10.20.252.1/30;
}
family iso;
family mpls;
}
}
so-0/2/0 {
unit 0 {
family inet {
address 10.20.251.2/30;
}
family iso;
family mpls;
}
}
lo0 {
unit 0 {
family inet {
address 10.250.245.246/32;
}
family iso;
family mpls;
}
}
}
routing-options {
autonomous-system 300;
}
protocols {
mpls {
interface so-0/1/0;
interface so-0/2/0;
}
isis {
interface all;
}
ldp {
interface all;
}
}
在 PE2 上,完成与路由器 PE1 的 IBGP 关系。通过 VRF 路由实例建立到 CE2 的 EBGP 连接。为将 BGP 流量放入社区的 VRF 实例设置导出策略,以及接受来自 VPN 邻接方的类似社区流量的导入策略。接下来,建立一个策略,将来自 CE1 的静态路由添加到名为 的 GOLD1源类。此外,将此 SCU 策略导出到转发表中。最后,将 vt 接口设置为SCU输入接口,并将面向CE的接口 so-0/0/0 建立为SCU输出接口。
路由器 PE2
[edit]
interfaces {
so-0/1/1 {
unit 0 {
family inet {
address 10.20.252.2/30;
}
family iso;
family mpls;
}
}
so-0/0/0 {
unit 0 {
family inet {
accounting {
source-class-usage {
output;
}
}
address 10.20.253.1/30;
}
}
}
vt-4/1/0 {
unit 0 {
family inet {
accounting {
source-class-usage {
input;
}
}
address 10.250.71.14/32;
}
family iso;
family mpls;
}
}
}
routing-options {
autonomous-system 300;
forwarding-table {
export inject-customer2-dest-class;
}
}
protocols {
mpls {
interface so-0/1/1;
interface vt-4/1/0;
}
bgp {
group ibgp {
type internal;
local-address 10.250.71.14;
family inet-vpn {
unicast;
}
neighbor 10.250.245.245;
}
}
isis {
interface so-0/1/1;
}
ldp {
interface so-0/1/1;
}
}
routing-instances {
red {
instance-type vrf;
interface so-0/0/0.0;
interface vt-4/1/0.0;
route-distinguisher 10.250.71.14:100;
vrf-import red-import;
vrf-export red-export;
protocols {
bgp {
group to-ce2 {
local-address 10.20.253.1;
peer-as 400;
neighbor 10.20.253.2;
}
}
}
}
}
policy-options {
policy-statement red-import {
from {
protocol bgp;
community red-com;
}
then accept;
}
policy-statement red-export {
from protocol bgp;
then {
community add red-com;
accept;
}
}
policy-statement inject-customer2-dest-class {
term term-gold1-traffic {
from {
route-filter 10.114.1.0/24 exact;
}
then source-class GOLD1;
}
}
community red-com members target:20:20;
}
在路由器 CE2 上,通过完成与 PE2 的 EBGP 连接来完成 VPN 路径。
路由器 CE2
[edit]
interfaces {
so-0/0/1 {
unit 0 {
family inet {
address 10.20.253.2/30;
}
}
}
}
routing-options {
autonomous-system 400;
}
protocols {
bgp {
group to-pe2 {
local-address 10.20.253.2;
export inject-direct;
peer-as 300;
neighbor 10.20.253.1;
}
}
}
policy-options {
policy-statement inject-direct {
from {
protocol direct;
}
then accept;
}
}
验证您的工作
要验证 SCU 在第 3 层 VPN 中是否正常运行,请使用以下命令:
show interfaces interface-name statisticsshow interfaces source-class source-class-name interface-nameshow interfaces interface-nameextensive( |detail)show routeextensive( |detail)clear interface interface-name statistics
您应始终在配置 output 语句的出站 SCU 接口上验证 SCU 统计信息。要检查 SCU 功能,请按照下列步骤操作:
清除启用了 SCU 的路由器上的所有计数器,并验证它们是否为空。
从入口客户边缘路由器向第二个客户边缘路由器发送 ping,以通过启用了 SCU 的 VPN 路由生成 SCU 流量。
验证出站接口上的计数器是否正确递增。
以下部分显示了与配置示例一起使用的这些命令的输出。
user@pe2> clear interfaces statistics all
user@pe2> show interfaces so-0/0/0.0 statistics
Logical interface so-0/0/0.0 (Index 6) (SNMP ifIndex 113)
Flags: Point-To-Point SNMP-Traps Encapsulation: PPP
Protocol inet, MTU: 4470
Source class Packets Bytes
GOLD1 0 0
Addresses, Flags: Is-Preferred Is-Primary
user@pe2> show interfaces source-class GOLD1 so-0/0/0.0
Protocol inet
Source class Packets Bytes
GOLD1 0 0
user@ce1> ping 10.20.253.2 source 10.114.1.1 rapid count 10000
user@scu> show interfaces source-class GOLD1 so-0/0/0.0
Protocol inet
Source class Packets Bytes
GOLD1 20000 1680000
user@scu> show interfaces so-0/0/0.0 statistics
Logical interface so-0/0/0.0 (Index 6) (SNMP ifIndex 113)
Flags: Point-To-Point SNMP-Traps Encapsulation: PPP
Protocol inet, MTU: 4470
Source class Packets Bytes
GOLD1 20000 1680000
Addresses, Flags: Is-Preferred Is-Primary
Destination: 10.20.253/24, Local: 10.20.253.1