BGP/MPLS *** Option C (RR-RR)跨域研究

1、实验环境
以华为模拟器eNSP为实验环境,结合wireshark抓包进行BGP/MPLS ××× OptionA 控制层面、数据层面以及日常排错三个方面进行研究;如下图所示:

2、配置流程
1)配置IGP与公网MPLS LDP LSP隧道:
① ISP1
PE1:
router id 1.1.1.1
ospf 1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 12.12.12.0 0.0.0.255
mpls lsr-id 1.1.1.1
mpls
mpls ldp
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip address 12.12.12.1 255.255.255.0
mpls
mpls ldp
RR1:
router id 2.2.2.2
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 12.12.12.0 0.0.0.255
network 23.23.23.0 0.0.0.255
mpls lsr-id 2.2.2.2
mpls
mpls ldp
ip address 2.2.2.2 255.255.255.255
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip address 12.12.12.2 255.255.255.0
mpls
mpls ldp
interface GigabitEthernet0/0/1
ip address 23.23.23.2 255.255.255.0
mpls
mpls ldp
ASBR1:
router id 3.3.3.3
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.23.23.0 0.0.0.255
mpls lsr-id 3.3.3.3
mpls
mpls ldp
ip address 3.3.3.3 255.255.255.255
mpls
mpls ldp
interface GigabitEthernet0/0/1
ip address 23.23.23.3 255.255.255.0
mpls
mpls ldp
查看公网路有:
dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib

Public routing table : OSPF
Destinations : 3 Routes : 3

OSPF routing table status :
Destinations : 3 Routes : 3

Destination/Mask Proto Pre Cost Flags NextHop Interface

    1.1.1.1/32  OSPF    10   2           D   23.23.23.2      GigabitEthernet

0/0/1
2.2.2.2/32 OSPF 10 1 D 23.23.23.2 GigabitEthernet
0/0/1
12.12.12.0/24 OSPF 10 2 D 23.23.23.2 GigabitEthernet
0/0/1

OSPF routing table status :
Destinations : 0 Routes : 0
查看MPLS LDP session:
dis mpls ldp session

LDP Session(s) in Public Network
Codes: LAM(Label Advertisement Mode), SsnAge Unit(DDDD:HH:MM)
A '*' before a session means the session is being deleted.

PeerID Status LAM SsnRole SsnAge KASent/Rcv

2.2.2.2:0 Operational DU Active 0000:00:18 75/75

TOTAL: 1 session(s) Found.
查看MPLS LSP:
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 NULL/1024 -/GE0/0/1
1.1.1.1/32 1024/1024 -/GE0/0/1
2.2.2.2/32 NULL/3 -/GE0/0/1
2.2.2.2/32 1025/3 -/GE0/0/1
3.3.3.3/32 3/NULL -/-
②ISP2
PE2:
router id 6.6.6.6
ospf 2
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 56.56.56.0 0.0.0.255
mpls lsr-id 6.6.6.6
mpls
mpls ldp
interface LoopBack0
ip address 6.6.6.6 255.255.255.255
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip address 56.56.56.6 255.255.255.0
mpls
mpls ldp
RR2:
router id 5.5.5.5
ospf 2
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 56.56.56.0 0.0.0.255
network 45.45.45.0 0.0.0.255
mpls lsr-id 5.5.5.5
mpls
mpls ldp
ip address 5.5.5.5 255.255.255.255
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip address 56.56.56.5 255.255.255.0
mpls
mpls ldp
interface GigabitEthernet0/0/1
ip address 45.45.45.5 255.255.255.0
mpls
mpls ldp
ASBR2:
router id 4.4.4.4
ospf 2
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 45.45.45.0 0.0.0.255
mpls lsr-id 4.4.4.4
mpls
mpls ldp
ip address 4.4.4.4 255.255.255.255
mpls
mpls ldp
interface GigabitEthernet0/0/1
ip address 45.45.45.4 255.255.255.0
mpls
mpls ldp
查看公网路有:
dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib

Public routing table : OSPF
Destinations : 3 Routes : 3

OSPF routing table status :
Destinations : 3 Routes : 3

Destination/Mask Proto Pre Cost Flags NextHop Interface

    5.5.5.5/32  OSPF    10   1           D   45.45.45.5      GigabitEthernet

0/0/1
6.6.6.6/32 OSPF 10 2 D 45.45.45.5 GigabitEthernet
0/0/1
56.56.56.0/24 OSPF 10 2 D 45.45.45.5 GigabitEthernet
0/0/1

OSPF routing table status :
Destinations : 0 Routes : 0
查看MPLS LDP session:
dis mpls ldp session

LDP Session(s) in Public Network
Codes: LAM(Label Advertisement Mode), SsnAge Unit(DDDD:HH:MM)
A '*' before a session means the session is being deleted.

PeerID Status LAM SsnRole SsnAge KASent/Rcv

5.5.5.5:0 Operational DU Passive 0000:00:24 100/100

TOTAL: 1 session(s) Found.
查看MPLS LSP:
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
4.4.4.4/32 3/NULL -/-
5.5.5.5/32 NULL/3 -/GE0/0/1
5.5.5.5/32 1024/3 -/GE0/0/1
6.6.6.6/32 NULL/1025 -/GE0/0/1
6.6.6.6/32 1025/1025 -/GE0/0/1
2)配置各个站点CE与PE的×××实例:
①ISP1:
PE1:
ip ***-instance spi
ipv4-family
route-distinguisher 100:1
***-target 100:1 export-extcommunity
***-target 100:1 import-extcommunity
interface GigabitEthernet0/0/1
ip binding ***-instance spi
ip address 192.168.1.254 255.255.255.0
ip ***-instance spd
ipv4-family
route-distinguisher 200:1
***-target 200:1 export-extcommunity
***-target 200:1 import-extcommunity
interface GigabitEthernet0/0/2
ip binding ***-instance spd
ip address 10.10.1.254 255.255.255.0
ping测试站点到网关
②ISP2
PE2:
ip ***-instance spi
ipv4-family
route-distinguisher 100:1
***-target 100:1 export-extcommunity
***-target 100:1 import-extcommunity
interface GigabitEthernet0/0/1
ip binding ***-instance spi
ip address 192.168.2.254 255.255.255.0
ip ***-instance spd
ipv4-family
route-distinguisher 200:1
***-target 200:1 export-extcommunity
***-target 200:1 import-extcommunity
interface GigabitEthernet0/0/2
ip binding ***-instance spd
ip address 10.10.2.254 255.255.255.0
ping测试站点到网关
3)配置PE1与RR1的MP-IBGP PE2和ISP2 RR2 的MP-IBGP之间传递×××V4站点×××V4私网路由:
ISP1
PE1:
bgp 100
undo default ipv4-unicast
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
undo peer 2.2.2.2 enable
ipv4-family ***v4
policy ***-target
peer 2.2.2.2 enable
ipv4-family ***-instance spd
network 10.10.1.0 255.255.255.0
ipv4-family ***-instance spi
network 192.168.1.0
RR1:
bgp 100
undo default ipv4-unicast
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
undo peer 1.1.1.1 enable
ipv4-family ***v4
undo policy ***-target(RR上没有×××-instance)
peer 1.1.1.1 enable
peer 1.1.1.1 reflect-client
查看RR1上公网与私网标签:
dis fib 1.1.1.1
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
1.1.1.1/32 12.12.12.1 DGHU t[317] GE0/0/0 0x9
dis bgp ***v4 all routing-table label

BGP Local router ID is 2.2.2.2
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           In/Out Label

*>i 192.168.1.0 1.1.1.1 NULL/1026(PE1与RR1 MP-EBGP 分配的私网标签)

ISP2:
PE2:
bgp 200
undo default ipv4-unicast
peer 5.5.5.5 as-number 200
peer 5.5.5.5 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
undo peer 5.5.5.5 enable
ipv4-family ***v4
policy ***-target
peer 5.5.5.5 enable
ipv4-family ***-instance spd
network 10.10.2.0 255.255.255.0
ipv4-family ***-instance spi
network 192.168.2.0
RR2:
bgp 200
undo default ipv4-unicast
peer 6.6.6.6 as-number 200
peer 6.6.6.6 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
undo peer 6.6.6.6 enable
ipv4-family ***v4
undo policy ***-target
peer 6.6.6.6 enable
peer 6.6.6.6 reflect-client
查看RR2上公网与私网标签:
dis fib 6.6.6.6
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
6.6.6.6/32 56.56.56.6 DGHU t[108] GE0/0/0 0x7
dis bgp ***v4 all routing-table label

BGP Local router ID is 5.5.5.5
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           In/Out Label

*>i 192.168.2.0 6.6.6.6 NULL/1030

4)配置MP-EBGP在ISP1 RR1与ISP2 RR2 之间传递×××V4站点×××V4私网路由:
①想要ISP1的RR1与ISP2的RR2建立BGP peer,需要RR1的2.2.2.2 环回口与RR2的5.5.5.5首先三层路由相通;
ASBR1:

bgp 100
undo default ipv4-unicast
peer 34.34.34.4 as-number 200
#
ipv4-family unicast
undo synchronization
(只需要把ospf学到的2.2.2.2导入BGP)
peer 34.34.34.4 enable
#
ASBR2:
[ASBR2]dis ip routing-table protocol bgp
Route Flags: R - relay, D - download to fib

Public routing table : BGP
Destinations : 5 Routes : 5

BGP routing table status :
Destinations : 5 Routes : 5

Destination/Mask Proto Pre Cost Flags NextHop Interface

    2.2.2.2/32  EBGP    255  1          RD   34.34.34.3      GigabitEthernet

0/0/0
ASBR2:
[ASBR2]dis current-configuration configuration ospf
ospf 2
import-route bgp(正常把MP-EBGP学到的2.2.2.2导入就行)
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 45.45.45.0 0.0.0.255

bgp 200
undo default ipv4-unicast
peer 34.34.34.3 as-number 100
ipv4-family unicast
undo synchronization
import-route ospf 2(把ospf学到的5.5.5.5导入MP-EBGP))
peer 34.34.34.3 enable
ASBR1:
dis current-configuration configuration ospf
ospf 1
import-route bgp(把MP-EBGP学到的5.5.5.5导入OSPF1)
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.23.23.0 0.0.0.255
RR1上ping RR1的5.5.5.5:
ping -a 1.1.1.1 6.6.6.6
ping -a 2.2.2.2 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=253 time=40 ms
Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=253 time=30 ms
Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=253 time=40 ms

--- 5.5.5.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/36/40 ms

②想要ISP1的RR1与ISP2的RR2私网路由想通,RR1的2.2.2.2与RR2的5.5.5.5的公网LSP隧道要通;
在RR1查看5.5.5.5 MPLS的公网标签分配情况:
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
2.2.2.2/32 NULL/3 -/GE0/0/0
2.2.2.2/32 1024/3 -/GE0/0/0
3.3.3.3/32 NULL/1024 -/GE0/0/0
3.3.3.3/32 1025/1024 -/GE0/0/0
1.1.1.1/32 3/NULL -/-
dis fib 5.5.5.5
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
5.5.5.5/32 23.23.23.3 DGHU t[2451] GE0/0/0 0x0
在FIB表中包括Destination、Mask、Nexthop、Flag、TimeStamp、Interface和TunnelID字段,其中Destination、Mask、Nexthop、Interface字段是与IP路由表的对应字段一样,其他3个字段说明:
①Flag:转发表项的标志,可能是G、H、U、S、D、B、L中一个或多字母组合。
●G(Gateway网关路由):表示下一跳是网关。
●H(Host主机路由):表示该路由为主机路由。
●U(Up可用路由):表示该路由状态是Up。
●S(Static静态路由):表示该路由为手动配置路由。
●D(Dynamic 动态路由):表示该路由为根据路由算法自动生成路由。
●B(Black Hole 黑洞路由):表示下一跳是空接口。
●L(Vlink Route):表示Vlink类型路由
②TimeStamp:转发表项的时间戳,表示该表项已存在的时间,单位是s。
③TunnelID:表示转发表项索引。该值不为0时,表示匹配该项的报文通过对应的隧道进行转发。该值为0时,表示报文不通过隧道转发。

dis fib 3.3.3.3
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
3.3.3.3/32 12.12.12.2 DGHU t[56] GE0/0/0 0x3
P1:dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 NULL/3 -/GE0/0/0
1.1.1.1/32 1026/3 -/GE0/0/0
2.2.2.2/32 3/NULL -/-
3.3.3.3/32 NULL/3 -/GE0/0/1
3.3.3.3/32 1027/3 -/GE0/0/1
ASBR2与ASBR1 IPV4 MP-EBGP默认路由默认不会携带标签;
[ASBR2]dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
5.5.5.5/32 NULL/3 -/GE0/0/1
5.5.5.5/32 1030/3 -/GE0/0/1
4.4.4.4/32 3/NULL -/-
6.6.6.6/32 NULL/1027 -/GE0/0/1
6.6.6.6/32 1031/1027 -/GE0/0/1
dis bgp ip routing-table label
ASBR2上配置:
配置ASBR2把5.5.5.5 发给ASBR1时分配标签:
并配置ASBR2与ASBR1 IPV4-MP-EBGP有携带路由标签的能力:
[ASBR2]route-policy label permit node 10
apply mpls-label
bgp 200
peer 34.34.34.3 as-number 100
ipv4-family unicast
undo synchronization
import-route ospf 2
peer 34.34.34.3 enable
peer 34.34.34.3 route-policy label export
peer 34.34.34.3 label-route-capability

ASBR1s上也配置IPv4的MP-BGP有有携带路由标签的能力:
bgp 100
peer 34.34.34.4 as-number 200
ipv4-family unicast
undo synchronization
import-route ospf 1
peer 34.34.34.4 enable
peer 34.34.34.4 label-route-capability

此时在ASBR1上查看发现ASBR2 在把5.5.5.5公网路由传给ASBR1时已经分发了标签并且可以在IPV4-MP-EBGP上携带:
[ASBR1]dis bgp routing-table label

dis bgp routing-table label

BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Total Number of Routes: 10

    Network           NextHop           In/Out Label

> 1.1.1.1 23.23.23.2 1035/NULL
> 2.2.2.2 23.23.23.2 1036/NULL
> 3.3.3.3 127.0.0.1 1037/NULL
> 4.4.4.4 34.34.34.4 NULL/1025
> 5.5.5.5 34.34.34.4 NULL/1027
> 6.6.6.6 34.34.34.4 NULL/1031
> 12.12.12.0 23.23.23.2 1038/NULL
> 23.23.23.0 23.23.23.3 1039/NULL
> 45.45.45.0 34.34.34.4 NULL/1024
> 56.56.56.0 34.34.34.4 NULL/1032
ASBR2 IPV4-MP-EBGP给5.5.5.5分配了1027的标签
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
2.2.2.2/32 3/NULL -/-
3.3.3.3/32 NULL/3 -/GE0/0/1
3.3.3.3/32 1024/3 -/GE0/0/1
1.1.1.1/32 NULL/3 -/GE0/0/0
1.1.1.1/32 1028/3 -/GE0/0/0
但是RR1上发现ASBR1的LDP无法给从ASBR2 通过IPV4-MP-EBGP的学到5.5.5.5路由分配标签;
ASBR1上LDP默认也不会给BGP路由分发标签
ASBR1上配置:
[ASBR1-mpls]lsp-trigger bgp-label-route
lsp-trigger bgp-label-route命令都用于配置LDP LSP的触发建立策略;(仅适用于带标签的公网BGP路由)
此时查看RR1:
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
2.2.2.2/32 3/NULL -/-
3.3.3.3/32 NULL/3 -/GE0/0/1
3.3.3.3/32 1024/3 -/GE0/0/1
6.6.6.6/32 NULL/1040 -/GE0/0/1
6.6.6.6/32 1029/1040 -/GE0/0/1
5.5.5.5/32 NULL/1033 -/GE0/0/1
5.5.5.5/32 1027/1033 -/GE0/0/1
4.4.4.4/32 NULL/1042 -/GE0/0/1
4.4.4.4/32 1031/1042 -/GE0/0/1
1.1.1.1/32 NULL/3 -/GE0/0/0
1.1.1.1/32 1028/3 -/GE0/0/0
ASBR1上的LDP给5.5.5.5分配了1033的标签;
同理对于2.2.2.2路由也是如此,配置ASBR1与ASBR2公网MP-EBGP可以携带有标签路由,应用策略使得IPV4-MP-EBGP给各种传递的路由分发MPLS label
ASBR上查看:ASBR1 MP-EBGP(IPV4单播)给2.2.2.2分发1036标签

dis bgp routing-table label

BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Total Number of Routes: 10

    Network           NextHop           In/Out Label

> 1.1.1.1 34.34.34.3 NULL/1035
> 2.2.2.2 34.34.34.3 NULL/1027
> 3.3.3.3 34.34.34.3 NULL/1037
> 4.4.4.4 127.0.0.1 1025/NULL
> 5.5.5.5 45.45.45.5 1026/NULL
> 6.6.6.6 45.45.45.5 1031/NULL
> 12.12.12.0 34.34.34.3 NULL/1038
> 23.23.23.0 34.34.34.3 NULL/1039
> 45.45.45.0 45.45.45.4 1024/NULL
> 56.56.56.0 45.45.45.5 1032/NULL
同理ASBR2上配置MPLS 使得LDP可以给BGP路由打上MPLS标签;
RR2上查看:配置lsp-trigger bgp-label-route之前:
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
5.5.5.5/32 3/NULL -/-
4.4.4.4/32 NULL/3 -/GE0/0/1
4.4.4.4/32 1026/3 -/GE0/0/1
6.6.6.6/32 NULL/3 -/GE0/0/0
6.6.6.6/32 1027/3 -/GE0/0/0
配置lsp-trigger bgp-label-route之后:ASBR2 LDP给2.2.2.2分发的1027的标签
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
5.5.5.5/32 3/NULL -/-
1.1.1.1/32 NULL/1035 -/GE0/0/1
1.1.1.1/32 1029/1035 -/GE0/0/1
2.2.2.2/32 NULL/1027 -/GE0/0/1
2.2.2.2/32 1030/1036 -/GE0/0/1
4.4.4.4/32 NULL/3 -/GE0/0/1
4.4.4.4/32 1026/3 -/GE0/0/1
6.6.6.6/32 NULL/3 -/GE0/0/0
6.6.6.6/32 1027/3 -/GE0/0/0
3.3.3.3/32 NULL/1037 -/GE0/0/1
3.3.3.3/32 1031/1037 -/GE0/0/1


RR1上测试:

ping -c 10000 -a 2.2.2.2 5.5.5.5
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name

5.5.5.5/32 NULL/1033 -/GE0/0/1
5.5.5.5/32 1027/1033 -/GE0/0/1
dis mpls lsp

             LSP Information: BGP  LSP

FEC In/Out Label In/Out IF Vrf Name
5.5.5.5/32 NULL/1027 -/-


             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
5.5.5.5/32 1033/1027 -/-
dis bgp routing-table label

BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Total Number of Routes: 10

    Network           NextHop           In/Out Label

*> 5.5.5.5 34.34.34.4 NULL/1027
dis bgp routing-table label

BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Total Number of Routes: 10

    Network           NextHop           In/Out Label

*> 5.5.5.5 45.45.45.5 1027/NULL
dis mpls lsp

             LSP Information: BGP  LSP

FEC In/Out Label In/Out IF Vrf Name
6.6.6.6/32 1027/NULL -/-

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
5.5.5.5/32 NULL/3 -/GE0/0/1
5.5.5.5/32 1024/3 -/GE0/0/1
dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
抓包:
RR1 出口:

ASBR1出口:

ASBR2出口:

注意在ASBR2上关于5.5.5.5路由标签分发上:
dis mpls lsp
dis bgp routing-table label

BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Total Number of Routes: 10

    Network           NextHop           In/Out Label

*> 5.5.5.5 45.45.45.5 1027/NULL

             LSP Information: BGP  LSP

FEC In/Out Label In/Out IF Vrf Name
6.6.6.6/32 1027/NULL -/-

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
5.5.5.5/32 NULL/3 -/GE0/0/1
5.5.5.5/32 1024/3 -/GE0/0/1
LDP给5.5.5.5分发的3标签,IPv4-MP-BGP ASBR1给5.5.5.5分发的1027标签;3的标签不会随路由传给ASBR1;
RR1与RR2正式开始配置×××V4的MP-EBGP路由:
RR1:
bgp 100
undo default ipv4-unicast
peer 5.5.5.5 as-number 200
peer 5.5.5.5 ebgp-max-hop 255
peer 5.5.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
undo peer 5.5.5.5 enable

ipv4-family ***v4
undo policy ***-target
peer 5.5.5.5 enable
RR2:
bgp 200
undo default ipv4-unicast
peer 2.2.2.2 as-number 100
peer 2.2.2.2 ebgp-max-hop 255
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
undo peer 2.2.2.2 enable

ipv4-family ***v4
undo policy ***-target
peer 2.2.2.2 enable
RR1上查看:
dis bgp ***v4 all routing-table label

BGP Local router ID is 2.2.2.2
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: 4

Route Distinguisher: 100:1

    Network           NextHop           In/Out Label

>i 192.168.1.0 1.1.1.1 1032/1029
> 192.168.2.0 5.5.5.5 1031/1029

3、控制层面分析
1)CE3的路由192.168.2.0/24传递给CE1过程:
①PE2上连接CE3直连路由:
dis ip routing-table ***-instance spi protocol direct
Route Flags: R - relay, D - download to fib

spi routing table : Direct
Destinations : 4 Routes : 4

Direct routing table status :
Destinations : 4 Routes : 4

Destination/Mask Proto Pre Cost Flags NextHop Interface

192.168.2.0/24  Direct  0    0           D   192.168.2.254   GigabitEthernet

0/0/1
192.168.2.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

Direct routing table status :
Destinations : 0 Routes : 0
dis ip routing-table ***-instance spi verbose
Destination: 192.168.2.0/24
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 192.168.2.254 Neighbour: 0.0.0.0
State: Active Adv Age: 03h29m00s
Tag: 0 Priority: high
Label: NULL QoSInfo: 0x0
IndirectID: 0x0
RelayNextHop: 0.0.0.0 Interface: GigabitEthernet0/0/1
TunnelID: 0x0 Flags: D

②把*** spi中192.168.2.0直连路由导入MP-BGP中:
dis current-configuration configuration bgp
[V200R003C00]
bgp 200
undo default ipv4-unicast
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
peer 4.4.4.4 enable
ipv4-family ***v4
policy ***-target
peer 4.4.4.4 enable
ipv4-family ***-instance spi
network 192.168.2.0
③PE2 在MP-BGP中192.168.2.0/24路由情况:
dis bgp ***v4 ***-instance spi routing-table label

BGP Local router ID is 6.6.6.6
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: 5
Route Distinguisher: 100:1
Network NextHop In/Out Label
> 192.168.2.0 192.168.2.254 1027/NULL
dis bgp ***v4 ***-instance spi routing-table 192.168.2.0

BGP local router ID : 6.6.6.6
Local AS number : 200

×××-Instance spi, Router ID 6.6.6.6:
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of 192.168.2.0/24:
Network route.
From: 0.0.0.0 (0.0.0.0)
Route Duration: 02h05m43s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 192.168.2.254
Qos information : 0x0
AS-path Nil, origin igp, MED 0, pref-val 0, valid, local, best, select, pre 0
Not advertised to any peer yet
PE2上的MP-BGP给192.168.2.0的×××v4路由分配的私网标签:
dis bgp ***v4 all routing-table label

BGP Local router ID is 6.6.6.6
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: 4

Route Distinguisher: 100:1
Network NextHop In/Out Label

>i 192.168.1.0 4.4.4.4 NULL/1029
> 192.168.2.0 192.168.2.254 1027/NULL
④RR2 在MP-BGP中收到192.168.2.0/24路由情况:
RR2上收到PE2 MP-IBGP 192.168.2.0 的×××V4路由分的标签1027
dis bgp ***v4 all routing-table label
dis bgp ***v4 all routing-table label

BGP Local router ID is 5.5.5.5
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: 4

Route Distinguisher: 100:1

    Network           NextHop           In/Out Label

>i 192.168.2.0 6.6.6.6 1029/1027
⑤RR1 在MP-EBGP中收到192.168.2.0/24路由情况:
dis bgp ***v4 all routing-table label
BGP Local router ID is 2.2.2.2
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: 4

Route Distinguisher: 100:1

    Network           NextHop           In/Out Label

*> 192.168.2.0 5.5.5.5 1031/1032

RR1到RR2 5.5.5.5的公网MPLS标签:1031
⑥关于192.168.2.0的私网标签情况:
PE1-RR1:
PE1:
dis bgp ***v4 all routing-table label
×××-Instance spi, Router ID 1.1.1.1:

Total Number of Routes: 1
Network NextHop In/Out Label

>i 192.168.2.0 2.2.2.2 NULL/1031(RR1与PE1的×××V4-MP-IBGP分发)
RR1:
dis bgp ***v4 all routing-table label
> 192.168.2.0 5.5.5.5 1031/1029(RR2与RR1-×××V4-MP-EBGP分发)

RR1-RR2:
dis bgp ***v4 all routing-table label
*> 192.168.2.0 5.5.5.5 1029/1027 (RR2与PE2-×××V4-MP-IBGP分发)
RR2-PE2
PE2:

192.168.2.0       192.168.2.254     1027/NULL

⑦三段公网LSP情况:
PE1-RR1上公网标签:
PE1:
dis fib 2.2.2.2
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
2.2.2.2/32 12.12.12.2 DGHU t[111] GE0/0/0 0x1
dis mpls lsp | in
dis mpls lsp | include 2.2.2.2

LSP Information: BGP LSP


LSP Information: LDP LSP

2.2.2.2/32 NULL/3 -/GE0/0/0
2.2.2.2/32 1024/3(RR1 LDP分发) -/GE0/0/0
RR1-ASBR1-ASBR2-RR2上公网标签:
dis fib 5.5.5.5
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
5.5.5.5/32 23.23.23.3 DGHU t[178] GE0/0/1 0x8
dis mpls lsp | in
dis mpls lsp | include 5.5.5.5

LSP Information: L3××× LSP


LSP Information: LDP LSP

5.5.5.5/32 NULL/1033(ASBR1 LDP给EBGP路由分发) -/GE0/0/1
5.5.5.5/32 1027/1033 -/GE0/0/1
ASBR1:
dis fib 5.5.5.5
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
5.5.5.5/32 34.34.34.4 DGHU t[40] GE0/0/0 0x1
dis mpls lsp | in
dis mpls lsp | include 5.5.5.5

LSP Information: BGP LSP

5.5.5.5/32 NULL/1027(与ASBR2 IPV4 -MP-EBGP分发) -/-

LSP Information: LDP LSP

5.5.5.5/32 1033/1027 -/-
ASBR2:
dis fib 5.5.5.5
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
5.5.5.5/32 45.45.45.5 DGHU t[75] GE0/0/1 0x1
dis mpls lsp | in
dis mpls lsp | include 5.5.5.5

LSP Information: BGP LSP

5.5.5.5/32 1027/NULL -/-

LSP Information: LDP LSP

5.5.5.5/32 NULL/3 (LDP RR2分发) -/GE0/0/1
5.5.5.5/32 1024/3 -/GE0/0/1
RR2-PE2公网标签:
RR2:dis fib 6.6.6.6
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
6.6.6.6/32 56.56.56.6 DGHU t[63] GE0/0/0 0x3
dis mpls lsp | in
dis mpls lsp | include 6.6.6.6

LSP Information: L3××× LSP


LSP Information: LDP LSP

6.6.6.6/32 NULL/3 -/GE0/0/0
6.6.6.6/32 1025/3(PE2 LDP 分发) -/GE0/0/0
4、数据层面分析
1)CE1到CE3的192.168.2.1数据转发分析:
① PC1 192.168.1.1 到网关PE1上的192.168.1.254;
② 在PE1上查询spi ***实例的路由表查到到192.168.2.0 下一跳为2.2.2.2;私网标签为1031;
③ 路由迭代,查找到路由如下:
dis ip routing-table 2.2.2.2
Route Flags: R - relay, D - download to fib

Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 OSPF 10 1 D 12.12.12.2 GigabitEthernet0/0/0
dis fib 2.2.2.2
dis fib 2.2.2.2
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
2.2.2.2/32 12.12.12.2 DGHU t[111] GE0/0/0 0x1
④MPLS ldp 为 2.2.2.2/32路由分配的公网标签为3 3为特殊标签进行POP:
dis mpls lsp | include 2.2.2.2

LSP Information: BGP LSP


LSP Information: LDP LSP

2.2.2.2/32 NULL/3 -/GE0/0/0
2.2.2.2/32 1024/3(RR1 LDP分发) -/GE0/0/0
⑤ 去往192.168.2.1的数据包在PE1上G0/0/0封装如图所示;

PE1的G0/0/0上使能了MPLS,所以进行MPLS2.5层标签转发;
RR1上根据私网1031标签找到VRF;
⑥ 在RR1上重新进行私网与公网标签的分装:
dis fib 5.5.5.5
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
5.5.5.5/32 23.23.23.3 DGHU t[178] GE0/0/1 0x8
dis mpls lsp | in
dis mpls lsp | include 5.5.5.5

LSP Information: L3××× LSP


LSP Information: LDP LSP

5.5.5.5/32 NULL/1033(ASBR1 LDP给EBGP路由分发) -/GE0/0/1
5.5.5.5/32 1027/1033 -/GE0/0/1
RR1:
dis bgp ***v4 all routing-table label
*> 192.168.2.0 5.5.5.5 1031/1029(RR2与RR1-×××V4-MP-EBGP分发)
在RR1离开接口G0/0/1上抓包发现只留公网标签1033私网标签1029:

⑦ 在ASBR1进行公网标签交换:
dis mpls lsp | in
dis mpls lsp | include 5.5.5.5

             LSP Information: BGP  LSP

5.5.5.5/32 NULL/1027(与ASBR2 IPV4 -MP-EBGP分发) -/-

             LSP Information: LDP LSP

5.5.5.5/32 1033/1027 -/-

离开ASBR1截图:

⑧进入ASBR2进行公网标签POP:
dis mpls lsp | include 5.5.5.5

             LSP Information: BGP  LSP

5.5.5.5/32 1027/NULL -/-

             LSP Information: LDP LSP

5.5.5.5/32 NULL/3 (LDP RR2分发) -/GE0/0/1
5.5.5.5/32 1024/3 -/GE0/0/1
离开ASBR2截图:

dis bgp ***v4 all routing-table label
*> 192.168.2.0 5.5.5.5 1029/1027 (RR2与PE2-×××V4-MP-IBGP分发)

到了RR2根据私网1029找到VRF;
⑨在RR2到PE2上,RR2上重新分装公网与私网标签:
RR2:dis fib 6.6.6.6
Route Entry Count: 1
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
6.6.6.6/32 56.56.56.6 DGHU t[63] GE0/0/0 0x3
dis mpls lsp | in
dis mpls lsp | include 6.6.6.6

             LSP Information: L3×××  LSP


             LSP Information: LDP LSP

6.6.6.6/32 NULL/3 -/GE0/0/0
6.6.6.6/32 1025/3(PE2 LDP 分发) -/GE0/0/0
dis bgp ***v4 all routing-table label
*> 192.168.2.0 5.5.5.5 1029/1027 (RR2与PE2-×××V4-MP-IBGP分发)

公网标签为特殊标签3,进行pop 只分装私网标签 1027
到了PE2根据1027标签找到相关VRF与CE根据路由进行交互。
⑩、通过路由表到PC3主机:
Ping的截图:

转载于:https://blog.51cto.com/baoer0717/2090166

你可能感兴趣的:(BGP/MPLS *** Option C (RR-RR)跨域研究)