先配置公网的IP地址及AR2,AR3和AR4的地址
其中AR2左接口和AR4右接口不属于公网,属于私网的IP地址,因此配置时需要注意
AR2
AR3
AR4
AR2
AR3和AR4同理
配置完成后检查OSPF的邻居表
以及检查MPLS LDP表
注意:默认只给32位的分标签
AR2
[r2]ip -instance b1
[r2--instance-b1]ipv4-family
[r2--instance-b1-af-ipv4]route-distinguisher 1:1
[r2--instance-b1-af-ipv4]-target 1:1
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip binding -instance b1
[r2-GigabitEthernet0/0/0]ip address 192.168.2.2 24
配置完成后查看接口有IP但是查看路由表中不存在该接口的IP
[r2]ip -instance a1
[r2--instance-a1]ipv4-family
[r2--instance-a1-af-ipv4]route-distinguisher 2:2
[r2--instance-a1-af-ipv4]-target 2:2
[r2--instance-a1-af-ipv4]q
[r2--instance-a1]q
[r2]int g0/0/2
[r2-GigabitEthernet0/0/2]ip binding -instance a1
[r2-GigabitEthernet0/0/2]ip address 192.168.2.2 24
AR2
[r2]bgp 2
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 4.4.4.4 as-number 2
[r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r2-bgp]ipv4-family v4
[r2-bgp-af-v4]peer 4.4.4.4 enable
AR4
[r4]bgp 2
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 2.2.2.2 as-number 2
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r4-bgp]ipv4-family v4
[r4-bgp-af-v4]peer 2.2.2.2 enable
AR1
[r1]ip route-static 192.168.3.0 24 192.168.2.2
[r1]ip route-static 192.168.4.0 24 192.168.2.2
AR2
[r2]ip route-static -instance b1 192.168.1.0 24 192.168.2.1
AR5
[r5]ip route-static 192.168.2.0 24 192.168.3.2
[r5]ip route-static 192.168.1.0 24 192.168.3.2
AR4与AR2同理
AR2和AR4同理
[r2]bgp 2
[r2-bgp]ipv4-family -instance b1
[r2-bgp-b1]import-route static
[r2-bgp-b1]import-route direct
AR6启rip
[r6]rip 1
[r6-rip-1]version 2
[r6-rip-1]network 192.168.1.0
[r6-rip-1]network 192.168.2.0
AR2
[r2]rip -instance a1
[r2-rip-1]version 2
[r2-rip-1]network 192.168.2.0
AR7启ospf
[r7]ospf 2 router-id 7.7.7.77
[r7-ospf-2]area 0
[r7-ospf-2-area-0.0.0.0]network 192.168.4.2 0.0.0.0
[r7-ospf-2-area-0.0.0.0]network 192.168.3.1 0.0.0.0
AR4
[r4]ospf 2 -instance a2
[r4-ospf-2]area 0
[r4-ospf-2-area-0.0.0.0]network 192.168.3.2 0.0.0.0
AR2
[r2]rip 1 -instance a1
[r2-rip-1]import-route bgp
[r2-rip-1]q
[r2]bgp 2
[r2-bgp]ipv4-family -instance a1
[r2-bgp-a1]import-route rip 1
AR4
[r4]ospf 2 -instance a2
[r4-ospf-2]import-route bgp
[r4-ospf-2]q
[r4]bgp 2
[r4-bgp]ipv4-family -instance a2
[r4-bgp-a2]import-route ospf 2