实验要求:
实验拓扑:
实验思路:
1、配置ip地址(r20口和1口先不配)
2、在mpls域里面启动ospf,启动mpls
3、创建2个VRF空间,携带rd 和rt值,绑定VRF空间对应的接口,然后再接口配置ip
4、在vrf空间建立MP-BGP邻居发布路由
5、在r1r2、r4r5上写静态(r2上静态写入VRF空间),在r6、r2和r4、r7分别启动rip、ospf,在VRF空间r2、r7重发布
6、缺省使r7可以访问r2、r3环回
配置命令:
1、配置IP
2、启动ospf 、启动mpls
r2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 192.168.2.0 0.0.0.255network 10.0.0.0 0.0.0.255
mpls lsr-id 2.2.2.2
mpls
mpls ldpinterface GigabitEthernet0/0/2
ip address 192.168.2.1 255.255.255.0
mpls
mpls ldp
r3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 192.168.2.0 0.0.0.255
network 192.168.4.0 0.0.0.255r4
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 192.168.4.0 0.0.0.255mpls lsr-id 4.4.4.4
mpls
mpls ldpinterface GigabitEthernet0/0/0
ip address 192.168.4.2 255.255.255.0
mpls
mpls ldp
3、创建2个VRF空间,携带rd 和rt值,绑定VRF空间对应的接口r2
ip vpn-instance a
ipv4-family
route-distinguisher 100:100
vpn-target 100:1 export-extcommunity
vpn-target 100:2 import-extcommunityinterface GigabitEthernet0/0/0
ip binding vpn-instance a
ip address 192.168.1.2 255.255.255.0ip vpn-instance b
ipv4-family
route-distinguisher 200:2
vpn-target 200:1 export-extcommunity
vpn-target 200:2 import-extcommunityinterface GigabitEthernet0/0/1
ip binding vpn-instance b
ip address 192.168.3.2 255.255.255.0r4
ip vpn-instance b
ipv4-family
route-distinguisher 100:100
vpn-target 100:2 export-extcommunity
vpn-target 100:1 import-extcommunityinterface GigabitEthernet0/0/1
ip binding vpn-instance b
ip address 192.168.5.1 255.255.255.0ip vpn-instance a
ipv4-family
route-distinguisher 200:2
vpn-target 200:2 export-extcommunity
vpn-target 200:1 import-extcommunityinterface GigabitEthernet0/0/2
ip binding vpn-instance a
ip address 192.168.6.1 255.255.255.04、在vrf空间建立MP-BGP邻居发布路由
r2
bgp 2
router-id 2.2.2.2
peer 4.4.4.4 as-number 2
peer 4.4.4.4 connect-interface LoopBack0ipv4-family vpnv4(让bgp传递vpn4)
policy vpn-target
peer 4.4.4.4 enable
ipv4-family vpn-instance a (VRF空间)
import-route direct
import-route static
ipv4-family vpn-instance b
import-route rip 1
rip 1 vpn-instance b(在VRF空间内启动rip)
version 2
network 192.168.3.0
import-route bgp
ip route-static vpn-instance a 1.1.1.0 255.255.255.0 192.168.1.1r4
bgp 2
router-id 4.4.4.4
peer 2.2.2.2 as-number 2
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family vpnv4
policy vpn-target
peer 2.2.2.2 enable
#
ipv4-family vpn-instance a
import-route ospf 2
#
ipv4-family vpn-instance b
import-route direct
import-route staticospf 2 router-id 4.4.4.4 vpn-instance a
import-route bgp
area 0.0.0.0
network 192.168.6.0 0.0.0.255
ip route-static vpn-instance b 5.5.5.0 255.255.255.0 192.168.5.2
5、使r7可以访问r2、r3环回
ip route-static 0.0.0.0 0.0.0.0 10.0.0.2
实验结果: