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

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

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
查看公网路有:
<ASBR1>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 : <Active>
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 : <Inactive>
Destinations : 0 Routes : 0
查看MPLS LDP session:
<ASBR1>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:
<ASBR1>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
查看公网路有:
<ASBR2>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 : <Active>
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 : <Inactive>
Destinations : 0 Routes : 0
查看MPLS LDP session:
<ASBR2>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:
<ASBR2>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上公网与私网标签:
<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
<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: 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上公网与私网标签:
<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
<RR2>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 : <Active>
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:
<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:
<PE1>ping -a 1.1.1.1 6.6.6.6
<RR1>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的公网标签分配情况:
<PE1>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 -/-
<PE1>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时,表示报文不通过隧道转发。

<PE1>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:<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
<ASBR1>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

<ASBR1>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的标签
<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
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:
<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标签

<ASBR2>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之前:
<RR2>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的标签
<RR2>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
<RR2>

RR1上测试:

<RR1>ping -c 10000 -a 2.2.2.2 5.5.5.5
<RR1>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
<ASBR1>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 -/-
<ASBR1>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
<ASBR2>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
<ASBR2>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
<RR2>dis mpls lsp

             LSP Information: LDP LSP

FEC In/Out Label In/Out IF Vrf Name
抓包:
RR1 出口:
BGP/MPLS *** Option C (RR-RR)跨域研究
ASBR1出口:
BGP/MPLS *** Option C (RR-RR)跨域研究
ASBR2出口:
BGP/MPLS *** Option C (RR-RR)跨域研究

注意在ASBR2上关于5.5.5.5路由标签分发上:
<ASBR2>dis mpls lsp
<ASBR2>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上查看:
<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直连路由:
<PE2>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 : <Active>
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 : <Inactive>
Destinations : 0 Routes : 0
<PE2>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中:
<PE2>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路由情况:
<PE2>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
<PE2>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路由分配的私网标签:
<PE2>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
<RR2>dis bgp ***v4 all routing-table label
<RR2>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路由情况:
<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

*> 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:
<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:
<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:
<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:
<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
<PE1>dis mpls lsp | in
<PE1>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上公网标签:
<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
<RR1>dis mpls lsp | in
<RR1>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:
<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
<ASBR1>dis mpls lsp | in
<ASBR1>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:
<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
<ASBR2>dis mpls lsp | in
<ASBR2>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:<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
<RR2>dis mpls lsp | in
<RR2>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;
③ 路由迭代,查找到路由如下:
<PE1>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
<PE1>dis fib 2.2.2.2
<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
④MPLS ldp 为 2.2.2.2/32路由分配的公网标签为3 3为特殊标签进行POP:
<PE1>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封装如图所示;
BGP/MPLS *** Option C (RR-RR)跨域研究
PE1的G0/0/0上使能了MPLS,所以进行MPLS2.5层标签转发;
RR1上根据私网1031标签找到VRF;
⑥ 在RR1上重新进行私网与公网标签的分装:
<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
<RR1>dis mpls lsp | in
<RR1>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:
<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:
BGP/MPLS *** Option C (RR-RR)跨域研究
BGP/MPLS *** Option C (RR-RR)跨域研究

⑦ 在ASBR1进行公网标签交换:
<ASBR1>dis mpls lsp | in
<ASBR1>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截图:
BGP/MPLS *** Option C (RR-RR)跨域研究
⑧进入ASBR2进行公网标签POP:
<ASBR2>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截图:
BGP/MPLS *** Option C (RR-RR)跨域研究

<RR2>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:<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
<RR2>dis mpls lsp | in
<RR2>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
<RR2>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的截图:
BGP/MPLS *** Option C (RR-RR)跨域研究
BGP/MPLS *** Option C (RR-RR)跨域研究

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于H3C模拟器的BGP-MPLS跨域配置,您可以按照以下步骤进行设置: 1. 首先,确保所有相关设备(PE、P、ASBR)上都已经开启了MPLS与LDP功能。 2. 在配置路由协议方面,您需要在设备上配置OSPF,指定一个Router ID,并将其归属于区域0.0.0.0(如果尚未配置)。请确保网络配置中包含正确的网络地址和掩码。 3. 接下来,您需要配置设备的接口。在Loopback接口上配置一个IP地址,例如3.3.3.3,同时指定正确的掩码。对于与其他设备连接的接口,例如GigabitEthernet0/0和GigabitEthernet0/1,需要配置IP地址,启用MPLS和LDP功能。 4. 最后,您还需要配置BGP-MPLS跨域。这可以通过在设备上配置BGP并启用MPLS标签分发来实现。您可以使用命令`bgp`进入BGP配置模式,然后使用相应的命令配置BGP邻居和路由策略。 请注意,这些步骤只是一个大致的指南,具体的配置可能因您的网络拓扑和需求而有所不同。建议您参考H3C模拟器的官方文档或咨询网络专家以获取更详细和准确的配置指导。 interface GigabitEthernet0/1 #PE、P、ASBR设备之间都需要开启mpls与ldp功能。 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 # mpls lsr-id 3.3.3.3。 interface LoopBack0 ip address 3.3.3.3 255.255.255.255 # interface GigabitEthernet0/0 ip address 34.34.34.1 255.255.255.252 mpls enable mpls ldp enable # interface GigabitEthernet0/1 ip address 23.23.23.2 255.255.255.252 mpls enable mpls ldp enable。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值