龙空技术网

HCIE2020__路由交换专家__配置 跨域VPN Option-C方案一

剪自在 179

前言:

眼前咱们对“跨域怎么配置路由器”大体比较看重,大家都需要剖析一些“跨域怎么配置路由器”的相关文章。那么小编同时在网络上汇集了一些对于“跨域怎么配置路由器””的相关文章,希望我们能喜欢,我们一起来了解一下吧!

1.1.1 关于本实验

本实验主要介绍了跨域VPN Option-C方案一的配置方法。

1.1.2 实验目的

掌握Option-C方案一原理,掌握其配置思路和方法。

1.1.3 实验组网介绍

图1-1 跨域VPN Option-C方案一配置实验拓扑图

1.1.4 实验规划

如上图所示,共分为4个AS,PE1、RR1、P1和ASBR1属于AS100,PE2、RR2、P2和ASBR2属于AS200。CE1和CE2属于同一个VPN,CE1通过AS100的PE1接入,CE2通过AS200的PE2接入,每台路由器的IP地址规划详见拓扑图。

1.2 实验任务配置1.2.1 配置思路配置各接口IP。配置OSPF。配置MPLS/MPLS LDP。在PE,P,ASBR配置与RR之间配置IBGP,并设置其为RR的反射客户体。在ASBR1与ASBR2之间配置EBGP。在PE上配置VPN实例,接口绑定VPN。在PE的VPN实例中配置与CE的EBGP。配置PE与RR, RR与RR之间的MP-BGP。配置PE、RR、ASBR交换标签IPv4路由能力。配置ASBR发布路由应用路由策略。1.2.2 配置步骤

步骤 1 配置各接口IP地址

#配置CE1。

<Huawei>system-view[Huawei]sysname CE1[CE1]interface GigabitEthernet0/0/1[CE1-GigabitEthernet0/0/1]ip address 10.1.1.1 30 [CE1-GigabitEthernet0/0/1]undo shutdown[CE1-GigabitEthernet0/0/1]quit[CE1]interface LoopBack 0[CE1-LoopBack0]ip address 11.11.11.11 32

#配置PE1。

<Huawei>system-view[Huawei]sysname PE1[PE1]interface GigabitEthernet0/0/0[PE1-GigabitEthernet0/0/0]ip address 12.12.12.1 30[PE1-GigabitEthernet0/0/0]undo shutdown[PE1-GigabitEthernet0/0/0]quit[PE1]interface loopback 0[PE1-LoopBack0]ip address 1.1.1.1 32[PE1-LoopBack0]quit

#配置P1。

<Huawei>system-view[Huawei]sysname P1[P1]interface GigabitEthernet0/0/0[P1-GigabitEthernet0/0/0]ip address 12.12.12.2 30[P1-GigabitEthernet0/0/0]undo shutdown[P1-GigabitEthernet0/0/0]quit[P1]interface GigabitEthernet0/0/1[P1-GigabitEthernet0/0/1]ip address 23.23.23.1 30[P1-GigabitEthernet0/0/1]undo shutdown[P1-GigabitEthernet0/0/1]quit[P1]interface GigabitEthernet0/0/2[P1-GigabitEthernet0/0/2]ip address 72.72.72.2 30[P1-GigabitEthernet0/0/2]undo shutdown[P1-GigabitEthernet0/0/2]quit[P1]interface loopback 0[P1-LoopBack0]ip address 2.2.2.2 32[P1-LoopBack0]quit

#配置RR1。

<Huawei>system-view[Huawei]sysname RR1[RR1]interface GigabitEthernet0/0/2[RR1-GigabitEthernet0/0/2]ip address 72.72.72.1 30 [RR1-GigabitEthernet0/0/2]undo shutdown[RR1-GigabitEthernet0/0/2]quit[RR1]interface LoopBack 0[RR1-LoopBack0]ip address 7.7.7.7 32

# 配置ASBR1。

<Huawei>system-view[Huawei]sysname ASBR1[ASBR1]interface GigabitEthernet0/0/0[ASBR1-GigabitEthernet0/0/0]ip address 34.34.34.1 30[ASBR1-GigabitEthernet0/0/0]undo shutdown[ASBR1-GigabitEthernet0/0/0]quit[ASBR1]interface GigabitEthernet0/0/1[ASBR1-GigabitEthernet0/0/1]ip address 23.23.23.2 30[ASBR1-GigabitEthernet0/0/1]undo shutdown[ASBR1-GigabitEthernet0/0/1]quit[ASBR1]interface loopback 0[ASBR1-LoopBack0]ip address 3.3.3.3 32[ASBR1-LoopBack0]quit

# 配置ASBR2。

<Huawei>system-view[Huawei]sysname ASBR2[ASBR2]interface GigabitEthernet0/0/0[ASBR2-GigabitEthernet0/0/0]ip address 34.34.34.2 30[ASBR2-GigabitEthernet0/0/0]undo shutdown[ASBR2-GigabitEthernet0/0/0]quit[ASBR2]interface GigabitEthernet0/0/1[ASBR2-GigabitEthernet0/0/1]ip address 45.45.45.1 30[ASBR2-GigabitEthernet0/0/1]undo shutdown[ASBR2-GigabitEthernet0/0/1]quit[ASBR2]interface loopback 0[ASBR2-LoopBack0]ip address 4.4.4.4 32[ASBR2-LoopBack0]quit

#配置P2。

<Huawei>system-view[Huawei]sysname P2[P2]interface GigabitEthernet0/0/0[P2-GigabitEthernet0/0/0]ip address 56.56.56.1 30[P2-GigabitEthernet0/0/0]undo shutdown[P2-GigabitEthernet0/0/0]quit[P2]interface GigabitEthernet0/0/1[P2-GigabitEthernet0/0/1]ip address 45.45.45.2 30[P2-GigabitEthernet0/0/1]undo shutdown[P2-GigabitEthernet0/0/1]quit[P2]interface GigabitEthernet0/0/2[P2-GigabitEthernet0/0/2]ip address 58.58.58.1 30[P2-GigabitEthernet0/0/2]undo shutdown[P2-GigabitEthernet0/0/2]quit[P2]interface loopback 0[P2-LoopBack0]ip address 5.5.5.5 32[P2-LoopBack0]quit

#配置PE2。

<Huawei>system-view[Huawei]sysname PE2[PE2]interface GigabitEthernet0/0/0[PE2-GigabitEthernet0/0/0]ip address 56.56.56.2 30[PE2-GigabitEthernet0/0/0]undo shutdown[PE2-GigabitEthernet0/0/0]quit[PE2]interface loopback 0[PE2-LoopBack0]ip address 6.6.6.6 32[PE2-LoopBack0]quit

#配置RR2。

<Huawei>system-view[Huawei]sysname RR2[RR2]interface GigabitEthernet0/0/2[RR2-GigabitEthernet0/0/2]ip address 58.58.58.2 30[RR2-GigabitEthernet0/0/2]undo shutdown[RR2-GigabitEthernet0/0/2]quit[RR2]interface loopback 0[RR2-LoopBack0]ip address 8.8.8.8 32

#配置CE2。

<Huawei>system-view[Huawei]sysname CE2[CE2]interface GigabitEthernet0/0/1[CE2-GigabitEthernet0/0/1]ip address 20.1.1.2 30[CE2-GigabitEthernet0/0/1]undo shutdown[CE2-GigabitEthernet0/0/1]quit[CE2]interface loopback 0[CE2-LoopBack0]ip address 22.22.22.22 32

步骤 2 配置OSPF

#配置PE1。

[PE1]ospf 1 router-id 1.1.1.1[PE1-ospf-1]area 0[PE1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0[PE1-ospf-1-area-0.0.0.0]network 12.12.12.0 0.0.0.3

#配置P1。

[P1]ospf 1 router-id 2.2.2.2[P1-ospf-1]area 0[P1-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0[P1-ospf-1-area-0.0.0.0]network 12.12.12.0 0.0.0.3[P1-ospf-1-area-0.0.0.0]network 23.23.23.0 0.0.0.3[P1-ospf-1-area-0.0.0.0]network 72.72.72.0 0.0.0.3

#配置RR1。

[RR1]ospf 1 router-id 7.7.7.7[RR1-ospf-1]area 0[RR1-ospf-1-area-0.0.0.0]network 7.7.7.7 0.0.0.0[RR1-ospf-1-area-0.0.0.0]network 72.72.72.0 0.0.0.3

#配置ASBR1。

[ASBR1]ospf 1 router-id 3.3.3.3[ASBR1-ospf-1]area 0[ASBR1-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0[ASBR1-ospf-1-area-0.0.0.0]network 23.23.23.0 0.0.0.3

#配置ASBR2。

[ASBR2]ospf 1 router-id 4.4.4.4[ASBR2-ospf-1]area 0[ASBR2-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0[ASBR2-ospf-1-area-0.0.0.0]network 45.45.45.0 0.0.0.3

#配置P2。

[P2]ospf 1 router-id 5.5.5.5[P2-ospf-1]area 0[P2-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0[P2-ospf-1-area-0.0.0.0]network 45.45.45.0 0.0.0.3[P2-ospf-1-area-0.0.0.0]network 56.56.56.0 0.0.0.3[P2-ospf-1-area-0.0.0.0]network 58.58.58.0 0.0.0.3

#配置RR2。

[RR2]ospf 1 router-id 8.8.8.8[RR2-ospf-1]area 0[RR2-ospf-1-area-0.0.0.0]network 8.8.8.8 0.0.0.0[RR2-ospf-1-area-0.0.0.0]network 58.58.58.0 0.0.0.3

#配置PE2。

[PE2]ospf 1 router-id 6.6.6.6[PE2-ospf-1]area 0[PE2-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0[PE2-ospf-1-area-0.0.0.0]network 56.56.56.0 0.0.0.3

步骤 3 使能MPLS/MPLS LDP

#配置PE1。

<PE1>system-view[PE1]mpls lsr-id 1.1.1.1[PE1]mpls[PE1-mpls]mpls ldp[PE1-mpls-ldp]quit[PE1]interface GigabitEthernet0/0/0[PE1-GigabitEthernet0/0/0]mpls[PE1-GigabitEthernet0/0/0]mpls ldp[PE1-GigabitEthernet0/0/0]quit

#配置P1。

<P1>system-view[P1]mpls lsr-id 2.2.2.2[P1]mpls[P1-mpls]mpls ldp[P1-mpls-ldp]quit[P1]interface GigabitEthernet0/0/0[P1-GigabitEthernet0/0/0]mpls[P1-GigabitEthernet0/0/0]mpls ldp[P1-GigabitEthernet0/0/0]quit[P1]interface GigabitEthernet0/0/1[P1-GigabitEthernet0/0/1]mpls[P1-GigabitEthernet0/0/1]mpls ldp[P1-GigabitEthernet0/0/1]quit

#配置ASBR1。

[ASBR1]mpls lsr-id 3.3.3.3[ASBR1]mpls[ASBR1-mpls]mpls ldp[ASBR1-mpls-ldp]quit[ASBR1]interface GigabitEthernet0/0/1[ASBR1-GigabitEthernet0/0/1]mpls[ASBR1-GigabitEthernet0/0/1]mpls ldp[ASBR1-GigabitEthernet0/0/1]quit

#配置ASBR2。

[ASBR2]mpls lsr-id 4.4.4.4[ASBR2]mpls[ASBR2-mpls]mpls ldp[ASBR2-mpls-ldp]quit[ASBR2]interface GigabitEthernet0/0/1[ASBR2-GigabitEthernet0/0/1]mpls[ASBR2-GigabitEthernet0/0/1]mpls ldp[ASBR2-GigabitEthernet0/0/1]quit

#配置P2。

<P2>system-view[P2]mpls lsr-id 5.5.5.5[P2]mpls[P2-mpls]mpls ldp[P2-mpls-ldp]quit[P2]interface GigabitEthernet0/0/0[P2-GigabitEthernet0/0/0]mpls[P2-GigabitEthernet0/0/0]mpls ldp[P2-GigabitEthernet0/0/0]quit[P2]interface GigabitEthernet0/0/1[P2-GigabitEthernet0/0/1]mpls[P2-GigabitEthernet0/0/1]mpls ldp[P2-GigabitEthernet0/0/1]quit

#配置PE2。

[PE2]mpls lsr-id 6.6.6.6[PE2]mpls[PE2-mpls]mpls ldp[PE2-mpls-ldp]quit[PE2]interface GigabitEthernet0/0/0[PE2-GigabitEthernet0/0/0]mpls[PE2-GigabitEthernet0/0/0]mpls ldp[PE2-GigabitEthernet0/0/0]quit

步骤 4 在PE、P、ASBR配置与RR之间的IBGP,并设置其为RR的反射客户体

#配置PE1。

[PE1]bgp 100[PE1-bgp]peer 7.7.7.7 as-number 100//配置PE1与RR1之间的IBGP邻居关系。[PE1-bgp]peer 7.7.7.7 connect-interface loopback 0//配置建立对等体的接口为LOOPBACK 0。

#配置P1。

[P1]bgp 100[P1-bgp]peer 7.7.7.7 as-number 100[P1-bgp]peer 7.7.7.7 connect-interface LoopBack 0

#配置ASBR1。

[ASBR1]bgp 100[ASBR1-bgp]peer 7.7.7.7 as-number 100[ASBR1-bgp]peer 7.7.7.7 connect-interface LoopBack 0

#配置RR1。

[RR1]bgp 100[RR1-bgp]peer 1.1.1.1 as-number 100[RR1-bgp]peer 1.1.1.1 connect-interface LoopBack 0[RR1-bgp]peer 1.1.1.1 reflect-client[RR1-bgp]peer 2.2.2.2 as-number 100[RR1-bgp]peer 2.2.2.2 connect-interface LoopBack 0[RR1-bgp]peer 2.2.2.2 reflect-client[RR1-bgp]peer 3.3.3.3 as-number 100[RR1-bgp]peer 3.3.3.3 connect-interface LoopBack 0[RR1-bgp]peer 3.3.3.3 reflect-client

#配置PE2。

[PE2]bgp 200[PE2-bgp]peer 8.8.8.8 as-number 200[PE2-bgp]peer 8.8.8.8 connect-interface loopback 0

#配置P2。

[P2]bgp 200[P2-bgp]peer 8.8.8.8 as-number 200[P2-bgp]peer 8.8.8.8 connect-interface loopback 0

#配置ASBR2。

[ASBR2]bgp 200[ASBR2-bgp]peer 8.8.8.8 as-number 200[ASBR2-bgp]peer 8.8.8.8 connect-interface loopback 0

#配置RR2。

[RR2]bgp 200[RR2-bgp]peer 4.4.4.4 as-number 200[RR2-bgp]peer 4.4.4.4 connect-interface LoopBack 0[RR2-bgp]peer 4.4.4.4 reflect-client[RR2-bgp]peer 5.5.5.5 as-number 200[RR2-bgp]peer 5.5.5.5 connect-interface LoopBack 0[RR2-bgp]peer 5.5.5.5 reflect-client[RR2-bgp]peer 6.6.6.6 as-number 200[RR2-bgp]peer 6.6.6.6 connect-interface LoopBack 0[RR2-bgp]peer 6.6.6.6 reflect-client

步骤 5 在ASBR1与ASBR2之间配置EBGP

#配置ASBR1。

[ASBR1]bgp 100[ASBR1-bgp]peer 34.34.34.2 as-number 200

#配置ASBR2。

[ASBR2]bgp 200[ASBR2-bgp]peer 34.34.34.1 as-number 100

步骤 6 PE配置VPN实例,接口绑定VPN

#配置PE1。

[PE1]ip vpn-instance huawei[PE1-vpn-instance-huawei]route-distinguisher 100:1[PE1-vpn-instance-huawei]vpn-target 100:1 both[PE1]interface GigabitEthernet0/0/1[PE1-GigabitEthernet0/0/1]ip binding vpn-instance huawei[PE1-GigabitEthernet0/0/1]ip address 10.1.1.2 30[PE1-GigabitEthernet0/0/1]quit

#配置PE2。

[PE2]ip vpn-instance huawei[PE2-vpn-instance-huawei]route-distinguisher 100:1[PE2-vpn-instance-huawei]vpn-target 100:1 both[PE2]interface GigabitEthernet0/0/1[PE2-GigabitEthernet0/0/1]ip binding vpn-instance huawei[PE2-GigabitEthernet0/0/1]ip address 20.1.1.1 30[PE2-GigabitEthernet0/0/1]quit

步骤 7 PE VPN实例中配置与CE的EBGP

#配置PE1。

[PE1]bgp 100[PE1-bgp]ipv4-family vpn-instance huawei[PE1-bgp-huawei]peer 10.1.1.1 as-number 65001

#配置CE1。

[CE1]bgp 65001[CE1-bgp]peer 10.1.1.2 as-number 100[CE1-bgp]network 11.11.11.11 32

#配置PE2。

[PE2]bgp 200[PE2-bgp]ipv4-family vpn-instance huawei[PE2-bgp-huawei]peer 20.1.1.2 as-number 65002

#配置CE2。

[CE2]bgp 65002[CE2-bgp]peer 20.1.1.1 as-number 200[CE2-bgp]network 22.22.22.22 32

步骤 8 配置PE与RR,RR之间的MP-BGP

#配置PE1。

[PE1]bgp 100[PE1-bgp]ipv4-family vpnv4[PE1-bgp-af-vpnv4]peer 7.7.7.7 enable

#配置RR1。

[RR1]bgp 100[RR1-bgp]peer 8.8.8.8 as-number 200[RR1-bgp]peer 8.8.8.8 connect-interface LoopBack 0[RR1-bgp]peer 8.8.8.8 ebgp-max-hop 10[RR1-bgp]ipv4-family vpnv4[RR1-bgp-af-vpnv4]undo policy vpn-target[RR1-bgp-af-vpnv4]peer  1.1.1.1 enable[RR1-bgp-af-vpnv4]peer  1.1.1.1 reflect-client[RR1-bgp-af-vpnv4]peer  1.1.1.1 next-hop-invariable[RR1-bgp-af-vpnv4]peer  8.8.8.8 enable[RR1-bgp-af-vpnv4]peer  8.8.8.8 next-hop-invariable

#配置RR2。

[RR2]bgp 200[RR2-bgp]peer 7.7.7.7 as-number 100[RR2-bgp]peer 7.7.7.7 connect-interface LoopBack 0[RR2-bgp]peer 7.7.7.7 ebgp-max-hop 10[RR2-bgp]ipv4-family vpnv4[RR2-bgp-af-vpnv4]undo policy vpn-target[RR2-bgp-af-vpnv4]peer  6.6.6.6 enable[RR2-bgp-af-vpnv4]peer  6.6.6.6 reflect-client[RR2-bgp-af-vpnv4]peer  6.6.6.6 next-hop-invariable[RR2-bgp-af-vpnv4]peer  7.7.7.7 enable[RR2-bgp-af-vpnv4]peer  7.7.7.7 next-hop-invariable

#配置PE2。

[PE2]bgp 200[PE2-bgp]ipv4-family vpnv4[PE2-bgp-af-vpnv4]peer 8.8.8.8 enable

步骤 9 配置PE、RR、ASBR交换标签IPv4路由能力

#配置PE1。

[PE1]bgp 100[PE1-bgp]peer 7.7.7.7 as-number 100[PE1-bgp]peer 7.7.7.7 label-route-capability   

#配置RR1。

[RR1]bgp 100[RR1-bgp]peer 1.1.1.1 as-number 100[RR1-bgp]peer 1.1.1.1 label-route-capability               [RR1-bgp]peer 3.3.3.3 as-number 100[RR1-bgp]peer 3.3.3.3 label-route-capability    

#配置ASBR1。

[ASBR1]bgp 100[ASBR1-bgp]peer 7.7.7.7 as-number 100[ASBR1-bgp]peer 7.7.7.7 label-route-capability[ASBR1-bgp]peer 34.34.34.2 as-number 200[ASBR1-bgp]peer 34.34.34.2 label-route-capability

#配置ASBR2。

[ASBR2]bgp 200[ASBR2-bgp]peer 8.8.8.8 as-number 100[ASBR2-bgp]peer 8.8.8.8 label-route-capability[ASBR2-bgp]peer 34.34.34.1 as-number 100[ASBR2-bgp]peer 34.34.34.1 label-route-capability

#配置RR2。

[RR2]bgp 200[RR2-bgp]peer 4.4.4.4 as-number 200[RR2-bgp]peer 4.4.4.4 label-route-capability                [RR2-bgp]peer 6.6.6.6 as-number 200[RR2-bgp]peer 6.6.6.6 label-route-capability

#配置PE2。

[PE2]bgp 200[PE2-bgp]peer 8.8.8.8 as-number 200[PE2-bgp]peer 8.8.8.8 label-route-capability

步骤 10 ASBR配置路由策略

#配置ASBR1。

[ASBR1]interface GigabitEthernet0/0/0[ASBR1-GigabitEthernet0/0/0]ip address 34.34.34.1 30[ASBR1-GigabitEthernet0/0/0]mpls[ASBR1-GigabitEthernet0/0/0]quit[ASBR1]route-policy policy1 permit node 10[ASBR1-route-policy]apply mpls-label //为匹配条件的路由分配标签。[ASBR1-route-policy]quit[ASBR1]route-policy policy2 permit node 10[ASBR1-route-policy]if-match mpls-label[ASBR1-route-policy]apply mpls-label//如果路由带有标签,则为其分配标签。[ASBR1-route-policy]quit//在ASBR1上创建2个路由策略。[ASBR1]bgp 100[ASBR1-bgp]peer 7.7.7.7 route-policy policy2 export//配置ASBR1:对向RR1发布的路由应用路由策略,对于向本AS内的RR发布的路由,如果是带标签的IPv4路由,为其分配新的MPLS标签。[ASBR1-bgp]peer 34.34.34.2 as-number 200[ASBR1-bgp]peer 34.34.34.2 route-policy policy1 export[ASBR1-bgp]peer 34.34.34.2 label-route-capability[ASBR1-bgp]quit//配置ASBR1:对向ASBR2发布的路由应用路由策略,对于从本AS内的RR接收的路由,在向对端AS的ASBR发布时,分配MPLS标签。[ASBR1]bgp 100[ASBR1-bgp]network 1.1.1.1 32[ASBR1-bgp]network 7.7.7.7 32//配置ASBR1:将PE1和RR1的Loopback地址发布给ASBR2,进而发布给RR2和PE2。[ASBR1-bgp]quit

#配置ASBR2

[ASBR2]interface GigabitEthernet0/0/0[ASBR2-GigabitEthernet0/0/0]ip address 34.34.34.2 30[ASBR2-GigabitEthernet0/0/0]mpls[ASBR2-GigabitEthernet0/0/0]quit[ASBR2]route-policy policy1 permit node 10[ASBR2-route-policy]apply mpls-label //为匹配条件的路由分配标签。[ASBR2-route-policy]quit[ASBR2]route-policy policy2 permit node 10[ASBR2-route-policy]if-match mpls-label[ASBR2-route-policy]apply mpls-label//如果路由带有标签,则为其分配标签。[ASBR2-route-policy]quit//在ASBR2上创建2个路由策略。[ASBR2]bgp 200[ASBR2-bgp]peer 8.8.8.8 route-policy policy2 export//配置ASBR2:对向RR2发布的路由应用路由策略,对于向本AS内的RR发布的路由,如果是带标签的IPv4路由,为其分配新的MPLS标签。[ASBR2-bgp]peer 34.34.34.1 as-number 100[ASBR2-bgp]peer 34.34.34.1 route-policy policy1 export[ASBR2-bgp]peer 34.34.34.1 label-route-capability[ASBR2-bgp]quit//配置ASBR2:对向ASBR1发布的路由应用路由策略,对于从本AS内的RR接收的路由,在向对端AS的ASBR发布时,分配MPLS标签。[ASBR2]bgp 200[ASBR2-bgp]network 6.6.6.6 32[ASBR2-bgp]network 8.8.8.8 32//配置ASBR2:将PE2和RR2的Loopback地址发布给ASBR1,进而发布给RR1和PE1。[ASBR2-bgp]quit
1.3 结果验证1.3.1 检查配置结果

#使用命令display bgp peer查看BGP邻居关系状态,以RR1为例:

[RR1]dis bgp peer BGP local router ID : 72.72.72.1 Local AS number : 100 Total number of peers : 4           Peers in established state : 4   Peer            V        AS  MsgRcvd  MsgSent  OutQ  Up/Down  State PrefRcv   1.1.1.1         4         100      119      140     0 01:56:27 Established   0  2.2.2.2         4         100      118      130     0 01:56:24 Established   0  3.3.3.3         4         100      125      129     0 01:56:28 Established   2  8.8.8.8         4         200      133      133     0 01:55:44 Established   0

#使用命令display bgp vpnv4 all routing-table查看BGP路由,以PE1为例:

[PE1]dis bgp vpnv4 all routing-table BGP Local router ID is 12.12.12.1 Status codes: * - valid, > - best, d - damped,               h - history,  i - internal, s - suppressed, S - Stale               Origin : i - IGP, e - EGP, ? - incomplete Total number of routes from all PE: 2 Route Distinguisher: 100:1      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn  *>   11.11.11.11/32     10.1.1.1        0                     0      65001i *>i  22.22.22.22/32     6.6.6.6                    100        0      200 65002i  VPN-Instance huawei, Router ID 12.12.12.1:  Total Number of Routes: 2      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn  *>   11.11.11.11/32     10.1.1.1               0          0              65001i *>i   22.22.22.22/32     6.6.6.6             100        0            200 65002i

#上述配置完成后,CE之间能学习到对方的接口路由,使用命令display ip routing-table以CE1为例:

<CE1>dis ip routing-tableRoute Flags: R - relay, D - download to fib------------------------------------------------------------------------------Routing Tables: Public         Destinations : 6        Routes : 6        Destination/Mask Proto  Pre  Cost      Flags  NextHop       Interface 10.1.1.0/30          Direct  0    0           D   10.1.1.1        GigabitEthernet0/0/110.1.1.1/32         Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/111.11.11.11/32   Direct  0    0           D   127.0.0.1       LoopBack022.22.22.22/32  EBGP  255  0           D   10.1.1.2        GigabitEthernet0/0/1127.0.0.0/8         Direct  0    0           D   127.0.0.1       InLoopBack0127.0.0.1/32        Direct  0    0           D   127.0.0.1       InLoopBack0

#使用Ping命令测试连通性,以CE1 Ping CE2环回口为例:

<CE1>ping -a 11.11.11.11 22.22.22.22  PING 22.22.22.22: 56  data bytes, press CTRL_C to break    Reply from 22.22.22.22: bytes=56 Sequence=1 ttl=250 time=250 ms    Reply from 22.22.22.22: bytes=56 Sequence=2 ttl=250 time=170 ms    Reply from 22.22.22.22: bytes=56 Sequence=3 ttl=250 time=200 ms    Reply from 22.22.22.22: bytes=56 Sequence=4 ttl=250 time=180 ms    Reply from 22.22.22.22: bytes=56 Sequence=5 ttl=250 time=180 ms   --- 22.22.22.22 ping statistics ---    5 packet(s) transmitted    5 packet(s) received    0.00% packet lossround-trip min/avg/max = 170/196/250 ms
1.4 参考配置1.4.1 CE1的配置
[CE1]dis cur#sysname CE1#interface GigabitEthernet0/0/1 ip address 10.1.1.1 255.255.255.252#interface LoopBack0 ip address 11.11.11.11 255.255.255.255#bgp 65001 peer 10.1.1.2 as-number 100 # ipv4-family unicast  undo synchronization  network 11.11.11.11 255.255.255.255  peer 10.1.1.2 enable#return
1.4.2 PE1的配置
[PE1]dis cur#sysname PE1#ip vpn-instance huawei ipv4-family  route-distinguisher 100:1  vpn-target 100:1 export-extcommunity  vpn-target 100:1 import-extcommunity#mpls lsr-id 1.1.1.1mpls#mpls ldp#interface GigabitEthernet0/0/0 ip address 12.12.12.1 255.255.255.252 mpls mpls ldp#interface GigabitEthernet0/0/1 ip binding vpn-instance huawei ip address 10.1.1.2 255.255.255.252#interface LoopBack0 ip address 1.1.1.1 255.255.255.255#bgp 100 peer 7.7.7.7 as-number 100 peer 7.7.7.7 connect-interface LoopBack0 # ipv4-family unicast  undo synchronization  peer 7.7.7.7 enable  peer 7.7.7.7 label-route-capability # ipv4-family vpnv4  policy vpn-target  peer 7.7.7.7 enable # ipv4-family vpn-instance huawei  peer 10.1.1.1 as-number 65001#ospf 1 router-id 1.1.1.1 area 0.0.0.0  network 1.1.1.1 0.0.0.0  network 12.12.12.0 0.0.0.3#return
1.4.3 P1的配置
<P1>dis cur#sysname P1#mpls lsr-id 2.2.2.2mpls#mpls ldp#interface GigabitEthernet0/0/0 ip address 12.12.12.2 255.255.255.252 mpls mpls ldp#interface GigabitEthernet0/0/1 ip address 23.23.23.1 255.255.255.252 mpls mpls ldp#interface GigabitEthernet0/0/2 ip address 72.72.72.2 255.255.255.252#interface LoopBack0 ip address 2.2.2.2 255.255.255.255#bgp 100 peer 7.7.7.7 as-number 100 peer 7.7.7.7 connect-interface LoopBack0 # ipv4-family unicast  undo synchronization  peer 7.7.7.7 enable#ospf 1 router-id 2.2.2.2 area 0.0.0.0  network 2.2.2.2 0.0.0.0  network 12.12.12.0 0.0.0.3  network 23.23.23.0 0.0.0.3  network 72.72.72.0 0.0.0.3#return
1.4.4 ASBR1的配置
[ASBR1]dis cur#sysname ASBR1#mpls lsr-id 3.3.3.3mpls#mpls ldp#interface GigabitEthernet0/0/0 ip address 34.34.34.1 255.255.255.252 mpls#interface GigabitEthernet0/0/1 ip address 23.23.23.2 255.255.255.252 mpls mpls ldp#interface LoopBack0 ip address 3.3.3.3 255.255.255.255#bgp 100 peer 7.7.7.7 as-number 100 peer 7.7.7.7 connect-interface LoopBack0 peer 34.34.34.2 as-number 200 # ipv4-family unicast  undo synchronization  network 1.1.1.1 255.255.255.255  network 7.7.7.7 255.255.255.255  peer 7.7.7.7 enable  peer 7.7.7.7 route-policy policy2 export  peer 7.7.7.7 label-route-capability  peer 34.34.34.2 enable  peer 34.34.34.2 route-policy policy1 export  peer 34.34.34.2 label-route-capability#ospf 1 router-id 3.3.3.3 area 0.0.0.0  network 3.3.3.3 0.0.0.0  network 23.23.23.0 0.0.0.3#route-policy policy1 permit node 10 apply mpls-label#route-policy policy2 permit node 10 if-match mpls-label apply mpls-label#return
1.4.5 RR1的配置
[RR1]dis cur#sysname RR1#interface GigabitEthernet0/0/2 ip address 72.72.72.1 255.255.255.252#interface LoopBack0 ip address 7.7.7.7 255.255.255.255#bgp 100 peer 1.1.1.1 as-number 100 peer 1.1.1.1 connect-interface LoopBack0 peer 2.2.2.2 as-number 100 peer 2.2.2.2 connect-interface LoopBack0 peer 3.3.3.3 as-number 100 peer 3.3.3.3 connect-interface LoopBack0 peer 8.8.8.8 as-number 200 peer 8.8.8.8 ebgp-max-hop 10 peer 8.8.8.8 connect-interface LoopBack0 # ipv4-family unicast  undo synchronization  peer 1.1.1.1 enable  peer 1.1.1.1 reflect-client  peer 1.1.1.1 label-route-capability  peer 2.2.2.2 enable  peer 2.2.2.2 reflect-client  peer 3.3.3.3 enable  peer 3.3.3.3 reflect-client  peer 3.3.3.3 label-route-capability  peer 8.8.8.8 enable # ipv4-family vpnv4  undo policy vpn-target  peer 1.1.1.1 enable  peer 1.1.1.1 reflect-client  peer 1.1.1.1 next-hop-invariable  peer 8.8.8.8 enable  peer 8.8.8.8 next-hop-invariable#ospf 1 router-id 7.7.7.7 area 0.0.0.0  network 7.7.7.7 0.0.0.0  network 72.72.72.0 0.0.0.3#return
1.4.6 ASBR2的配置
[ASBR2]dis cur#sysname ASBR2#mpls lsr-id 4.4.4.4mpls#mpls ldp#interface GigabitEthernet0/0/0 ip address 34.34.34.2 255.255.255.252 mpls#interface GigabitEthernet0/0/1 ip address 45.45.45.1 255.255.255.252 mpls mpls ldp#interface LoopBack0 ip address 4.4.4.4 255.255.255.255#bgp 200 peer 8.8.8.8 as-number 200 peer 8.8.8.8 connect-interface LoopBack0 peer 34.34.34.1 as-number 100 # ipv4-family unicast  undo synchronization  network 6.6.6.6 255.255.255.255  network 8.8.8.8 255.255.255.255  peer 8.8.8.8 enable  peer 8.8.8.8 route-policy policy2 export  peer 8.8.8.8 label-route-capability  peer 34.34.34.1 enable  peer 34.34.34.1 route-policy policy1 export  peer 34.34.34.1 label-route-capability#ospf 1 router-id 4.4.4.4 area 0.0.0.0  network 4.4.4.4 0.0.0.0  network 45.45.45.0 0.0.0.3#route-policy policy1 permit node 10 apply mpls-label#route-policy policy2 permit node 10 if-match mpls-label apply mpls-label#return
1.4.7 P2的配置
[P2]dis cur#sysname P2#mpls lsr-id 5.5.5.5mpls#mpls ldp#interface GigabitEthernet0/0/0 ip address 56.56.56.1 255.255.255.252 mpls mpls ldp#interface GigabitEthernet0/0/1 ip address 45.45.45.2 255.255.255.252 mpls mpls ldp#interface GigabitEthernet0/0/2 ip address 58.58.58.1 255.255.255.252#interface LoopBack0 ip address 5.5.5.5 255.255.255.255#bgp 200 peer 8.8.8.8 as-number 200 peer 8.8.8.8 connect-interface LoopBack0 # ipv4-family unicast  undo synchronization  peer 8.8.8.8 enable#ospf 1 router-id 5.5.5.5 area 0.0.0.0  network 5.5.5.5 0.0.0.0  network 45.45.45.0 0.0.0.3  network 56.56.56.0 0.0.0.3  network 58.58.58.0 0.0.0.3#return
1.4.8 PE2的配置
[PE2]dis cur#sysname PE2#ip vpn-instance huawei ipv4-family  route-distinguisher 100:1  vpn-target 100:1 export-extcommunity  vpn-target 100:1 import-extcommunity#mpls lsr-id 6.6.6.6mpls#mpls ldp#interface GigabitEthernet0/0/0 ip address 56.56.56.2 255.255.255.252 mpls mpls ldp#interface GigabitEthernet0/0/1 ip binding vpn-instance huawei ip address 20.1.1.1 255.255.255.252#interface LoopBack0 ip address 6.6.6.6 255.255.255.255#bgp 200 peer 8.8.8.8 as-number 200 peer 8.8.8.8 connect-interface LoopBack0 # ipv4-family unicast  undo synchronization  peer 8.8.8.8 enable  peer 8.8.8.8 label-route-capability # ipv4-family vpnv4  policy vpn-target  peer 8.8.8.8 enable # ipv4-family vpn-instance huawei  peer 20.1.1.2 as-number 65002#ospf 1 router-id 6.6.6.6 area 0.0.0.0  network 6.6.6.6 0.0.0.0  network 56.56.56.0 0.0.0.3#return
1.4.9 RR2的配置
[RR2]dis cur#sysname RR2#interface GigabitEthernet0/0/2 ip address 58.58.58.2 255.255.255.252#interface LoopBack0 ip address 8.8.8.8 255.255.255.255#bgp 200 peer 4.4.4.4 as-number 200 peer 4.4.4.4 connect-interface LoopBack0 peer 5.5.5.5 as-number 200 peer 5.5.5.5 connect-interface LoopBack0 peer 6.6.6.6 as-number 200 peer 6.6.6.6 connect-interface LoopBack0 peer 7.7.7.7 as-number 100 peer 7.7.7.7 ebgp-max-hop 10 peer 7.7.7.7 connect-interface LoopBack0 # ipv4-family unicast  undo synchronization  peer 4.4.4.4 enable  peer 4.4.4.4 reflect-client  peer 4.4.4.4 label-route-capability  peer 5.5.5.5 enable  peer 5.5.5.5 reflect-client  peer 6.6.6.6 enable  peer 6.6.6.6 reflect-client  peer 6.6.6.6 label-route-capability  peer 7.7.7.7 enable # ipv4-family vpnv4  undo policy vpn-target  peer 6.6.6.6 enable  peer 6.6.6.6 reflect-client  peer 6.6.6.6 next-hop-invariable  peer 7.7.7.7 enable  peer 7.7.7.7 next-hop-invariable#ospf 1 router-id 8.8.8.8 area 0.0.0.0  network 8.8.8.8 0.0.0.0  network 58.58.58.0 0.0.0.3#return
1.4.10 CE2的配置
[CE2]dis cur#sysname CE2#interface GigabitEthernet0/0/1 ip address 20.1.1.2 255.255.255.252#interface LoopBack0 ip address 22.22.22.22 255.255.255.255#bgp 65002 peer 20.1.1.1 as-number 200 # ipv4-family unicast  undo synchronization  network 22.22.22.22 255.255.255.255  peer 20.1.1.1 enable#return

标签: #跨域怎么配置路由器