1. 配置IP地址
[PE1-LoopBack0]ip add 1.1.1.1 32
[PE1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[PE1-GigabitEthernet0/0/1]ip add 10.1.1.1 24
[PE1-GigabitEthernet0/0/2]ip add 10.2.1.1 24
[PE2-LoopBack0]ip add 2.2.2.2 32
[PE2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[PE2-GigabitEthernet0/0/1]ip add 10.5.1.2 24
[PE2-GigabitEthernet0/0/2]ip add 10.6.1.2 24
[MCE-GigabitEthernet0/0/0]ip add 10.5.1.3 24
[MCE-GigabitEthernet0/0/1]ip add 10.3.1.3 24
[MCE-GigabitEthernet0/0/2]ip add 10.4.1.3 24
[MCE-GigabitEthernet4/0/0]ip add 10.6.1.3 24
[CE1-GigabitEthernet0/0/0]ip add 10.1.1.4 24
[CE2-GigabitEthernet0/0/0]ip add 10.2.1.5 24
[AR6-GigabitEthernet0/0/0]ip add 10.3.1.6 24
[AR6-GigabitEthernet0/0/1]ip add 192.168.1.6 24
[AR7-GigabitEthernet0/0/0]ip add 10.4.1.7 24
[AR7-GigabitEthernet0/0/1]ip add 192.168.2.7 24
2. 在骨干网的PE上配置OSPF协议,实现PE之间的互通
[PE1]ospf
[PE1-ospf-1]area 0
[PE1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[PE1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[PE2]ospf
[PE2-ospf-1]area 0
[PE2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[PE2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
3. 在骨干网的PE上配置MPLS基本能力和MPLS LDP,PE之间建立LDP LSP
[PE1]mpls lsr-id 1.1.1.1
[PE1]mpls
[PE1]mpls ldp
[PE1-GigabitEthernet0/0/0]mpls
[PE1-GigabitEthernet0/0/0]mpls ldp
[PE2]mpls lsr-id 2.2.2.2
[PE2]mpls
[PE2]mpls ldp
[PE2-GigabitEthernet0/0/0]mpls
[PE2-GigabitEthernet0/0/0]mpls ldp
4. 在PE设备上配置VPN实例,将CE1、CE2接入PE1,将MCE接入PE2
[PE1]ip vpn-instance vpna
[PE1-vpn-instance-vpna]ipv4-family
[PE1-vpn-instance-vpna-af-ipv4]route-distinguisher 100:1
[PE1-vpn-instance-vpna-af-ipv4]vpn-target 111:1 both
[PE1]ip vpn-instance vpnb
[PE1-vpn-instance-vpnb]ipv4-family
[PE1-vpn-instance-vpnb-af-ipv4]route-distinguisher 100:2
[PE1-vpn-instance-vpnb-af-ipv4]vpn-target 222:2 both
[PE1-GigabitEthernet0/0/1]ip binding vpn-instance vpna
[PE1-GigabitEthernet0/0/1]ip add 10.1.1.1 24
[PE1-GigabitEthernet0/0/2]ip binding vpn-instance vpnb
[PE1-GigabitEthernet0/0/2]ip add 10.2.1.1 24
[PE2]ip vpn-instance vpna
[PE2-vpn-instance-vpna]ipv4-family
[PE2-vpn-instance-vpna-af-ipv4]route-distinguisher 200:1
[PE2-vpn-instance-vpna-af-ipv4]vpn-target 111:1 both
[PE2]ip vpn-instance vpnb
[PE2-vpn-instance-vpnb]ipv4-family
[PE2-vpn-instance-vpnb-af-ipv4]route-distinguisher 200:2
[PE2-vpn-instance-vpnb-af-ipv4]vpn-target 222:2 both
[PE2-GigabitEthernet0/0/1]ip binding vpn-instance vpna
[PE2-GigabitEthernet0/0/1]ip add 10.5.1.2 24
[PE2-GigabitEthernet0/0/2]ip binding vpn-instance vpnb
[PE2-GigabitEthernet0/0/2]ip add 10.6.1.2 24
5. MCE设备上配置VPN实例,将AR6、AR7接入MC
[MCE]ip vpn-instance vpna
[MCE-vpn-instance-vpna]ipv4-family
[MCE-vpn-instance-vpna-af-ipv4]route-distinguisher 100:1
[MCE]ip vpn-instance vpnb
[MCE-vpn-instance-vpnb]route-distinguisher 100:2
[MCE-GigabitEthernet0/0/0]ip binding vpn-instance vpna
[MCE-GigabitEthernet0/0/0]ip add 10.5.1.3 24
[MCE-GigabitEthernet0/0/1]ip binding vpn-instance vpna
[MCE-GigabitEthernet0/0/1]ip add 10.3.1.3 24
[MCE-GigabitEthernet0/0/2]ip binding vpn-instance vpnb
[MCE-GigabitEthernet0/0/2]ip add 10.4.1.3 24
[MCE-GigabitEthernet4/0/0]ip binding vpn-instance vpnb
[MCE-GigabitEthernet4/0/0]ip add 10.6.1.3 24
6. 在PE之间建立MP-IBGP对等体,在PE1与CE1及PE1与CE2之间建立EBGP对等体
[PE1]bgp 100
[PE1-bgp]peer 2.2.2.2 as-number 100
[PE1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[PE1-bgp]ipv4-family vpnv4
[PE1-bgp-af-vpnv4]peer 2.2.2.2 enable
[PE1-bgp]ipv4-family vpn-instance vpna
[PE1-bgp-vpna]peer 10.1.1.4 as-number 65410
[PE1-bgp-vpna]import-route direct
[PE1-bgp]ipv4-family vpn-instance vpnb
[PE1-bgp-vpnb]peer 10.2.1.5 as-number 65420
[PE1-bgp-vpnb]import-route direct
[PE2]bgp 100
[PE2-bgp]peer 1.1.1.1 as-number 100
[PE2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[PE2-bgp]ipv4-family vpnv4
[PE2-bgp-af-vpnv4]peer 1.1.1.1 enable
[CE1]bgp 65410
[CE1-bgp]peer 10.1.1.1 as-number 100
[CE1-bgp]import-route direct
[CE2]bgp 65420
[CE2-bgp]peer 10.2.1.1 as-number 100
[CE2-bgp]import-route direct
7. 在MCE与Site间配置路由
[AR6]ip route-static 0.0.0.0 0.0.0.0 10.3.1.3
[MCE]ip route-static vpn-instance vpna 192.168.1.0 24 10.3.1.6
vpnb内运行RIP,在MCE上配置RIP进程200,并与vpnb实例绑定,以便将vpnb内的路由学习到vpnb实例的路由表中
[MCE]rip 200 vpn-instance vpnb
[MCE-rip-200]version 2
[MCE-rip-200]network 10.0.0.0
[MCE-rip-200]import-route ospf 20
[AR7]rip 200
[AR7-rip-200]version 2
[AR7-rip-200]network 10.0.0.0
[AR7-rip-200]network 192.168.2.0
8. 在MCE和PE2之间配置OSPF多实例
[PE2]ospf 10 vpn-instance vpna
[PE2-ospf-10]import-route bgp //在PE2的OSPF视图下引入BGP路由,发布PE1的私网路由给MCE
[PE2-ospf-10]area 0
[PE2-ospf-10-area-0.0.0.0]network 10.5.1.0 0.0.0.255
[PE2]ospf 20 vpn-instance vpnb
[PE2-ospf-20]import-route bgp
[PE2-ospf-20]area 0
[PE2-ospf-20-area-0.0.0.0]network 10.6.1.0 0.0.0.255
[PE2]bgp 100 //在PE2的BGP视图下引入该OSPF进程,发布MCE的私网路由信息给PE1上
[PE2-bgp]ipv4-family vpn-instance vpna
[PE2-bgp-vpna]import-route ospf 10
[PE2-bgp]ipv4-family vpn-instance vpnb
[PE2-bgp-vpnb]import-route ospf 20
[MCE]ospf 10 vpn-instance vpna
[MCE-ospf-10]import-route static
[MCE-ospf-10]vpn-instance-capability simple
[MCE-ospf-10]area 0
[MCE-ospf-10-area-0.0.0.0]network 10.3.1.0 0.0.0.255
[MCE-ospf-10-area-0.0.0.0]network 10.5.1.0 0.0.0.255
[MCE]ospf 20 vpn-instance vpnb
[MCE-ospf-20]import-route rip 200
[MCE-ospf-20]vpn-instance-capability simple
[MCE-ospf-20]area 0
[MCE-ospf-20-area-0.0.0.0]network 10.4.1.0 0.0.0.255
[MCE-ospf-20-area-0.0.0.0]network 10.6.1.0 0.0.0.255
9. 检查配置