一、IP配置
所有环回口都是设备的编号:例子:R1的环回口1.1.1.1/32
接口的IP为:
例子:R1的G0/0 9.9.12.1/24
R2的G0/0 9.9.12.2/24
从左往右以此类推
二、AS内的IGP(略)
三、域内的LDP—域内直连接口
例子:R2
mpls ip
mpls router ldp
ldp router-id interface Loopback 0 force
interface GigabitEthernet 0/1
mpls ip
label-switching
查看R3、R6
四、AS内的IBGP
R3和R6作为RR
R2
router bgp 234
neighbor 3.3.3.3 remote-as 234
neighbor 3.3.3.3 update-source Loopback 0
neighbor 3.3.3.3 next-hop-self
R3
router bgp 234
neighbor 2.2.2.2 remote-as 234
neighbor 2.2.2.2 update-source Loopback 0
neighbor 4.4.4.4 remote-as 234
neighbor 4.4.4.4 update-source Loopback 0
neighbor 2.2.2.2 route-reflector-client
neighbor 4.4.4.4 route-reflector-client
R4
router bgp 234
neighbor 3.3.3.3 remote-as 234
neighbor 3.3.3.3 update-source Loopback 0
neighbor 3.3.3.3 next-hop-self
R5
router bgp 567
neighbor 6.6.6.6 remote-as 567
neighbor 6.6.6.6 update-source Loopback 0
neighbor 6.6.6.6 next-hop-self
R6
router bgp 567
neighbor 5.5.5.5 remote-as 567
neighbor 5.5.5.5 update-source Loopback 0
neighbor 5.5.5.5 route-reflector-client
neighbor 7.7.7.7 remote-as 567
neighbor 7.7.7.7 update-source Loopback 0
neighbor 7.7.7.7 route-reflector-client
R7
router bgp 567
neighbor 6.6.6.6 remote-as 567
neighbor 6.6.6.6 update-source Loopback 0
neighbor 6.6.6.6 next-hop-self
查看R3--R6
五、域内的VPNV4邻居建立
R3和R6作为RR
R2
router bgp 234
address-family vpnv4 unicast
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 next-hop-self
R3
router bgp 234
address-family vpnv4 unicast
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 route-reflector-client
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 route-reflector-client
R4
router bgp 234
address-family vpnv4 unicast
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 next-hop-self
R5
router bgp 567
address-family vpnv4 unicast
neighbor 6.6.6.6 activate
neighbor 6.6.6.6 next-hop-self
R6
router bgp 567
address-family vpnv4 unicast
neighbor 5.5.5.5 activate
neighbor 5.5.5.5 route-reflector-client
neighbor 7.7.7.7 activate
neighbor 7.7.7.7 route-reflector-client
R7
router bgp 567
address-family vpnv4 unicast
neighbor 6.6.6.6 activate
neighbor 6.6.6.6 next-hop-self
查看R3、R6
六、PE设备配置VRF并重分发到BGP中
R2
ip vrf vpn1
rd 100:1
route-target both 1:1
interface GigabitEthernet 0/0
ip vrf forwarding vpn1
ip address 9.9.12.2 255.255.255.0
router ospf 300 vrf vpn1
network 9.9.12.2 0.0.0.0 area 0
router bgp 234
address-family ipv4 vrf vpn1
redistribute ospf 300 match internal external
R7
ip vrf vpn8
rd 100:7
route-target both 1:1
interface GigabitEthernet 0/0
ip vrf forwarding vpn8
ip address 9.9.78.7 255.255.255.0
router ospf 300 vrf vpn8
network 9.9.78.7 0.0.0.0 area 0
router bgp 567
address-family ipv4 vrf vpn8
redistribute ospf 300 match internal external
查看R2、R7
七、ASBR上进行纯IP转发(R4、R5),并重分发到BGP中
直连可以用IGP或者静态(通常用静态)
R4上的RT值需要和R2上的RT值匹配
R5上的RT值需要和R7上的RT值匹配
R4
ip vrf vpn-4
rd 100:4
route-target both 1:1
interface GigabitEthernet 0/0
ip vrf forwarding vpn-4
ip address 9.9.45.4 255.255.255.0
ip route vrf vpn-4 8.8.8.8 255.255.255.255 9.9.45.5
router bgp 234
address-family ipv4 vrf vpn-4
redistribute static
R5
ip vrf vpn-5
rd 100:5
route-target both 1:1
interface GigabitEthernet 0/0
ip vrf forwarding vpn-5
ip address 9.9.45.5 255.255.255.0
ip route vrf vpn-5 1.1.1.1 255.255.255.255 9.9.45.4
router bgp 567
address-family ipv4 vrf vpn-5
redistribute static
查看R4、R5
八、在PE上把BGP的路由重分发到OSPF300中
查看R2、R7
R2
router ospf 300 vrf vpn1
redistribute bgp subnets
R7
router ospf 300 vrf vpn8
redistribute bgp subnets
查看和测试