OptionB叫作单跳MP-eBGP方案,也叫作eBGP再分配方式。在该方案中,ASBR不需要为每个***创建***实例,ASBR和AS内的iBGP会话学习到PE上的***v4路由,再通过eBGP会话将这些路由再发布到其他AS的ASBR。但在MPLS ***的基本实现中,PE上只保存与本地*** 实例的RT值相匹配的***路由。通过对标签***v4路由进行特殊处理,让ASBR不进行RT值匹配,这样就可以把收到的***v4 路由全部保存下来,而不管本地是否有和它匹配的***实例。

Note that label allocation on ASBR2 is optional based on whether next-hop-self is configured toward the SP2 backbone for routes received via the Gateway PE-ASBR link.

Note that the PE-ASBR to PE-ASBR link must be directly connected. It can also be via a GRE tunnel as this is seen as a directly connected interface between the two routers.
Note that /32 host route is created regardless of whether nhs is set or not on the receiving PE-ASBR. This is because we need an implicit-null entry within the LFIB for the originating PE-ASBR (implementation specific), even though we do not use the entry within the LFIB.
请注意,PE-ASBR与PE-ASBR链接必须直接连接.它也可以通过GRE隧道,因为这被视为两个路由器之间直接连接的接口。请注意,无论NHS是否在接收的PE-ASBR上设置,都会创建/32主机路由。这是因为我们需要在LFIB中为原始的PE-ASBR(实现特定的)提供一个隐式-空条目(标签),即使我们没有在LFIB中使用这个条目。

实验拓扑(一)

需求
1)网段以及IP地址如拓扑所示
2)各AS执行的协议如拓扑所示
3)ASBR之间运行MP-eBGP的***v4
4)CE端可以互相访问(7.7.7.7/32和6.6.6.6/32)

配置
**Y-PE1****
!
hostname Y-PE1
!
mpls label range 100 199
mpls label protocol ldp
mpls ldp router-id Loopback0 force
!
ip vrf A
rd 100:7
route-target export 7:6
route-target import 7:6
route-target import 6:6
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet1
ip address 10.1.12.1 255.255.255.0
mpls ip
!
interface GigabitEthernet2
ip vrf forwarding A
ip address 202.100.1.1 255.255.255.0
!
router ospf 17 vrf A
router-id 11.11.11.11
redistribute bgp 100 subnets
network 202.100.1.0 0.0.0.255 area 0
!
router ospf 110
router-id 1.1.1.1
network 1.1.1.1 0.0.0.0 area 0
network 10.1.12.0 0.0.0.255 area 0
!
router bgp 100
bgp router-id 1.1.1.1
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
!
address-family ipv4
exit-address-family
!
address-family ***v4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
exit-address-family
!
address-family ipv4 vrf A
redistribute ospf 17 match internal external 1 external 2
exit-address-family
!

**Y-RR1****
!
hostname Y-RR1
!
mpls label range 200 299
mpls label protocol ldp
mpls ldp router-id Loopback0 force
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.12.2 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip address 10.1.23.2 255.255.255.0
mpls ip
!
router ospf 110
router-id 2.2.2.2
network 2.2.2.2 0.0.0.0 area 0
network 10.1.12.0 0.0.0.255 area 0
network 10.1.23.0 0.0.0.255 area 0
!
router bgp 100
bgp router-id 2.2.2.2
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor iBGP peer-group
neighbor iBGP remote-as 100
neighbor iBGP update-source Loopback0
neighbor 1.1.1.1 peer-group iBGP
neighbor 3.3.3.3 peer-group iBGP
!
address-family ipv4
exit-address-family
!
address-family ***v4
neighbor iBGP send-community extended
neighbor iBGP route-reflector-client
neighbor 1.1.1.1 activate
neighbor 3.3.3.3 activate
exit-address-family
!

**Y-ASBR1(XR设备)****
!
hostname Y-ASBR1
!
mpls ldp ---执行LDP协议
router-id 3.3.3.3 --定义LDP的R-ID
interface GigabitEthernet0/0/0/0 ---关联运行MPLS的接口
!
!
mpls label range table 0 16300 16399 ---定义标签范围
!
route-policy iBGP ---定义BGP访问策略(XR在建立eBGP时,默认drop)
pass
end-policy
!
router static ---配置静态路由(XR的eBGP对等体直连接口,一定要配置出接口,使其产生32位主机路由)
address-family ipv4 unicast
10.1.34.4/32 GigabitEthernet0/0/0/1
!
!
interface Loopback0
ipv4 address 3.3.3.3 255.255.255.255
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.1.23.3 255.255.255.0
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.1.34.3 255.255.255.0
!
!
router ospf 110
router-id 3.3.3.3
address-family ipv4 unicast --激活IPv4单播地址簇
area 0 --定义区域ID并关联运行OSPF的接口
interface Loopback0
!
interface GigabitEthernet0/0/0/0
!
!
!
router bgp 100
bgp router-id 3.3.3.3
address-family ipv4 unicast
allocate-label all ---IPv4单播地址簇中开启标签分发功能(默认关闭)
!
address-family ***v4 unicast
retain route-target all ---接收/拒绝携带RT扩展属性的前缀
!
neighbor 2.2.2.2 --先定义对等体(所有的条件在此配置)
remote-as 100
update-source Loopback0
address-family ***v4 unicast
next-hop-self
!
!
neighbor 10.1.34.4 --eBGP邻居
remote-as 200
address-family ***v4 unicast ---建立***v4的邻居关系
route-policy iBGP in
route-policy iBGP out
!
!
!

**B-ASBR1****
!
hostname B-ASBR1
!
!
mpls ldp
router-id 4.4.4.4
interface GigabitEthernet0/0/0/0
!
!
mpls label range table 0 16400 16499
!
route-policy iBGP
pass
end-policy
!
router static
address-family ipv4 unicast
10.1.34.3/32 GigabitEthernet0/0/0/1
!
!
interface Loopback0
ipv4 address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.1.45.4 255.255.255.0
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.1.34.4 255.255.255.0
!
!
router ospf 110
router-id 4.4.4.4
address-family ipv4 unicast
area 0
interface Loopback0
!
interface GigabitEthernet0/0/0/0
!
!
!
router bgp 200
bgp router-id 4.4.4.4
address-family ipv4 unicast
allocate-label all
!
address-family ***v4 unicast
retain route-target all
!
neighbor 5.5.5.5
remote-as 200
update-source Loopback0
address-family ***v4 unicast
next-hop-self
!
!
neighbor 10.1.34.3
remote-as 100
address-family ***v4 unicast
route-policy iBGP in
route-policy iBGP out
!
!
!

**B-PE1****
!
hostname B-PE1
!
mpls label range 500 599
mpls label protocol ldp
mpls ldp router-id Loopback0 force
!
ip vrf A
rd 200:6
route-target export 6:6
route-target import 6:6
route-target import 7:6
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.45.5 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip vrf forwarding A
ip address 61.128.1.5 255.255.255.0
!
router ospf 110
router-id 5.5.5.5
network 5.5.5.5 0.0.0.0 area 0
network 10.1.45.0 0.0.0.255 area 0
!
router rip
!
address-family ipv4 vrf A
redistribute bgp 200 metric transparent
network 61.0.0.0
no auto-summary
version 2
exit-address-family
!
router bgp 200
bgp router-id 5.5.5.5
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 4.4.4.4 remote-as 200
neighbor 4.4.4.4 update-source Loopback0
!
address-family ipv4
exit-address-family
!
address-family ***v4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community extended
exit-address-family
!
address-family ipv4 vrf A
redistribute rip
exit-address-family
!

**CE1****
!
hostname CE1
!
interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface Ethernet0/0
ip address 202.100.1.7 255.255.255.0
!

router ospf 17
router-id 7.7.7.7
network 7.7.7.7 0.0.0.0 area 0
network 202.100.1.0 0.0.0.255 area 0
!

**CE2****
!
hostname CE2
!
interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface Ethernet0/1
ip address 61.128.1.6 255.255.255.0
!
router rip
version 2
network 6.0.0.0
network 61.0.0.0
no auto-summary
!

实验拓扑(二)

需求
1)网段以及IP地址如拓扑所示
2)各AS执行的协议如拓扑所示
3)ASBR之间运行Multihop MP-eBGP的***v4(使用loopback0接口建立BGP邻居)
4)CE端可以互相访问(7.7.7.7/32和6.6.6.6/32)
注意:B-ASBR1将不再对B-PE1设备执行“next-hop-self”命令,而是在IGP中重分发静态

配置:
**Y-PE1****
!
hostname Y-PE1
!
mpls label range 100 199
mpls label protocol ldp
mpls ldp router-id Loopback0 force
!
ip vrf A
rd 100:7
route-target export 7:6
route-target import 7:6
route-target import 6:6
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet1
ip address 10.1.12.1 255.255.255.0
mpls ip
!
interface GigabitEthernet2
ip vrf forwarding A
ip address 202.100.1.1 255.255.255.0
!
router ospf 17 vrf A
router-id 11.11.11.11
redistribute bgp 100 subnets
network 202.100.1.0 0.0.0.255 area 0
!
router ospf 110
router-id 1.1.1.1
network 1.1.1.1 0.0.0.0 area 0
network 10.1.12.0 0.0.0.255 area 0
!
router bgp 100
bgp router-id 1.1.1.1
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
!
address-family ipv4
exit-address-family
!
address-family ***v4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
exit-address-family
!
address-family ipv4 vrf A
redistribute ospf 17 match internal external 1 external 2
exit-address-family
!

**Y-RR1****
!
hostname Y-RR1
!
mpls label range 200 299
mpls label protocol ldp
mpls ldp router-id Loopback0 force
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.12.2 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip address 10.1.23.2 255.255.255.0
mpls ip
!
router ospf 110
router-id 2.2.2.2
network 2.2.2.2 0.0.0.0 area 0
network 10.1.12.0 0.0.0.255 area 0
network 10.1.23.0 0.0.0.255 area 0
!
router bgp 100
bgp router-id 2.2.2.2
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor iBGP peer-group
neighbor iBGP remote-as 100
neighbor iBGP update-source Loopback0
neighbor 1.1.1.1 peer-group iBGP
neighbor 3.3.3.3 peer-group iBGP
!
address-family ipv4
exit-address-family
!
address-family ***v4
neighbor iBGP send-community extended
neighbor iBGP route-reflector-client
neighbor 1.1.1.1 activate
neighbor 3.3.3.3 activate
exit-address-family
!

**Y-ASBR1(XR设备)****
!
hostname Y-ASBR1
!
mpls ldp ---执行LDP协议
router-id 3.3.3.3 --定义LDP的R-ID
interface GigabitEthernet0/0/0/0 ---管理运行MPLS的接口
!
!
mpls label range table 0 16300 16399 ---定义标签范围
!
route-policy iBGP ---定义BGP访问策略(XR在建立eBGP时,默认drop)
pass
end-policy
!
router static ---配置静态路由(XR的eBGP对等体直连接口,一定要配置出接口,使其产生32位主机路由)
address-family ipv4 unicast
10.1.34.4/32 GigabitEthernet0/0/0/1
4.4.4.4/32 10.1.34.4 ---和B-ASBR1之间建立Multihop eBGP
!
!
interface Loopback0
ipv4 address 3.3.3.3 255.255.255.255
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.1.23.3 255.255.255.0
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.1.34.3 255.255.255.0
!
!
router ospf 110
router-id 3.3.3.3
address-family ipv4 unicast --激活IPv4单播地址簇
area 0 --定义区域ID并关联运行OSPF的接口
interface Loopback0
!
interface GigabitEthernet0/0/0/0
!
!
!
router bgp 100
bgp router-id 3.3.3.3
address-family ipv4 unicast
allocate-label all ---IPv4单播地址簇中开启标签分发功能(默认关闭)
!
address-family ***v4 unicast
retain route-target all ---接收/拒绝携带RT扩展属性的前缀
!
neighbor 2.2.2.2 --先定义对等体(所有的条件在此配置)
remote-as 100
update-source Loopback0
address-family ***v4 unicast
next-hop-self
!
!
neighbor 4.4.4.4
remote-as 200
ebgp-multihop 255
update-source Loopback0
address-family ***v4 unicast
route-policy iBGP in
route-policy iBGP out
!
!
!

**B-ASBR1****
!
hostname B-ASBR1
!
!
mpls ldp
router-id 4.4.4.4
interface GigabitEthernet0/0/0/0
!
!
mpls label range table 0 16400 16499
!
route-policy iBGP
pass
end-policy
!
router static
address-family ipv4 unicast
3.3.3.3/32 10.1.34.3
10.1.34.3/32 GigabitEthernet0/0/0/1
!
!
interface Loopback0
ipv4 address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.1.45.4 255.255.255.0
!
interface GigabitEthernet0/0/0/1
ipv4 address 10.1.34.4 255.255.255.0
!
!
router ospf 110
router-id 4.4.4.4
redistribute static
address-family ipv4 unicast
area 0
interface Loopback0
!
interface GigabitEthernet0/0/0/0
!
!
!
router bgp 200
bgp router-id 4.4.4.4
address-family ipv4 unicast
allocate-label all
!
address-family ***v4 unicast
retain route-target all
!
neighbor 5.5.5.5
remote-as 200
update-source Loopback0
address-family ***v4 unicast
!
!
neighbor 3.3.3.3
remote-as 100
ebgp-multihop 255
update-source Loopback0
address-family ***v4 unicast
route-policy iBGP in
route-policy iBGP out
!
!
!

**B-PE1****
!
hostname B-PE1
!
mpls label range 500 599
mpls label protocol ldp
mpls ldp router-id Loopback0 force
!
ip vrf A
rd 200:6
route-target export 6:6
route-target import 6:6
route-target import 7:6
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.45.5 255.255.255.0
mpls ip
!
interface Ethernet0/1
ip vrf forwarding A
ip address 61.128.1.5 255.255.255.0
!
router ospf 110
router-id 5.5.5.5
network 5.5.5.5 0.0.0.0 area 0
network 10.1.45.0 0.0.0.255 area 0
!
router rip
!
address-family ipv4 vrf A
redistribute bgp 200 metric transparent
network 61.0.0.0
no auto-summary
version 2
exit-address-family
!
router bgp 200
bgp router-id 5.5.5.5
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 4.4.4.4 remote-as 200
neighbor 4.4.4.4 update-source Loopback0
!
address-family ipv4
exit-address-family
!
address-family ***v4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community extended
exit-address-family
!
address-family ipv4 vrf A
redistribute rip
exit-address-family
!

**CE1****
!
hostname CE1
!
interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface Ethernet0/0
ip address 202.100.1.7 255.255.255.0
!

router ospf 17
router-id 7.7.7.7
network 7.7.7.7 0.0.0.0 area 0
network 202.100.1.0 0.0.0.255 area 0
!

**CE2****
!
hostname CE2
!
interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface Ethernet0/1
ip address 61.128.1.6 255.255.255.0
!
router rip
version 2
network 6.0.0.0
network 61.0.0.0
no auto-summary
!

优点:
不需要在ASBR上为每个***创建***实例,不需要跨域扩展协议,容易管理和配置。
缺点:
***的路由信息是通过AS之间的ASBR来保存和扩散的,当***路由较多时,ASBR负担重,容易成为故障点(可以重分发直连进IGP)。因此,在MP-eBGP方案中需要维护***路由信息的ASBR一般不再负责公网IP转发。