實驗拓撲圖redis
CE與PE之間跑OSPF爲例ide
一、配置IGP(OSPF)oop
show ip ospf neighborspa
show ip route ospf orm
二、配置MPLSrouter
能夠配置mpls的標籤範圍blog
mpls label range xx-xx接口
默認是ldp協議圖片
接口下啓用mplsip
int fa0/0
mpls ip
查看鄰居
show mpls ldp discovery
show mpls ldp neighbor
show mpls forwarding-table\\查看標籤分配狀況
三、配置MP-BGP
1)PE之間配置BGP ×××V4鄰居關係
R1:
router bgp 100
no bgp default ipv4-unicast
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
!
address-family ***v4
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 send-community extended
R3:
router bgp 100
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
!
address-family ***v4
neighbor 1.1.1.1 activate
neighbor 1.1.1.1 send-community extended
四、配置VRF應用至接口
R1:
ip vrf Mao
rd 100:10
route-target export 100:11
route-target import 100:10
ip vrf Ting
rd 100:11
route-target export 100:13 //表示輸出的路由打上100:13標記
route-target import 100:14 //將標記爲100:14的路由加入VRF路由表中
interface FastEthernet0/0
ip vrf forwarding Mao
ip address 14.1.1.1 255.255.255.252
interface FastEthernet0/1
ip vrf forwarding Ting
ip address 15.1.1.1 255.255.255.252
R3:
ip vrf Mao
rd 100:10
route-target export 100:10
route-target import 100:11
!
ip vrf Ting
rd 100:11
route-target export 100:14
route-target import 100:13
interface FastEthernet0/1
ip vrf forwarding Mao
ip address 36.1.1.1 255.255.255.252
!
interface FastEthernet1/0
ip vrf forwarding Ting
ip address 37.1.1.1 255.255.255.252
查看VRF基本狀況Show ip vrf detail
R1#show ip vrf detail
VRF Mao (VRF Id = 1); default RD 100:10; default ×××ID <not set>
Interfaces:
Fa0/0
VRF Table ID = 1
Export ××× route-target communities
RT:100:10
Import ××× route-target communities
RT:100:11
No import route-map
No global export route-map
No export route-map
VRF label distribution protocol: not configured
VRF label allocation mode: per-prefix
VRF Ting (VRF Id = 2); default RD 100:11; default ×××ID <not set>
Interfaces:
Fa0/1
VRF Table ID = 2
Export ××× route-target communities
RT:100:14
Import ××× route-target communities
RT:100:13
No import route-map
No global export route-map
No export route-map
VRF label distribution protocol: not configured
VRF label allocation mode: per-prefix
五、CE和PE之間配置路由協議
CE-R4:
router ospf 10
router-id 4.4.4.4
network 4.4.4.4 0.0.0.0 area 1
network 14.1.1.0 0.0.0.3 area 1
PE-R1:
router ospf 10 vrf Mao
network 14.1.1.0 0.0.0.3 area 1
PE-R3:
router ospf 2 vrf Mao
network 36.1.1.0 0.0.0.3 area 2
CE-R6:
router ospf 2
router-id 6.6.6.6
network 6.6.6.6 0.0.0.0 area 2
network 36.1.1.0 0.0.0.3 area 2
show ip route vrf Mao 查看VRF Mao路由
Routing Table: Mao
Gateway of last resort is not set
6.0.0.0/32 is subnetted, 1 subnets
O 6.6.6.6 [110/2] via 36.1.1.2, 00:12:43, FastEthernet0/1
36.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 36.1.1.0/30 is directly connected, FastEthernet0/1
L 36.1.1.1/32 is directly connected, FastEthernet0/1
六、CE客戶路由與MP-BGP之間重分佈
PE-R1:
router ospf 10 vrf Mao
redistribute bgp 100 subnets
network 14.1.1.0 0.0.0.3 area 1
router bgp 100
address-family ipv4 vrf Mao
redistribute ospf 10
PE-R3:
router ospf 2 vrf Mao
redistribute bgp 100 subnets
network 36.1.1.0 0.0.0.3 area 2
router bgp 100
address-family ipv4 vrf Mao
redistribute ospf 2
exit-address-family
查看bgp ×××V4路由
Show ip bgp ***v4 all
擴展知識:
R1#show ip bgp ***v4 all 4.4.4.4
BGP routing table entry for 100:10:4.4.4.4/32, version 2
Paths: (1 available, best #1, table Mao)
Advertised to update-groups:
1
Refresh Epoch 1
Local
14.1.1.2 from 0.0.0.0 (1.1.1.1)
Origin incomplete, metric 2, localpref 100, weight 32768, valid, sourced, best
Extended Community: RT:100:10 OSPF DOMAIN ID:0x0005:0x0000000A0200
OSPF RT:0.0.0.1:2:0 OSPF ROUTER ID:14.1.1.1:0
mpls labels in/out 103/nolabel //表示MP-BGP給4.4.4.4分配的內層標籤;
rx pathid: 0, tx pathid: 0x0
RT:0.0.0.1:2:0 0.0.0.1表示區域,2表示OSPF LSA類型(通常爲1LSA或者2LAS),區域間路由,若是是3表示ospf 3 LAS,若是是5則表
R1#show ip bgp ***v4 all 77.1.1.1
BGP routing table entry for 100:11:77.1.1.1/32, version 24
Paths: (1 available, best #1, table Ting)
Not advertised to any peer
Refresh Epoch 1
Local
3.3.3.3 (metric 3) from 3.3.3.3 (3.3.3.3)
Origin incomplete, metric 20, localpref 100, valid, internal, best
Extended Community: RT:100:13 OSPF DOMAIN ID:0x0005:0x0000000C0200
OSPF RT:0.0.0.0:5:1 OSPF ROUTER ID:37.1.1.1:0
mpls labels in/out nolabel/310
// 若是RT:0.0.0.0:5:1 5表示爲OSPF LSA 5
總結: CE端路由重分佈至MP-BGP時,可以承載OSPF屬性值。