Saturday, May 30, 2015

Forwarding Labeled packet in MPLS

  “Forwarding labeled packets is quite different from forwarding IP packets”


We will continue with How labeled packets are forwarded in MPLS networks, how forwarding labeled packets is different from forwarding IP packets, how labeled packets are load-balanced, and what a label switching router (LSR) does with a packet with an unknown label.


IP Lookup Versus Label Lookup

When a router receives an IP packet, the lookup done is an IP lookup. In Cisco IOS, this means that the packet is looked up in the CEF table. When a router receives a labeled packet, the lookup is done in the LFIB of the router.

The router knows that it receives a labeled packet or an IP packet by looking at the protocol field in the Layer 2 header


See IP-to-label forwarding case

R1#sh ip cef 3.3.3.3 detail
3.3.3.3/32, epoch 0
  local label info: global/16
  1 RR source [no flags]
  nexthop 192.168.0.2 FastEthernet1/0 label 16

Here,IP packets that enter the LSR destined for 3.3.3.3/32 go out on interface FastEthernet1/0 after being imposed with the label 16

The next hop of this packet is 192.168.0.2 - R2

The IP-to-label forwarding is done at the imposing LSR

 In Cisco IOS, CEF switching is the only IP switching mode that you can use to label packets



LFIB

This is an example of the label-to-label forwarding case.for 3.3.3.3

R1#sh mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
16         16         3.3.3.3/32       0             Fa1/0      192.168.0.2
17         Pop Label  2.2.2.2/32       0             Fa1/0      192.168.0.2

The local label (or tag) is the label that this LSR assigns and distributes to the other LSRs

Label 16 swap with Label 16..(Label is locally significant)



if this LSR receive   a packet with Top label 17, it will remove all label and forward this as an IP packet.

17         Pop Label  2.2.2.2/32       0             Fa1/0      192.168.0.2

If the detail key word is specified, you can see all the labels that change in the label stack

R1#sh mpls forwarding-table 3.3.3.3 detail
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
16         16         3.3.3.3/32       0             Fa1/0      192.168.0.2
        MAC/Encaps=14/18, MRU=1500, Label Stack{16}
        CA0114D80006CA0014D8001C8847 00010000
        No output feature configured
R1#


Example of an Entry in the LFIB for an MPLS VPN Prefix

R1#sh mpls forwarding-table vrf A
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
21         No Label   10.0.0.0/24[V]   1458          aggregate/A
27         No Label   5.5.5.5/32[V]    1068          Fa0/0      10.0.0.5

The CEF adjacency table, however, determines the outgoing data link encapsulation.The
adjacency table provides the necessary Layer 2 information to forward the packet to the next-hop
LSR

R1#sh adjacency  detail

Protocol Interface                 Address
IP       FastEthernet0/0           10.0.0.5(12)
                                   13 packets, 1194 bytes
                                   epoch 0
                                   sourced in sev-epoch 0
                                   Encap length 14
                                   CA040A800008CA0014D800080800
                                   ARP
IP       FastEthernet0/1           10.0.0.4(12)
                                   84 packets, 9760 bytes
                                   epoch 0
                                   sourced in sev-epoch 0
                                   Encap length 14
                                   CA0302C80006CA0014D800060800
                                   ARP
IP       FastEthernet1/0           192.168.0.2(14)
                                   0 packets, 0 bytes
                                   epoch 0
                                   sourced in sev-epoch 0
                                   Encap length 14
                                   CA0114D80006CA0014D8001C0800
                                   ARP
TAG      FastEthernet1/0           192.168.0.2(5)
                                   129 packets, 12446 bytes
                                   epoch 0
                                   sourced in sev-epoch 0
                                   Encap length 14
                                   CA0114D80006CA0014D8001C8847
                                   ARP
R1#
R1#

These are the operation...

■ Pop—The top label is removed. The packet is forwarded with the remaining label stack or as an unlabeled packet.


■ Swap—The top label is removed and replaced with a new label.

■ Push—The top label is replaced with a new label (swapped), and one or more labels are added (pushed) on top of the swapped label.

■ Untagged/No Label—The stack is removed, and the packet is forwarded unlabeled.

■ Aggregate—The label stack is removed, and an IP lookup is done on the IP packet.

..................................................................................

Unknown Label 

In normal operation, an LSR should receive only a labeled packet with a label at the top of the stack that is known to the LSR, because the LSR should have previously advertised that label.However, it is possible for something to go wrong in the MPLS network and the LSR to start receiving labeled packets with a top label that the LSR does not find in its LFIB. The LSR can theoretically try two things: strip off the labels and try to forward the packet, or drop the packet.
The Cisco LSR drops the packet

Reserved Labels

Labels 0 through 15 are reserved labels. An LSR cannot use them in the normal case for forwarding packets. An LSR assigns a specific function to each of these labels. Label 0 is the explicit NULL label, whereas label 3 is the implicit NULL label.



Implicit NULL Label

The implicit NULL label is the label that has a value of 3. An egress LSR assigns the implicit NULL label to a FEC if it does not want to assign a label to that FEC, thus requesting the upstream LSR to perform a pop operation.

In normal operation,Edge LSR will perform two look up one  Label Lookup and second one IP lookup  , The solution for this double lookup is to have the egress LSR signal the last but one (or penultimate) LSR in the label switched path (LSP) to send the packets without a label.


The use of implicit NULL at the end of an LSP is called penultimate hop popping (PHP)

The egress LSR signals the penultimate LSR to use implicit NULL by not sending a regular label, but by sending the special label with value 3.The result is that the egress LSR receives an IP packet and 
only needs to perform an IP lookup to be able to forward the packet

 label 3 will never be seen as a label in the label stack of an MPLS packet

Note:---The use of implicit NULL is widespread and not confined only to the above  example . It  could be that the packets have two or three or more labels in the label stack. Then the implicit  NULL label used at the egress LSR would signal the penultimate hop router to pop one label and  send the labeled packet with one label less to the egress LSR.


Explicit NULL Label

in implicit null label The packet is forwarded with one label less than it was received by the penultimate LSR or unlabeled if it was received with only one label.
Besides the label value, the label also holds the Experimental (EXP) bits. When a label is removed, the EXP bits are also removed.  Because the  EXP bits are exclusively used for quality of service (QoS), the QoS part of the packet is lost when  the top label is removed

The explicit NULL label is the solution to this problem, because the egress LSR signals the IPv4 explicit NULL label (value 0) to the penultimate hop router





The egress LSR then receives labeled packets with a label of value 0 as the top label. The LSR cannot forward the packet by looking up  the value 0 in the LFIB because it can be assigned to multiple FECs. The LSR just removes the  explicit NULL label. After the LSR removes the explicit NULL label, another lookup has to occur,  but the advantage is that the router can derive the QoS information of the received packet by looking at the EXP bits of the explicit NULL label

 EXP bits value can be copied to the precedence or DiffServ bits when performing PHP and thus preserve the QoS information. Or, if the label stack has multiple labels and the top label is popped off, we can copy  EXP bits value to the EXP field of the new top label.


Router Alert Label

The Router Alert label is the one with value 1. This label can be present anywhere in the label stack except at the bottom. When the Router Alert label is the top label, it alerts the LSR that the packet needs a closer look. Therefore, the packet is not forwarded in hardware, but it is looked at by a software process.

Unreserved Labels

Except for the reserved labels of 0 through 15, you can use all the label values for normal packet forwarding. Because the label value has 20 bits, the labels from 16 through 1,048,575 (220 – 1) are used for normal packet forwarding. In Cisco IOS, the default range is 16 through 100,000

R1#show mpls label range 


Downstream Generic label region: Min/Max label: 16/100000



TTL behavior  

Time To Live (TTL) is a well-known mechanism thanks to IP. In the IP header is a field of 8 bits that signifies the time that a packet still has before its life ends and is dropped. 
TTL is usually 255 and is then decremented by 1 at each hop. If the TTL reaches 0, the 

packet is dropped.

In MPLS, the usage of the TTL field in the label is the same as the TTL in the IP header. When an IP packet enters the MPLS cloud—such as on the ingress LSR—the IP TTL value is copied (after being decremented by 1) to the MPLS TTL values of the pushed label(s).
 At the egress LSR, the label is removed, and the IP header is exposed again.

The IP TTL value is copied from the MPLS TTL value in the received top label after decrementing it by 1.



TTL Behavior in the Case of Label-to-Label


If the operation that is performed on the labeled packet is a swap, the TTL of incoming label –1 is copied to the swapped label

If the operation that is performed on the labeled packet is to push one 
or more labels, the received MPLS TTL of the top label –1 is copied to the swapped label and all pushed labels.

If the operation is pop, the TTL of the incoming label –1 is copied to the newly 
exposed label unless that value is greater than the TTL of the newly exposed label, in which case the copy does not happen













































Friday, May 29, 2015

MPLS- Label Spaces

continued from ...MPLS -Label....


MPLS Label Spaces

■ Label distribution mode
■ Label retention mode
■ LSP control mode. 

Label Distribution Modes

The MPLS architecture has two modes to distribute label bindings:

■ Downstream-on-Demand (DoD) label distribution mode
■ Unsolicited Downstream (UD) label distribution mode



In the DoD mode, each LSR requests its next-hop (that is, downstream) LSR on an LSP, a label binding for that FEC. Each LSR receives one binding per FEC only from its downstream LSR on that FEC.

In the case of DoD, the LIB shows only one remote binding,

In the UD mode, each LSR distributes a binding to its adjacent LSRs,n the UD mode, an LSR receives a remote label binding from each adjacent LSR.

in the case of UD, the LIB shows more then one remote binding.

Cisco IOS, all interfaces,use the UD label distribution mode , except LC-ATM interfaces

Label Retention Modes

Two label retention modes are possible:
■ Liberal Label Retention (LLR) mode
      In LLR mode, an LSR keeps all received remote bindings in the LIB

■ Conservative Label Retention (CLR) mode.
    An LSR that is running this mode does not store all remote bindings in the    LIB, but it stores  only   the remote binding that is associated with the next-   hop LSR for a particular FEC.

In short, the LLR mode gives you quicker adaptation to routing changes, whereas CLR mode givesyou fewer labels to store and a better usage of the available memory on the router.



LSP Control Modes

LSRs can create a local binding for a FEC in two ways:

■ Independent LSP Control mode
■ Ordered LSP Control mode

The LSR can create a local binding for a FEC independently from the other LSRs. This is called  Independent LSP Control mode. In this control mode, each LSR creates a local binding for a  particular FEC as soon as it recognizes the FEC.

In Ordered LSP Control mode, an LSR only creates a local binding for a FEC if it recognizes that it is the egress LSR for the FEC or if the LSR has received a label binding from the next hop for this FEC.


The disadvantage of Independent LSP Control is that some LSRs begin to label switch packets before the complete LSP is set up end to end; therefore, the packet is not forwarded in the manner it should be

Thursday, May 28, 2015

MPLS -- Label

MPLS stands for Multiprotocol Label Switching.

Label switching indicates that the packets switched are no longer IPv4 packets, IPv6 packets, or
even Layer 2 frames when switched, but they are labeled. The most important item to MPLS is
the label.

MPLS Labels

One MPLS label is a field of 32 bits with a certain structure , 


MPLS Label

The first 20 bits are the label value. This value can be between 0 and 220–1, or 1,048,575.
The bits 20 to 22 are the three experimental (EXP) bits. These bits are used solely for quality of
service (QoS)
Bit 23 is the Bottom of Stack (BoS) bit. It is 0, unless this is the bottom label in the stack.
The stack is the collection of labels that are found on top of the packet.so last label has BoS bit 1.
Bits 24 to 31 are the eight bits used for Time To Live (TTL). This TTL has the same function as
the TTL found in the IP header

The first label in the stack is called the top label, and the last label is called the bottom label.
There can be any no of label in between.


Label
EXP
BoS
TTL
 Label
 EXP
0
TTL 
 Label
 EXP
....
TTL 
 Label
EXP 
...
TTL 
 Label
EXP 
1
 TTL


Encoding of MPLS

                              Placement of the label stack for labeled packets.




The Layer 2 encapsulation of the link can be almost any encapsulation that Cisco IOS supports:
PPP, High-Level Data Link Control (HDLC), Ethernet, and so on. Assuming that the transported
protocol is IPv4

MPLS is not a Layer 2 protocol because the Layer 2 encapsulation is still present with labeled packets. MPLS also is not really a Layer 3 protocol because the Layer 3 protocol is still present, too. Therefore, MPLS does not fit in the OSI layering too well. Perhaps the easiest thing to do is to view MPLS as the 2.5 layer and be done with it.

Label switch router (LSR)

A label switch router (LSR) is a router that supports MPLS. It is capable of understanding MPLS
labels and of receiving and transmitting a labeled packet on a data link. Three kinds of LSRs exist
in an MPLS network:
■ Ingress LSRs—Ingress LSRs receive a packet that is not labeled yet, insert a label (stack) in
front of the packet, and send it on a data link.

■ Egress LSRs—Egress LSRs receive labeled packets, remove the label(s), and send them on
a data link. Ingress and egress LSRs are edge LSRs.

■ Intermediate LSRs—Intermediate LSRs receive an incoming labeled packet, perform an
operation on it, switch the packet, and send the packet on the correct data link.

An LSR can do the three operations: pop, push, or swap.

An LSR that pushes labels onto a packet that was not labeled yet is called an imposing LSR  , it is  ingress LSR

An LSR that removes all labels from the labeled packet before switching out the
packet is a disposing LSR. One that does disposition is an egress LSR.

Ingress and egress LSRs are referred to as provideredge (PE) routers.
Intermediate LSRs are referred to as provider (P) routers

Label Switched Path

A label switched path (LSP) is a sequence of LSRs that switch a labeled packet through an MPLS network or part of an MPLS network.

Note :-LSP is unidirectional

The ingress LSR of an LSP is not necessarily the first router to label the packet. The packet might have already been labeled by a preceding LSR. Such a case would be a nested LSP—that is, an LSP inside another LSP.

Forwarding Equivalence Class
  A Forwarding Equivalence Class (FEC) is a group or flow of packets that are forwarded along the same path and are treated the same with regard to the forwarding treatment.
Packets belonging to the same FEC have the same label.    
However, not all packets that have the same label belong to the same FEC, because their EXP values might differ;
Some FEC example

  • Packets with Layer 3 destination IP addresses matching a certain prefix
  • Multicast packets belonging to a certain group
  • Packets with the same forwarding treatment, based on the precedence or IP DiffServ Code Point (DSCP) field
  • Packets with Layer 3 destination IP addresses that belong to a set of Border Gateway Protocol (BGP) prefixes, all with the same BGP next hop.
  • One PVC to another PVC
Label Distribution

  •      The ingress LSR imposes one or more labels on the packet.
  •      The intermediate LSRs swap the top label (the incoming label) of the received labeled  packet with another label (the outgoing label) and transmit the packet on the outgoing link.
  •       The egress LSR of the LSP strips off the labels of this LSP and forwards the packet

    Labels have no global meaning across the network. For adjacent routers to agree which label to use for which prefix, they need some form of communication between them; otherwise, the routers do not know which outgoing label needs to match which incoming label. A label distribution protocol is needed..
Label can be distributed in 2 ways,
■ Piggyback the labels on an existing IP routing protocol
■ Have a separate protocol distribute labels

BGP is a routing protocol  that can carry prefixes and distribute labels at the same time. However, BGP is not an IGP


The second method—running a separate protocol for label distribution—has the advantage of  being routing protocol independent.



Several varieties of protocols distribute labels:

■ Tag Distribution Protocol (TDP)
■ Label Distribution Protocol (LDP)
■ Resource Reservation Protocol (RSVP)
TDP, which predates LDP, was the first protocol for label distribution developed and implemented by Cisco. However, TDP is proprietary to Cisco. TDP is becoming obsolete.

The IETF later formalized LDP. LDP and TDP are similar in the way they operate,
Label distribution by RSVP is used for MPLS TE only.



.
Label Distribution with LDP

For every IGP IP prefix in its IP routing table, each LSR creates a local binding—that is, it binds a label to the IPv4 prefix. The LSR then distributes this binding to all its LDP neighbors. These received bindings become remote bindings. The neighbors then store these remote and local bindings in a special table, the label information base (LIB). Each LSR has only one local binding
per prefix, at least when the label space is per platform. If the label space is per interface, one local label binding can exist per prefix per interface. Therefore, you can have one label per prefix or one label per prefix per interface, but the LSR gets more than one remote binding because it usually
has more than one adjacent LSR.

The LSR chooses the remote binding received from the downstream LSR, which is the next hop in the routing table for that prefix. It uses this information to set up its label forwarding information base (LFIB) where the label from the local binding serves as the incoming label and the label from the one remote binding chosen via the routing table serves as the outgoing label.

Label Forwarding Instance Base

The LFIB is the table used to forward labeled packets. It is populated with the incoming and outgoing labels for the LSPs. The incoming label is the label from the local binding on the particular LSR. The outgoing label is the label from the remote binding chosen by the LSR from all possible remote bindings.
All these remote bindings are found in the LIB. The LFIB chooses only one of the possible outgoing labels from all the possible remote bindings in the LIB and  installs it in the LFIB.


The remote label chosen depends on which path is the best path found in the routing table.


In the case of MPLS traffic engineering, the labels are distributed by RSVP


Wednesday, May 27, 2015

MPLS - Basics

1.The MPLS labels are advertised between routers so that they can build a label-to-label mapping.

The label switching technique is not new. Frame Relay and ATM use it to move frames or cells
throughout a network
Benefits of MPLS

■ The use of one unified network infrastructure
■ Better IP over ATM integration
■ Border Gateway Protocol (BGP)-free core
■ The peer-to-peer model for MPLS VPN
■ Optimal traffic flow
■ Traffic engineering

The Use of One Unified Network Infrastructure
With MPLS, the idea is to label ingress packets based on their destination address or other
preconfigured criteria and switch all the traffic over a common infrastructure. This is the great
advantage of MPLS
By using MPLS with IP, you can extend the possibilities of what you can transport. Adding labels
to the packet enables you to carry other protocols than just IP over an MPLS-enabled Layer 3 IP
backbone, similarly to what was previously possible only with Frame Relay or ATM Layer 2
networks. MPLS can transport IPv4, IPv6, Ethernet, High-Level Data Link Control (HDLC), PPP,
and other Layer 2 technologies.
The feature whereby any Layer 2 frame is carried across the MPLS backbone is called Any
Transport over MPLS (AToM).

BGP-Free Core

MPLS, enables the forwarding of packets based on a label lookup rather than a lookup
of the IP addresses. MPLS enables a label to be associated with an egress router rather than with 
the destination IP address of the packet. The label is the information attached to the packet that 
tells every intermediate router to which egress edge router it must be forwarded. The core routers
no longer need to have the information to forward the packets based on the destination IP address.

Thus, the core routers in the service provider network no longer need to run BGP. 
"The label that is associated with an IP packet is the label that is associated with this 

BGP next-hop IP address."
An Internet service provider (ISP) that has 200 routers in its core network needs to have BGP
running on all 200 routers. If MPLS is implemented on the network, only the edge routers—which

might be 50 or so routers—need to run BGP

Peer-to-Peer VPN Model
In the peer-to-peer VPN model, the service provider routers carry the customer data across the
network, but they also participate in the customer routing. In other words, the service provider

routers peer directly with the customer routers at Layer 3
Before MPLS existed, the peer-to-peer VPN model could be achieved by creating the IP routing
peering between the customer and service provider routers. The VPN model also requires

privateness or isolation between the different customers.ACL can be used for privateness.
Before MPLS came into being, the overlay VPN model was deployed much more commonly than
the peer-to-peer VPN model
MPLS  VPN is one application of MPLS that made the peer-to-peer VPN model much easier to implement.The privateness in MPLS VPN networks is achieved by using the concept of virtual routing/ forwarding (VRF)

Traffic Engineering
The basic idea behind traffic engineering is to optimally use the network infrastructure, including

links that are underutilized, because they do not lie on the preferred path ,  With traffic engineering
implemented in the MPLS network, you could have the traffic that is destined for a particular
prefix or with a particular quality of service flow from point A to point B along a path that is
different from the least-cost path.



History of MPLS in Cisco IOS

Cisco Systems started off with putting labels on top of IP packets in what was then called tag
switching. The first implementation was released in Cisco IOS 11.1(17)CT in 1998. A tag was the name for what is now known as a label. This implementation could assign tags to networks from the routing table and put those tags on top of the packet that was destined for that network

 IETF standardized tag switching into MPLS. The IETF released the first RFC on
MPLS—RFC 2547, “BGP/MPLS VPNs”—in 1999.

OLD Terminology
New  Terminology
Tag Switching
MPLS
Tag
Label
TDP(Tag Distribution Protocol)
LDP (Label Distr. Pro.)
TFIB(Tag forwarding Information base)
LFIB( Label FIB)
TSR ( Tag switching router)
LSR ( Label Switching  Router)
TSP ( Tag switched Path)
LSP ( Label Switched Path)
TSC(Tag switch controller)
LSC ( Label switch controller)


TDP was used as the basis for LDP. LDP has the same functionality as TDP, but they are different protocols.

Architectural Blocks of MPLS

MPLS functionality on Cisco devices is divided into two main architectural blocks:

Control plane— Performs functions related to identifying reachability to destination prefixes. Therefore, the control plane contains all the Layer 3 routing information, as well as the processes within, to exchange reachability information for a specific Layer 3 prefix. Common examples of control plane functions are routing protocol information exchange like in OSPF and BGP. . In addition, all protocol functions that are responsible for the exchange of labels between neighboring routers function in the control plane as in label distribution protocols

Data plane— Performs the functions relating to forwarding data packets. These packets can be either Layer 3 IP packets or labeled IP packets. i.e FIB/LFIB

MPLS Applications

1.MPLS VPN
2.MPLS TE(Traffic Engineering)
3.AToM( Any Transport over MPLS):-  
                Layer 2  encapsulation types that can be carried over an AToM network today are Frame Relay, ATM, PPP, HDLC, Ethernet, and 802.1Q.
4.Virtual Private LAN Service.
    VPLS is the Layer 2 service that emulates a LAN across an MPLS-enabled network
 


Sunday, May 24, 2015

MPLS VPN - Overlapping Customer Address



VRF Configuration in R1**********************

ip vrf A
 rd 11:11
 route-target export 11:11
 route-target import 11:11
!
ip vrf B
 rd 22:22
 route-target export 22:22
 route-target import 22:22

interface FastEthernet0/0
 ip vrf forwarding A
 ip address 10.0.0.1 255.255.255.0         Address overlapping  
!
interface FastEthernet0/1
 ip vrf forwarding B
 ip address 10.0.0.1 255.255.255.0       Address overlapping  



VRF Configuration in R3  ***********************

ip vrf A
 rd 11:11
 route-target export 11:11
 route-target import 11:11
!
ip vrf B
 rd 22:22
 route-target export 22:22

 route-target import 22:22

interface FastEthernet0/1
 ip vrf forwarding B
 ip address 11.0.0.3 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet1/0
 ip vrf forwarding A
 ip address 12.0.0.3 255.255.255.0
 duplex auto
 speed auto


PE-CE routing OSPF

Routing between R1-R4  and R1-R5

In OSPF  each VRF must have unique Process-ID and Router - ID

router ospf 2 vrf B
 redistribute bgp 111 subnets
 network 10.0.0.0 0.0.0.255 area 1
!
router ospf 3 vrf A
 router-id 111.11.11.11
 redistribute bgp 111 subnets
 network 10.0.0.0 0.0.0.255 area 2

Routing between R3- R7 and R3-R6

In OSPF  each VRF must have unique Process-ID and Router - ID

router ospf 2 vrf B
 redistribute bgp 111 subnets
 network 11.0.0.0 0.0.0.255 area 1
!
router ospf 3 vrf A
 router-id 33.33.33.33
 redistribute bgp 111 subnets
 network 12.0.0.3 0.0.0.0 area 2

*************************MP-BGP Config*****************



 ---------MP-BGP config in R1-----

router bgp 111
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 111
 neighbor 3.3.3.3 update-source Loopback0
 !
 address-family vpnv4
  neighbor 3.3.3.3 activate
  neighbor 3.3.3.3 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf A
  redistribute ospf 3 match internal external 1 external 2
 exit-address-family
 !
 address-family ipv4 vrf B
  redistribute ospf 2 match internal external 1 external 2

 exit-address-family

---------MP-BGP config in R3-----

router bgp 111
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 111
 neighbor 1.1.1.1 update-source Loopback0
 !
 address-family vpnv4
  neighbor 1.1.1.1 activate
  neighbor 1.1.1.1 send-community both
 exit-address-family
 !
 address-family ipv4 vrf A
  redistribute ospf 3 match internal external 1 external 2
 exit-address-family
 !
 address-family ipv4 vrf B
   redistribute ospf 2 match internal external 1 external 2

 exit-address-family

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

R5

R5#sh ip int br  | in up
FastEthernet0/0            10.0.0.5        YES manual up                    up
Loopback0                  5.5.5.5         YES manual up                    up

router ospf 1
 network 0.0.0.0 255.255.255.255 area 2

  R4

R4#sh ip int br | in up
FastEthernet0/1            10.0.0.4        YES manual up                    up
Loopback0                  4.4.4.4         YES manual up                    up

router ospf 3
 network 0.0.0.0 255.255.255.255 area 1

R6

R6#sh ip int br | in up
FastEthernet0/1            11.0.0.1        YES manual up                    up
Loopback0                  6.6.6.6         YES manual up                    up

router ospf 1
 network 0.0.0.0 255.255.255.255 area 1

R7

R7#sh ip int br | in up
FastEthernet0/0            12.0.0.7        YES manual up                    up
Loopback0                  7.7.7.7         YES manual up                    up

router ospf 1
 network 0.0.0.0 255.255.255.255 area 2









                                        SHOW Results
Overlapping addres 10.0.0.1/24 in VRF A & B      

R1#sh ip bgp vpnv4 all

     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 11:11 (default for vrf A)
 *>  5.5.5.5/32       10.0.0.5                 2         32768 ?
 *>i 7.7.7.7/32       3.3.3.3                  2    100      0 ? ******* BGP route from R3
 *>  10.0.0.0/24      0.0.0.0                  0         32768 ?
 *>i 12.0.0.0/24      3.3.3.3                  0    100      0 ?********BGP route from R3

Route Distinguisher: 22:22 (default for vrf B)
 *>  4.4.4.4/32       10.0.0.4                 2         32768 ?
 *>i 6.6.6.6/32       3.3.3.3                  2    100      0 ?******** BGP route from R3
 *>  10.0.0.0/24      0.0.0.0                  0         32768 ?
 *>i 11.0.0.0/24      3.3.3.3                  0    100      0 ?******* BGP route from R3
R1#

R1#sh bgp vpnv4 unicast all  7.7.7.7/32

BGP routing table entry for 11:11:7.7.7.7/32, version 67    11:11 is RD for VRF A

Paths: (1 available, best #1, table A)
  Not advertised to any peer
  Refresh Epoch 1
  Local
    3.3.3.3 (metric 3) from 3.3.3.3 (3.3.3.3)
      Origin incomplete, metric 2, localpref 100, valid, internal, best
      Extended Community: RT:11:11 OSPF DOMAIN ID:0x0005:0x000000030200
        OSPF RT:0.0.0.2:2:0 OSPF ROUTER ID:33.33.33.33:0
      mpls labels in/out nolabel/23
      rx pathid: 0, tx pathid: 0x0

R1#

R1#sh bgp vpnv4 unicast all  6.6.6.6/32
BGP routing table entry for 22:22:6.6.6.6/32, version 53  22:22  is RD for VRF A
Paths: (1 available, best #1, table B)
  Not advertised to any peer
  Refresh Epoch 1
  Local
    3.3.3.3 (metric 3) from 3.3.3.3 (3.3.3.3)
      Origin incomplete, metric 2, localpref 100, valid, internal, best
      Extended Community: RT:22:22 OSPF DOMAIN ID:0x0005:0x000000020200
        OSPF RT:0.0.0.1:2:0 OSPF ROUTER ID:11.0.0.3:0
      mpls labels in/out nolabel/20
      rx pathid: 0, tx pathid: 0x0


***************************R3 ***********************************
**************************************************************



R3#sh ip bgp vpnv4 all


     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 11:11 (default for vrf A)
 *>i 5.5.5.5/32       1.1.1.1                  2    100      0 ?
 *>  7.7.7.7/32       12.0.0.7                 2         32768 ?
 *>i 10.0.0.0/24      1.1.1.1                  0    100      0 ? *****BGP route from R1
 *>  12.0.0.0/24      0.0.0.0                  0         32768 ?
Route Distinguisher: 22:22 (default for vrf B)
 *>i 4.4.4.4/32       1.1.1.1                  2    100      0 ?
 *>  6.6.6.6/32       11.0.0.1                 2         32768 ?
 *>i 10.0.0.0/24      1.1.1.1                  0    100      0 ? ********* BGP route from R1
 *>  11.0.0.0/24      0.0.0.0                  0         32768 ?

R3#

R3#sh bgp vpnv4 unicast all 10.0.0.1/24
BGP routing table entry for 11:11:10.0.0.0/24, version 64   11:11 RD for VRF A
Paths: (1 available, best #1, table A)
  Not advertised to any peer
  Refresh Epoch 1
  Local
    1.1.1.1 (metric 3) from 1.1.1.1 (1.1.1.1)
      Origin incomplete, metric 0, localpref 100, valid, internal, best
      Extended Community: RT:11:11 OSPF DOMAIN ID:0x0005:0x000000030200
        OSPF RT:0.0.0.2:2:0 OSPF ROUTER ID:111.11.11.11:0
      mpls labels in/out nolabel/21
      rx pathid: 0, tx pathid: 0x0

BGP routing table entry for 22:22:10.0.0.0/24, version 55   22:22 RD for VRF B
Paths: (1 available, best #1, table B)
  Not advertised to any peer
  Refresh Epoch 1
  Local
    1.1.1.1 (metric 3) from 1.1.1.1 (1.1.1.1)
      Origin incomplete, metric 0, localpref 100, valid, internal, best
      Extended Community: RT:22:22  OSPF DOMAIN ID:0x0005:0x000000020200
        OSPF RT:0.0.0.1:2:0 OSPF ROUTER ID:10.0.0.1:0
      mpls labels in/out nolabel/19
      rx pathid: 0, tx pathid: 0x0
R3#


Customer Connectivity.....

In VRF A..
R7..
R7#sh ip route


      5.0.0.0/32 is subnetted, 1 subnets
O IA     5.5.5.5 [110/3] via 12.0.0.3, 00:00:03, FastEthernet0/0  ^^^^^^^Prefix from R5

       10.0.0.0/24 is subnetted, 1 subnets
O IA     10.0.0.0 [110/2] via 12.0.0.3, 00:00:03, FastEthernet0/0  ^^^^^^^^6 Prefix from R5



R7#trace 5.5.5.5
Type escape sequence to abort.
Tracing the route to 5.5.5.5
VRF info: (vrf in name/id, vrf out name/id)
  1 12.0.0.3 216 msec 244 msec 360 msec
  2  *
    172.16.0.2 [MPLS: Labels 17/27 Exp 0] 664 msec 524 msec
  3 10.0.0.1 [MPLS: Label 27 Exp 0] 692 msec 632 msec 1168 msec    R1
  4 10.0.0.5 728 msec 692 msec 400 msec                                               R5
R7#

R7#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!



In VRF B

R6#sh ip route


      4.0.0.0/32 is subnetted, 1 subnets
O IA     4.4.4.4 [110/3] via 11.0.0.3, 04:17:49, FastEthernet0/1
      10.0.0.0/24 is subnetted, 1 subnets
O IA     10.0.0.0 [110/2] via 11.0.0.3, 04:17:49, FastEthernet0/1


R6#ping 4.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 368/496/776 ms

R6#trace 4.4.4.4
Type escape sequence to abort.
Tracing the route to 4.4.4.4
VRF info: (vrf in name/id, vrf out name/id)
  1 11.0.0.3 124 msec 320 msec 240 msec
  2 172.16.0.2 [MPLS: Labels 17/25 Exp 0] 516 msec 576 msec 936 msec
  3 10.0.0.1 [MPLS: Label 25 Exp 0] 428 msec 600 msec 932 msec                 R1
  4 10.0.0.4 1076 msec 1196 msec 1104 msec                                                    R4
R6# 

********************************************************************************
                  MPLS cloud

R1#sh mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
16         16         3.3.3.3/32       0             Fa1/0      192.168.0.2

R2#sh mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
16         Pop Label  3.3.3.3/32       63273         Fa0/0      172.16.0.3
17         Pop Label  1.1.1.1/32       60741         Fa0/1      192.168.0.1
R2#

R3#sh mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
16         Pop Label  2.2.2.2/32       0             Fa0/0      172.16.0.2
17         Pop Label  192.168.0.0/24   0             Fa0/0      172.16.0.2
18         17         1.1.1.1/32       0             Fa0/0      172.16.0.2


We can see there is  no MPLS binding for customer route.