MPLS Basic Topology

From IPFlow Netflow Collector

Basic MPLS Example

This is a simple example of MPLS basic configuration on Cisco routers (using Dynamips and GNS3).

Author: Christophe Fillot - 05-Nov-2007


Table of contents

Topology

Image:MPLS_Basic_topo.png


IOS configurations

  • A0 (http://www.ipflow.utc.fr/configs/MPLS_Basic/A0.cfg)
  • A1 (http://www.ipflow.utc.fr/configs/MPLS_Basic/A1.cfg)
  • B0 (http://www.ipflow.utc.fr/configs/MPLS_Basic/B0.cfg)
  • B1 (http://www.ipflow.utc.fr/configs/MPLS_Basic/B1.cfg)
  • C0 (http://www.ipflow.utc.fr/configs/MPLS_Basic/C0.cfg)
  • C1 (http://www.ipflow.utc.fr/configs/MPLS_Basic/C1.cfg)


Dynamips/Dynagen/GNS3 configuration

You can use this configuration file (http://www.ipflow.utc.fr/configs/MPLS_Basic/mpls_basic.net) directly with Dynagen or GNS3. Change the working directory and Cisco IOS image path to match your needs.


Enabling MPLS

  • Make sure you have full connectivity through your network ;
  • CEF (Cisco Express Forwarding) must be enabled ("ip cef" or "ip cef distributed") ;
  • Enable MPLS on your core interfaces with "mpls ip" (don't do this for interfaces facing customer equipments) ;


Checking LDP connectivity

The LDP protocol is used to exchange labels between routers. You can verify the MPLS adjacencies with "sh mpls ldp neighbor":

A1#sh mpls ldp nei
    Peer LDP Ident: 10.10.0.0:0; Local LDP Ident 10.10.0.1:0
        TCP connection: 10.10.0.0.646 - 10.10.0.1.34421
        State: Oper; Msgs sent/rcvd: 50/49; Downstream
        Up time: 00:30:52
        LDP discovery sources:
          FastEthernet0/0, Src IP addr: 10.1.1.1
        Addresses bound to peer LDP Ident:
          10.1.1.1        10.10.0.0       
    Peer LDP Ident: 10.20.0.0:0; Local LDP Ident 10.10.0.1:0
        TCP connection: 10.20.0.0.56148 - 10.10.0.1.646
        State: Oper; Msgs sent/rcvd: 46/49; Downstream
        Up time: 00:28:34
        LDP discovery sources:
          FastEthernet1/0, Src IP addr: 10.2.1.2
        Addresses bound to peer LDP Ident:
          10.2.1.2        10.20.0.0       10.2.2.1        
    Peer LDP Ident: 10.30.0.0:0; Local LDP Ident 10.10.0.1:0
        TCP connection: 10.30.0.0.17227 - 10.10.0.1.646
        State: Oper; Msgs sent/rcvd: 39/43; Downstream
        Up time: 00:22:57
        LDP discovery sources:
          FastEthernet2/0, Src IP addr: 10.3.1.2
        Addresses bound to peer LDP Ident:
          10.3.1.2        10.30.0.0       10.3.2.1        

Here we can see that A1 has three LDP adjacencies: A0, B0 and C0.


Displaying the LIB (Label Information Base)

When the LDP adjacencies are established, the routers build a Label Information Base, which can be displayed with "sh mpls ldp bindings".

We can see that for a given prefix, a router receives labels from all of its LDP neighbors.

A1#sh mpls ldp binding
  tib entry: 10.1.1.0/30, rev 4
        local binding:  tag: imp-null
        remote binding: tsr: 10.10.0.0:0, tag: imp-null
        remote binding: tsr: 10.20.0.0:0, tag: 18
        remote binding: tsr: 10.30.0.0:0, tag: 21
  tib entry: 10.2.1.0/30, rev 8
        local binding:  tag: imp-null
        remote binding: tsr: 10.10.0.0:0, tag: 17
        remote binding: tsr: 10.20.0.0:0, tag: imp-null
        remote binding: tsr: 10.30.0.0:0, tag: 20
  tib entry: 10.2.2.0/30, rev 14
        local binding:  tag: 18
        remote binding: tsr: 10.20.0.0:0, tag: imp-null
        remote binding: tsr: 10.10.0.0:0, tag: 20
        remote binding: tsr: 10.30.0.0:0, tag: 22
  tib entry: 10.3.1.0/30, rev 10
        local binding:  tag: imp-null
        remote binding: tsr: 10.10.0.0:0, tag: 18
        remote binding: tsr: 10.20.0.0:0, tag: 19
        remote binding: tsr: 10.30.0.0:0, tag: imp-null
  tib entry: 10.3.2.0/30, rev 20
        local binding:  tag: 21
        remote binding: tsr: 10.30.0.0:0, tag: imp-null
        remote binding: tsr: 10.10.0.0:0, tag: 23
        remote binding: tsr: 10.20.0.0:0, tag: 22
  tib entry: 10.10.0.0/32, rev 6
        local binding:  tag: 16
        remote binding: tsr: 10.10.0.0:0, tag: imp-null
        remote binding: tsr: 10.20.0.0:0, tag: 17
        remote binding: tsr: 10.30.0.0:0, tag: 19
  tib entry: 10.10.0.1/32, rev 2
        local binding:  tag: imp-null
        remote binding: tsr: 10.10.0.0:0, tag: 16
        remote binding: tsr: 10.20.0.0:0, tag: 16
        remote binding: tsr: 10.30.0.0:0, tag: 18
  tib entry: 10.20.0.0/32, rev 12
        local binding:  tag: 17
        remote binding: tsr: 10.20.0.0:0, tag: imp-null
        remote binding: tsr: 10.10.0.0:0, tag: 19
        remote binding: tsr: 10.30.0.0:0, tag: 17
  tib entry: 10.20.0.1/32, rev 16
        local binding:  tag: 19
        remote binding: tsr: 10.20.0.0:0, tag: 20
        remote binding: tsr: 10.10.0.0:0, tag: 21
        remote binding: tsr: 10.30.0.0:0, tag: 16
  tib entry: 10.30.0.0/32, rev 18
        local binding:  tag: 20
        remote binding: tsr: 10.30.0.0:0, tag: imp-null
        remote binding: tsr: 10.10.0.0:0, tag: 22
        remote binding: tsr: 10.20.0.0:0, tag: 21
  tib entry: 10.30.0.1/32, rev 22
        local binding:  tag: 22
        remote binding: tsr: 10.30.0.0:0, tag: 23
        remote binding: tsr: 10.20.0.0:0, tag: 23
        remote binding: tsr: 10.10.0.0:0, tag: 24


Displaying the LFIB (Label Forwarding Information Base)

We have seen previously that a router receives labels from its LDP neighbors for each given prefix. Then, it chooses the label to use with the help of the IGP (in this example, OSPF), so the shortest path can be selected.

The LFIB can be displayed with "sh mpls forwarding-table":

A1#sh mpls for
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface              
16     Pop tag     10.10.0.0/32      1914       Fa0/0      10.1.1.1     
17     Pop tag     10.20.0.0/32      0          Fa1/0      10.2.1.2     
18     Pop tag     10.2.2.0/30       1802       Fa1/0      10.2.1.2     
19     20          10.20.0.1/32      360        Fa1/0      10.2.1.2     
20     Pop tag     10.30.0.0/32      0          Fa2/0      10.3.1.2     
21     Pop tag     10.3.2.0/30       1232       Fa2/0      10.3.1.2     
22     23          10.30.0.1/32      360        Fa2/0      10.3.1.2     


Let's take an example:

Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface 
22     23          10.30.0.1/32      360        Fa2/0      10.3.1.2
  • 22 is the local label. The router announces to its LDP neighbors that it will use label 22 as input label to reach prefix 10.30.0.1/32 ;
  • 23 is the outgoing label. The router will use output label 23 to reach prefix 10.30.0.1/32 ;
  • Fa2/0 is the output interface, and 10.3.1.2 (corresponding to C1) is the next hop (see output of "show ip route 10.30.0.1") ;
  • Here, when the router receives a packet with label 22, it swaps the label and replace it with label 23 ;
  • When the Outgoing tag is "Pop tag", the router removes the first label in the stack.


Useful commands for troubleshooting

IP route information:

A1#sh ip ro 10.30.0.1
Routing entry for 10.30.0.1/32
  Known via "ospf 100", distance 110, metric 66, type intra area
  Last update from 10.3.1.2 on FastEthernet2/0, 00:47:48 ago
  Routing Descriptor Blocks:
  * 10.3.1.2, from 10.30.0.1, 00:47:48 ago, via FastEthernet2/0
      Route metric is 66, traffic share count is 1


CEF information:

A1#sh ip cef 10.30.0.1
10.30.0.1/32, version 29, epoch 0, cached adjacency 10.3.1.2
0 packets, 0 bytes
  tag information set
    local tag: 22
    fast tag rewrite with Fa2/0, 10.3.1.2, tags imposed: {23}
  via 10.3.1.2, FastEthernet2/0, 0 dependencies
    next hop 10.3.1.2, FastEthernet2/0
    valid cached adjacency
    tag rewrite with Fa2/0, 10.3.1.2, tags imposed: {23}


Detailed information for the label entry:

A1#sh mpls forwarding-table label 22       
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface              
22     23          10.30.0.1/32      360        Fa2/0      10.3.1.2     
A1#sh mpls forwarding-table label 22 detail
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface              
22     23          10.30.0.1/32      360        Fa2/0      10.3.1.2     
        MAC/Encaps=14/18, MRU=1500, Tag Stack{23}
        CA040A5B0000CA020A5A00388847 00017000
        No output feature configured
    Per-packet load-sharing


Traceroute with MPLS labels

The traceroute commands can display the labels used between routers:

A0#traceroute 10.30.0.1

Type escape sequence to abort.
Tracing the route to 10.30.0.1

  1 10.1.1.2 [MPLS: Label 22 Exp 0] 76 msec 80 msec 48 msec
  2 10.3.1.2 [MPLS: Label 23 Exp 0] 44 msec 52 msec 44 msec
  3 10.3.2.2 48 msec *  72 msec