拓补图
以CE1、PE1、P1、ASBR1配置为例,CE2、PE2、P2、ASBR2的配置同理
1.首先按要求配置上IP地址
2.PE与CE之间路由的交互(这里只是简单的演示一下配置命令,具体的详解在IP阶段有详细说明)
CE1:
[CE1]ospf
[CE1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[CE1-ospf-1-area-0.0.0.0]network 10.1.12.1 0.0.0.0
PE1:
[PE1]ip vpn-instance 1
[PE1-vpn-instance-1]route-distinguisher 1:1
[PE1-vpn-instance-1]vpn-target 1:100 export-extcommunity
[PE1-vpn-instance-1]vpn-target 2:100 import-extcommunity
[PE1]int g0/0/0
[PE1-GigabitEthernet0/0/0]ip binding vpn-instance 1
[PE1-GigabitEthernet0/0/0]ip add 10.1.12.2 24
[PE1]ospf 2 vpn-instance 1
[PE1-ospf-2]a 0
[PE1-ospf-2-area-0.0.0.0]network 10.1.12.2 0.0.0.0
3.MPLS网络中VPNV4路由的交互
PE1:
[PE1]ospf
[PE1-ospf-1-area-0.0.0.0]network 10.1.23.2 0.0.0.0
[PE1-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[PE1]bgp 100
[PE1-bgp]peer 4.4.4.4 as 100
[PE1-bgp]peer 4.4.4.4 connect-interface lo 0
[PE1-bgp]ipv4-family vpnv4
[PE1-bgp-af-vpnv4]peer 4.4.4.4 enable
[PE1-bgp]ipv4-family vpn-instance 1
[PE1-bgp-1]import-route ospf 2
[PE1]mpls lsr-id 2.2.2.2
[PE1]mpls
[PE1-mpls]mpls ldp
[PE1]int g0/0/1
[PE1-GigabitEthernet0/0/1]mpls
[PE1-GigabitEthernet0/0/1]mpls ldp
[PE1]ospf 2
[PE1-ospf-2]import-route bgp
[PE1]ip vpn-instance 1
[PE1-vpn-instance-1]route-distinguisher 1:1
[PE1-vpn-instance-1]vpn-target 1:100 export-extcommunity
[PE1-vpn-instance-1]vpn-target 2:100 import-extcommunity
P1:
[P1]ospf
[P1-ospf-1-area-0.0.0.0]network 10.1.23.3 0.0.0.0
[P1-ospf-1-area-0.0.0.0]network 10.1.34.3 0.0.0.0
[P1-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[P1]mpls lsr-id 3.3.3.3
[P1]mpls
[P1-mpls]mpls ldp
[P1]int g0/0/0
[P1-GigabitEthernet0/0/0]mpls ldp
[P1-GigabitEthernet0/0/0]int g0/0/1
[P1-GigabitEthernet0/0/1]mpls ldp
ASBR1:
[ASBR1]ospf
[ASBR1-ospf-1]a 0
[ASBR1-ospf-1-area-0.0.0.0]network 10.1.34.4 0.0.0.0
[ASBR1-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[ASBR1]bgp 100
[ASBR1-bgp]peer 2.2.2.2 as 100
[ASBR1-bgp]peer 2.2.2.2 connect-interface lo 0
[ASBR1-bgp]ipv4-family vpnv4
[ASBR1-bgp-af-vpnv4]peer 2.2.2.2 enable
[ASBR1]mpls lsr-id 4.4.4.4
[ASBR1]mpls
[ASBR1-mpls]mpls ldp
[ASBR1]int g0/0/0
[ASBR1-GigabitEthernet0/0/0]mpls
[ASBR1-GigabitEthernet0/0/0]mpls ldp
[ASBR1]ip vpn-instance 1[ASBR1-vpn-instance-1]route-distinguisher 1:1
[ASBR1-vpn-instance-1]vpn-target 1:100 import-extcommunity
[ASBR1-vpn-instance-1]vpn-target 2:100 export-extcommunity
4.不同AS之间路由的交互
[ASBR1]ip vpn-instance 1
[ASBR1]int g0/0/1
[ASBR1-GigabitEthernet0/0/1]ip binding vpn-instance 1
[ASBR1]bgp 100
[ASBR1-bgp]ipv4-family vpn-instance 1
[ASBR1-bgp-1]peer 10.1.45.5 as 200
5.验证结果:
CE1上有了CE2的8.8.8.8的路由,也能够成功的ping通了
6.总结
MPLS VPN的多域的配置其实跟单域的配置的原理是一样的,但是实验过程中需要注意几个点,在当前域配置的时候可以把另外一个域的所有设备当成是一个整体,这个整体就充当CE,也就是说PE1还是本地PE,ASBR1可以当做是对端PE来对待,所以在PE1上面配置RT的值的时候,也需要在ASBR1上面去配置RT的值,这个就是比较重要的点,还有就是PE1跟ASBR1要建立MP-IBGP的邻居关系,而不是普通的IBGP邻居关系
7.配置代码
因为上面的步骤都有复制出来的代码,但是可能有些乱,所以我把在设备上配置的命令都截图下来,也可以方便读者去查看是在那个协议视图下去配置的,细节的地方比较多
PE1:
P1:
ASBR1: