BGP、MPLS、VRF实验

BGP、MPLS、VRF实验_第1张图片
其中R2,R3,R4为运营商,R1和R7为A公司,R6和R8为B公司,R5为C公司。
要求:R1和R7之间可以互通,R6和R8之间可以互通,R5和R1,R6可以互通,R2和R4建立IBGP邻居关系

BGP、MPLS、VRF实验_第2张图片
1、R2、R3、R4为运营商路由器,使用IGP协议使内部全网可达,然后R2和R4建立IBGP邻居关系,此时由于R3没有起BGP,所以出现了BGP的路由黑洞,当R2路由传递至R3,R3会将私网路由丢弃,此时需要依靠MPLS的标签交换技术来解决,在2层和3层之间通过贴标签来解决BGP的路由黑洞
2、在R2和R4上分别针对不同的公司起VRF,A公司起OSPF协议,当R1的路由传到R2上时,由于在运营商内部传递私网路由需要靠BGP来传递,所以在R2上需要将OSPF重发布入BGP中,使得R1路由继续传递至R4上,R4将路由传递至R7则需要将BGP重发布进OSPF中。
3、当R7向R1传递路由时,则需要在R4上将OSPF重发布入BGP中,在R2上将BGP重发布入OSPF中。
做完这些后,两个不同地区的A公司就可以通过MPLS VPN实现互通,B公司和C公司同理可实现,实验结果如下:
BGP、MPLS、VRF实验_第3张图片R1BGP、MPLS、VRF实验_第4张图片R1
BGP、MPLS、VRF实验_第5张图片R6
BGP、MPLS、VRF实验_第6张图片R6
配置:

R1:
interface Loopback0
 ip address 10.1.1.1 255.255.255.255
interface Ethernet0/0
 ip address 10.100.1.1 255.255.255.0
router ospf 1
 router-id 10.1.1.1
 network 10.1.1.1 0.0.0.0 area 0
 network 10.100.1.0 0.0.0.255 area 0

R2:
ip vrf A
 rd 1:1
 route-target export 100:1
 route-target import 100:2
ip vrf B
 rd 2:2
 route-target export 200:1
 route-target import 200:2
interface Loopback0
 ip address 10.2.2.2 255.255.255.255
interface Ethernet0/0
 ip vrf forwarding A
 ip address 10.100.1.2 255.255.255.0
interface Ethernet0/1
 ip address 10.1.23.2 255.255.255.0
 mpls ip
interface Ethernet0/2
 ip vrf forwarding B
 ip address 10.200.1.2 255.255.255.0
router eigrp 100
 network 10.1.23.0 0.0.0.255
 network 10.2.2.2 0.0.0.0
router eigrp 1
 address-family ipv4 vrf B autonomous-system 90
  redistribute bgp 1 metric 1544 100 255 1 1500
  network 10.200.1.0 0.0.0.255
 exit-address-family
router ospf 1 vrf A
 router-id 10.2.2.2
 redistribute bgp 1 subnets
 network 10.100.1.0 0.0.0.255 area 0
router bgp 1
 bgp router-id 10.2.2.2
 bgp log-neighbor-changes
 neighbor 10.4.4.4 remote-as 1
 neighbor 10.4.4.4 update-source Loopback0
 address-family v4
  neighbor 10.4.4.4 activate
  neighbor 10.4.4.4 send-community both
 exit-address-family
 address-family ipv4 vrf A
  redistribute ospf 1
 exit-address-family
 address-family ipv4 vrf B
  redistribute eigrp 90
 exit-address-family

R3:
interface Loopback0
 ip address 10.3.3.3 255.255.255.255
interface Ethernet0/0
 ip address 10.1.23.3 255.255.255.0
 mpls ip
interface Ethernet0/1
 ip address 10.1.34.3 255.255.255.0
 mpls ip
router eigrp 100
 network 10.1.23.0 0.0.0.255
 network 10.1.34.0 0.0.0.255
 network 10.3.3.3 0.0.0.0

R4:
ip vrf C
 rd 3:3
 route-target export 100:2
 route-target import 100:1
ip vrf D
 rd 4:4
 route-target export 200:2
 route-target import 200:1
ip vrf E
 rd 5:5
 route-target export 100:2
 route-target export 200:2
 route-target import 100:1
 route-target import 200:1
interface Loopback0
 ip address 10.4.4.4 255.255.255.255
interface Ethernet0/0
 ip address 10.1.34.4 255.255.255.0
 mpls ip
interface Ethernet0/1
 ip vrf forwarding E
 ip address 10.88.1.4 255.255.255.0
interface Ethernet0/2
 ip vrf forwarding C
 ip address 10.100.2.4 255.255.255.0
interface Ethernet0/3
 ip vrf forwarding D
 ip address 10.200.2.4 255.255.255.0
router eigrp 100
 network 10.1.34.0 0.0.0.255
 network 10.4.4.4 0.0.0.0
router ospf 1 vrf C
 router-id 10.4.4.4
 redistribute bgp 1 subnets
 network 10.100.2.0 0.0.0.255 area 0
router bgp 1
 bgp router-id 10.4.4.4
 bgp log-neighbor-changes
 neighbor 10.2.2.2 remote-as 1
 neighbor 10.2.2.2 update-source Loopback0
 neighbor 10.88.1.5 remote-as 2
 address-family ipv4
  neighbor 10.2.2.2 activate
  neighbor 10.88.1.5 activate
 exit-address-family
 address-family v4
  neighbor 10.2.2.2 activate
  neighbor 10.2.2.2 send-community both
  neighbor 10.88.1.5 activate
  neighbor 10.88.1.5 send-community both
 exit-address-family
 address-family ipv4 vrf C
  redistribute ospf 1
 exit-address-family
 address-family ipv4 vrf D
  redistribute connected
  redistribute static
 exit-address-family
 address-family ipv4 vrf E
  network 10.4.4.4 mask 255.255.255.255
  neighbor 10.88.1.5 remote-as 2
  neighbor 10.88.1.5 activate
 exit-address-family
ip route vrf D 10.8.8.8 255.255.255.255 Ethernet0/3 10.200.2.8

R5:
interface Loopback0
 ip address 10.5.5.5 255.255.255.255
interface Ethernet0/0
 ip address 10.88.1.5 255.255.255.0
router bgp 2
 bgp router-id 10.5.5.5
 bgp log-neighbor-changes
 network 10.5.5.5 mask 255.255.255.255
 neighbor 10.88.1.4 remote-as 1
 address-family v4
  neighbor 10.88.1.4 activate
  neighbor 10.88.1.4 send-community both
 exit-address-family

R6:
interface Loopback0
 ip address 10.6.6.6 255.255.255.255
interface Ethernet0/0
 ip address 10.200.1.6 255.255.255.0
router eigrp 90
 network 10.6.6.6 0.0.0.0
 network 10.200.1.0 0.0.0.255
 
R7:interface Loopback0
 ip address 10.7.7.7 255.255.255.255
interface Ethernet0/0
 ip address 10.100.2.7 255.255.255.0
router ospf 1
 router-id 10.7.7.7
 network 10.7.7.7 0.0.0.0 area 0
 network 10.100.2.0 0.0.0.255 area 0

R8:
interface Loopback0
 ip address 10.8.8.8 255.255.255.255
interface Ethernet0/0
 ip address 10.200.2.8 255.255.255.0
no ip http server
no ip http secure-server
ip route 0.0.0.0 0.0.0.0 Ethernet0/0

你可能感兴趣的:(BGP、MPLS、VRF实验)