配置MPLS步骤
ISP的部分
1.单播路由 2.MPLS
3.定义VRF空间,同时关联所连接的CE端接口,再同时定义RD/RT
4.MP-BGP---两个PE上配置
5.CE端将私网路由传递给PE端
1.单播路由
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
PE和P之间必须实现可以同行状态才能MPLS通信
2. MPLS协议开启
[r4]mpls lsr-id 4.4.4.4
[r4]mpls (进入MPLS)
[r4-mpls]mpls ldp
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]mpls (开启MPLS)
[r4-GigabitEthernet0/0/1]mpls ldp (使用协议)
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]mpls
[r4-GigabitEthernet0/0/0]mpls ldp
[r4]interface g4/0/0
[r4-GigabitEthernet4/0/0]mpls
[r4-GigabitEthernet4/0/0]mpls ldp
[r4]interface g0/0/2
[r4-GigabitEthernet0/0/2]mpls
[r4-GigabitEthernet0/0/2]mpls ldp
R2 R5 R6路由器中的连接CE端的接口不配置MPLS且不配置IP地址否则无法使用MPLS
3.定义VRF空间,同时关联所连接的CE端接口,再同时定义RD/RT
R2 R5 R6 与下同类型
[r2]ip vpn-instance a
[r2-vpn-instance-a]ipv4-family
[r2-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[r2-vpn-instance-a-af-ipv4]vpn-target 1:1 export-extcommunity
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r2-vpn-instance-a-af-ipv4]vpn-target 2:2 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
[r2-vpn-instance-a-af-ipv4]vpn-target 3:3 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip binding vpn-instance a(绑定接口)
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24(如果接口有地址需要删除然后再配置)
4.建立BGP邻居关系
R2 R5 R6同下
[r6]bgp 100
[r6-bgp]router-id 6.6.6.6
[r6-bgp]peer 2.2.2.2 as-number 100
[r6-bgp]peer 5.5.5.5 as-number 100
[r6-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r6-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r6-bgp]peer 2.2.2.2 next-hop-local
[r6-bgp]peer 5.5.5.5 next-hop-local
[r6-bgp]ipv4-family vpnv4
[r6-bgp-af-vpnv4]peer 2.2.2.2 enable
[r6-bgp-af-vpnv4]peer 5.5.5.5 enable
5.CE和PE之间可以相互通信
R1和R2上配置静态
[r1]ip route-static 0.0.0.0 0 12.1.1.2
[r2]ip route-static vpn-instance a 1.1.1.1 32 12.1.1.1
[r2]bgp 100
[r2-bgp]ipv4-family vpn-instance a
[r2-bgp-a]import-route direct
[r2-bgp-a]import-route static (导入直连和静态)
R5和R7上配置RIP
[r5]rip vpn-instance b
[r5-rip-1]version 2
[r5-rip-1]undo summary
[r5-rip-1]network 57.0.0.0
[r5]bgp 100
[r5-bgp]ipv4-family vpn-instance b
[r5-bgp-b]import-route direct
[r5-bgp-b]import-route rip 1
[r5]rip vpn-instance b
[r5-rip-1]import-route direct
[r5-rip-1]import-route bgp
[r7]rip 1
[r7-rip-1]version 2
[r7-rip-1]undo summary
[r7-rip-1]network 7.0.0.0
[r7-rip-1]network 57.0.0.0
R6和R8上配置OSPF
[r6]ospf 100 vpn-instance c
[r6-ospf-100]area 0
[r6-ospf-100-area-0.0.0.0]network 68.1.1.1 0.0.0.0
[r6]bgp 100
[r6-bgp]ipv4-family vpn-instance c
[r6-bgp-c]import-route ospf 100
[r6-bgp-c]import-route direct
[r6]ospf 100 vpn-instance c
[r6-ospf-100]import-route direct
[r6-ospf-100]import-route bgp
[r8]ospf 100 router-id 8.8.8.8
[r8-ospf-100]area 0
[r8-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255
6.各个MPLS路由表CE之间可达