配置静态BFD for TE示例
本示例中,通过配置静态BFD检测TE隧道,使VPN快速感知隧道故障,从而进行流量切换。
组网需求
图3-24为MPLS网络,PE1和PE2之间存在二层设备(交换机)。在PE1上配置了VPN FRR,使用MPLS TE隧道。其中VPN FRR使用的主路径是PE1->Switch->PE2,备份路径是PE1->PE3。当网络没有故障时,使用主路径传输VPN流量,当主路径出现故障时,VPN流量切换到上备份路径上。要求配置静态BFD for TE检测主路径的隧道,使VPN能快速感知隧道故障,进行流量切换,减少故障时间。
为简单起见,图中省略了PE和CE之间的IP地址。
配置思路
采用如下思路配置静态BFD for TE:
配置MPLS网络,在PE1和PE2之间,及PE1和PE3之间建立双向TE隧道。
在PE1上部署VPN FRR。
在PE1、PE2和PE3上使能全局BFD能力。
在PE1上配置BFD会话,检测主路径上的TE隧道。
在PE2和PE3配置BFD会话,指定BFD的反向通道为TE隧道。
数据准备
为完成此配置例,需准备如下的数据:
IGP协议类型及配置IGP所需数据
BGP的AS号、BGP会话接口
MPLS LSR-ID
隧道接口编号、隧道占用的带宽及使用的显式路径
VPN实例的名称、RD和Route-Target
隧道策略的名称
BFD会话的名称
BFD会话的本地和远端标识符
操作步骤
- 配置各接口的IP地址
根据组网图配置IP地址,并在节点上创建Loopback接口,配置Loopback接口的IP地址为MPLS LSR-ID。具体配置过程见配置文件。
- 配置IGP
在各个节点上配置OSPF或IS-IS,使PE1和PE2能互通,PE1和PE3能互通。本例使用OSPF,具体配置过程见配置文件。
- 配置MPLS基本能力
在各个节点的系统视图下配置LSR-ID,使能MPLS,并在物理接口下使能MPLS。具体配置过程见配置文件。
- 配置MPLS TE基本能力
在各个节点的MPLS视图和物理接口视图下使能MPLS-TE、MPLS RSVP-TE。具体配置过程见配置文件。
- 配置OSPF TE,并配置CSPF
在各个节点上配置OSPF TE,并在PE1上配置CSPF。具体配置过程见配置文件。
- 配置Tunnel接口
在PE1、PE2和PE3上配置显式路径,其中PE1上需创建两个显式路径。
# 在PE1上分别配置到PE2和PE3的显式路径。
[~PE1] explicit-path tope2
[*PE1-explicit-path-tope2] next hop 10.2.1.2
[*PE1-explicit-path-tope2] next hop 3.3.3.3
[*PE1-explicit-path-tope2] quit
[*PE1] explicit-path tope3
[*PE1-explicit-path-tope3] next hop 10.1.1.2
[*PE1-explicit-path-tope3] next hop 2.2.2.2
[*PE1-explicit-path-tope3] commit
[*PE1-explicit-path-tope3] quit
# 在PE2上配置到PE1的显式路径。
[~PE2] explicit-path tope1
[*PE2-explicit-path-tope1] next hop 10.2.1.1
[*PE2-explicit-path-tope1] next hop 1.1.1.1
[*PE2-explicit-path-tope1] commit
[*PE2-explicit-path-tope1] quit
# 在PE3上配置到PE1的显式路径。
[~PE3] explicit-path tope1
[*PE3-explicit-path-tope1] next hop 10.1.1.1
[*PE3-explicit-path-tope1] next hop 1.1.1.1
[*PE3-explicit-path-tope1] commit
[*PE3-explicit-path-tope1] quit
在PE1、PE2和PE3上创建Tunnel接口,配置显式路径,隧道带宽为10Mbps。并配置绑定,预留给VPN使用。其中PE1上需创建两个Tunnel接口。
# 配置PE1。
[~PE1] interface tunnel 2
[*PE1-Tunnel2] ip address unnumbered interface loopback 1
[*PE1-Tunnel2] tunnel-protocol mpls te
[*PE1-Tunnel2] destination 3.3.3.3
[*PE1-Tunnel2] mpls te tunnel-id 2
[*PE1-Tunnel2] mpls te path explicit-path tope2
[*PE1-Tunnel2] mpls te bandwidth ct0 10000
[*PE1-Tunnel2] mpls te reserved-for-binding
[*PE1-Tunnel2] quit
[*PE1] interface tunnel 1
[*PE1-Tunnel1] ip address unnumbered interface loopback 1
[*PE1-Tunnel1] tunnel-protocol mpls te
[*PE1-Tunnel1] destination 2.2.2.2
[*PE1-Tunnel1] mpls te tunnel-id 1
[*PE1-Tunnel1] mpls te path explicit-path tope3
[*PE1-Tunnel1] mpls te bandwidth ct0 10000
[*PE1-Tunnel1] mpls te reserved-for-binding
[*PE1-Tunnel1] commit
[~PE1-Tunnel1] quit
# 配置PE2。
[~PE2] interface tunnel 2
[*PE2-Tunnel2] ip address unnumbered interface loopback 1
[*PE2-Tunnel2] tunnel-protocol mpls te
[*PE2-Tunnel2] destination 1.1.1.1
[*PE2-Tunnel2] mpls te tunnel-id 3
[*PE2-Tunnel2] mpls te path explicit-path tope1
[*PE2-Tunnel2] mpls te bandwidth ct0 10000
[*PE2-Tunnel2] mpls te reserved-for-binding
[*PE2-Tunnel2] commit
[~PE2-Tunnel2] quit
# 配置PE3。
[~PE3] interface tunnel 1
[*PE3-Tunnel1] ip address unnumbered interface loopback 1
[*PE3-Tunnel1] tunnel-protocol mpls te
[*PE3-Tunnel1] destination 1.1.1.1
[*PE3-Tunnel1] mpls te tunnel-id 4
[*PE3-Tunnel1] mpls te path explicit-path tope1
[*PE3-Tunnel1] mpls te bandwidth ct0 10000
[*PE3-Tunnel1] mpls te reserved-for-binding
[*PE3-Tunnel1] commit
[~PE3-Tunnel1] quit
完成此配置后,在PE上执行display mpls te tunnel-interface tunnel interface-number,可发现在PE1的Tunnel1和Tunnel2、PE2的Tunnel2和PE3的Tunnel1的状态都为“CR-LSP is Up”。
- 配置VPN FRR
# 在PE1、PE2和PE3上配置VPN实例,VPN实例名都设置为vpn1,RD分别为100:1、100:2和100:3,Route-Target属性都为100:1。并接入CE设备。具体配置过程见配置文件。
# 在PE1和PE2之间,及PE1和PE3之间建立MP-IBGP对等体。PE1、PE2和PE3上的BGP AS号都为100,使用Loopback1作为BGP会话接口。具体配置过程见配置文件。
# 在PE1、PE2和PE3上配置隧道策略,并应用到VPN实例中。
# 配置PE1。
[~PE1] tunnel-policy policy1
[*PE1-tunnel-policy-policy1] tunnel binding destination 3.3.3.3 te tunnel 2
[*PE1-tunnel-policy-policy1] tunnel binding destination 2.2.2.2 te tunnel 1
[*PE1-tunnel-policy-policy1] quit
[*PE1] ip vpn-instance vpn1
[*PE1-vpn-instance-vpn1] tnl-policy policy1
[*PE1-vpn-instance-vpn1] quit
# 配置PE2。
[~PE2] tunnel-policy policy1
[*PE2-tunnel-policy-policy1] tunnel binding destination 1.1.1.1 te tunnel 2
[*PE2-tunnel-policy-policy1] quit
[*PE2] ip vpn-instance vpn1
[*PE2-vpn-instance-vpn1] tnl-policy policy1
[*PE2-vpn-instance-vpn1] commit
[~PE2-vpn-instance-vpn1] quit
# 配置PE3。
[~PE3] tunnel-policy policy1
[*PE3-tunnel-policy-policy1] tunnel binding destination 1.1.1.1 te tunnel 1
[*PE3-tunnel-policy-policy1] quit
[*PE3] ip vpn-instance vpn1
[*PE3-vpn-instance-vpn1] tnl-policy policy1
[*PE3-vpn-instance-vpn1] commit
[~PE3-vpn-instance-vpn1] quit
# 在PE1上配置VPN FRR。
[~PE1] bgp 100
[*PE1-bgp] ipv4-family vpn-instance vpn1
[*PE1-bgp-vpn1] auto-frr
[*PE1-bgp-vpn1] commit
[~PE1-bgp-vpn1] quit
[~PE1-bgp] quit
完成此配置后,CE之间可以互通,且流量经过PE1、Switch和PE2。当拔出PE1和PE2之间任意一个接口的线缆,或Switch节点故障,或PE2故障时,VPN流量被切换到备份路径PE1->PE3上。故障收敛时间几乎为IGP的收敛时间。
- 配置BFD for TE
# 在PE1上配置BFD会话,检测主路径上的TE隧道。并指定发送BFD报文的最小时间间隔和允许接收BFD报文的最小时间间隔。
[~PE1] bfd
[*PE1-bfd] quit
[*PE1] bfd pe1tope2 bind mpls-te interface tunnel2
[*PE1-bfd-lsp-session-pe1tope2] discriminator local 12
[*PE1-bfd-lsp-session-pe1tope2] discriminator remote 21
[*PE1-bfd-lsp-session-pe1tope2] min-tx-interval 100
[*PE1-bfd-lsp-session-pe1tope2] min-rx-interval 100
[*PE1-bfd-lsp-session-pe1tope2] process-pst
[*PE1-bfd-lsp-session-pe1tope2] commit
# 在PE2上配置BFD会话,指定BFD的反向通道为TE隧道。并指定发送BFD报文的最小时间间隔和允许接收BFD报文的最小时间间隔。
[~PE2] bfd
[*PE2-bfd] quit
[*PE2] bfd pe2tope1 bind mpls-te interface tunnel2
[*PE2-bfd-lsp-session-pe2tope1] discriminator local 21
[*PE2-bfd-lsp-session-pe2tope1] discriminator remote 12
[*PE2-bfd-lsp-session-pe2tope1] min-tx-interval 100
[*PE2-bfd-lsp-session-pe2tope1] min-rx-interval 100
[*PE2-bfd-lsp-session-pe2tope1] commit
# 完成此配置后,在PE1和PE2上执行命令display bfd session { all |discriminator discr-value | mpls-te interface interface-type interface-number } [ verbose ]命令,可发现BFD会话状态为Up。
- 检查配置结果
将同一台测试仪的两个接口(Port1和Port2)分别接入CE1和CE2,从Port1向Port2打流,可发现当拔出PE1和PE2之间任意一个接口的线缆时,故障时间为毫秒级。
配置文件
本例省略了CE1、CE2和Switch的配置文件,及PE接入CE的相关配置。
PE1的配置文件
#
sysname PE1
#
ip vpn-instance vpn1
route-distinguisher 100:1
tnl-policy policy1
vpn-target 100:1 export-extcommunity
vpn-target 100:1 import-extcommunity
#
bfd
#
mpls lsr-id 1.1.1.1
mpls
mpls te
mpls rsvp-te
mpls te cspf
#
explicit-path tope2
next hop 10.2.1.2
next hop 3.3.3.3
#
explicit-path tope3
next hop 10.1.1.2
next hop 2.2.2.2
#
interface gigabitethernet0/2/0
undo shutdown
ip address 10.2.1.1 255.255.255.0
mpls
mpls te
mpls rsvp-te
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.252
mpls
mpls te
mpls rsvp-te
#
interface LoopBack1
ip address 1.1.1.1 255.255.255.255
#
interface Tunnel1
ip address unnumbered interface LoopBack1
tunnel-protocol mpls te
destination 2.2.2.2
mpls te tunnel-id 1
mpls te bandwidth ct0 10000
mpls te path explicit-path tope3
mpls te reserved-for-binding
commit
#
interface Tunnel2
ip address unnumbered interface LoopBack1
tunnel-protocol mpls te
destination 3.3.3.3
mpls te tunnel-id 2
mpls te bandwidth ct0 10000
mpls te path explicit-path tope2
mpls te reserved-for-binding
commit
#
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack1
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack1
#
ipv4-family unicast
peer 2.2.2.2 enable
peer 3.3.3.3 enable
#
ipv4-family vpnv4
policy vpn-target
peer 2.2.2.2 enable
peer 3.3.3.3 enable
#
ipv4-family vpn-instance vpn1
import-route direct
auto-frr
#
ospf 1
opaque-capability enable
area 0.0.0.0
network 10.1.1.0 0.0.0.3
network 10.2.1.0 0.0.0.255
network 1.1.1.1 0.0.0.0
mpls-te enable
#
tunnel-policy policy1
tunnel binding destination 3.3.3.3 te Tunnel2
tunnel binding destination 2.2.2.2 te Tunnel1
#
bfd pe1tope2 bind mpls-te interface Tunnel2
discriminator local 12
discriminator remote 21
min-tx-interval 100
min-rx-interval 100
process-pst
return
PE2的配置文件
#
sysname PE2
#
ip vpn-instance vpn1
route-distinguisher 100:2
tnl-policy policy1
vpn-target 100:1 export-extcommunity
vpn-target 100:1 import-extcommunity
#
bfd
#
mpls lsr-id 3.3.3.3
mpls
mpls te
mpls rsvp-te
mpls te cspf
#
explicit-path tope1
next hop 10.2.1.1
next hop 1.1.1.1
#
interface gigabitethernet0/2/0
undo shutdown
ip address 10.2.1.2 255.255.255.0
mpls
mpls te
mpls rsvp-te
#
interface LoopBack1
ip address 3.3.3.3 255.255.255.255
#
interface Tunnel2
ip address unnumbered interface LoopBack1
tunnel-protocol mpls te
destination 1.1.1.1
mpls te tunnel-id 3
mpls te bandwidth ct0 10000
mpls te path explicit-path tope1
mpls te reserved-for-binding
commit
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack1
#
ipv4-family unicast
peer 1.1.1.1 enable
#
ipv4-family vpnv4
policy vpn-target
peer 1.1.1.1 enable
#
ipv4-family vpn-instance vpn1
import-route direct
#
ospf 1
opaque-capability enable
area 0.0.0.0
network 10.2.1.0 0.0.0.255
network 3.3.3.3 0.0.0.0
mpls-te enable
#
tunnel-policy policy1
tunnel binding destination 1.1.1.1 te Tunnel2
#
bfd pe2tope1 bind mpls-te interface Tunnel2
discriminator local 21
discriminator remote 12
min-tx-interval 100
min-rx-interval 100
return
PE3的配置文件
#
sysname PE3
#
ip vpn-instance vpn1
route-distinguisher 100:3
tnl-policy policy1
vpn-target 100:1 export-extcommunity
vpn-target 100:1 import-extcommunity
#
mpls lsr-id 2.2.2.2
mpls
mpls te
mpls rsvp-te
mpls te cspf
#
explicit-path tope1
next hop 10.1.1.1
next hop 1.1.1.1
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.252
mpls
mpls te
mpls rsvp-te
#
interface LoopBack1
ip address 2.2.2.2 255.255.255.255
#
interface Tunnel1
ip address unnumbered interface LoopBack1
tunnel-protocol mpls te
destination 1.1.1.1
mpls te tunnel-id 4
mpls te bandwidth ct0 10000
mpls te path explicit-path tope1
mpls te reserved-for-binding
commit
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack1
#
ipv4-family unicast
peer 1.1.1.1 enable
#
ipv4-family vpnv4
policy vpn-target
peer 1.1.1.1 enable
#
ipv4-family vpn-instance vpn1
import-route direct
#
ospf 1
opaque-capability enable
area 0.0.0.0
network 10.1.1.0 0.0.0.3
network 2.2.2.2 0.0.0.0
mpls-te enable
#
tunnel-policy policy1
tunnel binding destination 1.1.1.1 te Tunnel1
return