C.K.B.

Version 0.0.9

Czaku`s Knowladge Base

MPLS - Multi Protocol Label Switching

Multiprotocol label switching (MPLS) is a technique for speeding up network connections. MPLS can encapsulate packets of various network protocols, hence the multiprotocol component of the name. MPLS supports a range of access technologies, including T1/E1, ATM, Frame Relay, and DSL.

MPLS operates at a layer that is generally considered to lie between traditional definitions of OSI Layer 2 (data link layer) and Layer 3 (network layer), and thus is often referred to as a layer 2.5 protocol.

In an MPLS network, labels are assigned to data packets. Packet-forwarding decisions are made solely on the contents of this label, without the need to examine the packet itself. This allows one to create end-to-end circuits across any type of transport medium, using any protocol.

Topology:

c s r 1 c c s s i r r B 2 3 G P c s r 4 c s r 5

LDP establisment:

Ethernet II, Src: VMware_b0:64:f4 (00:50:56:b0:64:f4), Dst: IPv4mcast_02 (01:00:5e:00:00:02)
Internet Protocol Version 4, Src: 192.168.45.5, Dst: 224.0.0.2    <<< M-cast
User Datagram Protocol, Src Port: 646, Dst Port: 646   <<< UDP
Label Distribution Protocol
    Version: 1
    PDU Length: 30
    LSR ID: 100.64.0.5
    Label Space ID: 0
    Hello Message
        0... .... = U bit: Unknown bit not set
        Message Type: Hello Message (0x100)
        Message Length: 20
        Message ID: 0x00000000
        Common Hello Parameters
            00.. .... = TLV Unknown bits: Known TLV, do not Forward (0x0)
            TLV Type: Common Hello Parameters (0x400)
            TLV Length: 4
            Hold Time: 15
            0... .... .... .... = Targeted Hello: Link Hello
            .0.. .... .... .... = Hello Requested: Source does not request periodic hellos
            ..0. .... .... .... = GTSM Flag: Not set
            ...0 0000 0000 0000 = Reserved: 0x0000
        IPv4 Transport Address
            00.. .... = TLV Unknown bits: Known TLV, do not Forward (0x0)
            TLV Type: IPv4 Transport Address (0x401)
            TLV Length: 4
            IPv4 Transport Address: 100.64.0.5    <<< we provide out IP

Then we start TCP and LDP advertisement:

Ethernet II, Src: VMware_b0:07:01 (00:50:56:b0:07:01), Dst: VMware_b0:64:f4 (00:50:56:b0:64:f4)
Internet Protocol Version 4, Src: 100.64.0.4, Dst: 100.64.0.5
Transmission Control Protocol, Src Port: 646, Dst Port: 40057, Seq: 73, Ack: 534, Len: 459
Label Distribution Protocol
    Version: 1
    PDU Length: 455
    LSR ID: 100.64.0.4
    Label Space ID: 0
    Address Message
        0... .... = U bit: Unknown bit not set
        Message Type: Address Message (0x300)
        Message Length: 30
        Message ID: 0x000000b5
        Address List
            00.. .... = TLV Unknown bits: Known TLV, do not Forward (0x0)
            TLV Type: Address List (0x101)
            TLV Length: 22
            Address Family: IPv4 (1)
            Addresses
                Address 1: 192.168.24.4
                Address 2: 192.168.34.4
                Address 3: 192.168.45.4
                Address 4: 100.64.0.4
                Address 5: 172.32.0.4
    Label Mapping Message
        0... .... = U bit: Unknown bit not set
        Message Type: Label Mapping Message (0x400)
        Message Length: 24
        Message ID: 0x000000c0
        FEC
            00.. .... = TLV Unknown bits: Known TLV, do not Forward (0x0)
            TLV Type: FEC (0x100)
            TLV Length: 8
            FEC Elements
                FEC Element 1
                    FEC Element Type: Prefix FEC (2)
                    FEC Element Address Type: IPv4 (1)
                    FEC Element Length: 32
                    Prefix: 172.32.0.1   <<< IP and prefix
        Generic Label
            00.. .... = TLV Unknown bits: Known TLV, do not Forward (0x0)
            TLV Type: Generic Label (0x200)
            TLV Length: 4
            .... .... .... 0000 0000 0000 0001 0110 = Generic Label: 22 (0x00016)  <<< it is our local label

From the advertising router:

csr_4#show mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
...
22         22         172.32.0.1/32    1830          Gi2.24     192.168.24.2  <<< if something would come with label 22 we will swap it witha label 22 and send it out
           22         172.32.0.1/32    2360          Gi2.34     192.168.34.3

csr_4#show mpls ldp bindings 
  lib entry: 172.32.0.1/32, rev 22
	local binding:  label: 22
	remote binding: lsr: 100.64.0.3:0, label: 22
	remote binding: lsr: 100.64.0.2:0, label: 22
	remote binding: lsr: 100.64.0.5:0, label: 24           
csr_5#show mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
24         22         172.32.0.1/32    0             Gi2        192.168.45.4   <<< we will use 22 as outgoing label, if something would come to us with label 24 we would swap it to 22 and send it out


csr_5#show mpls ldp bindings 
  lib entry: 172.32.0.1/32, rev 22
	local binding:  label: 24
	remote binding: lsr: 100.64.0.4:0, label: 22

CEF:

csr_5#show ip cef 172.32.0.1
172.32.0.1/32
  nexthop 192.168.45.4 GigabitEthernet2 label 22-(local:24)

Traffic itself (on csr5):


Ethernet II, Src: VMware_b0:64:f4 (00:50:56:b0:64:f4), Dst: VMware_b0:07:01 (00:50:56:b0:07:01)
    Destination: VMware_b0:07:01 (00:50:56:b0:07:01)
    Source: VMware_b0:64:f4 (00:50:56:b0:64:f4)
    Type: MPLS label switched packet (0x8847)    <<< EtherType is 0x8847 - unicast MPLS
MultiProtocol Label Switching Header, Label: 22, Exp: 0, S: 1, TTL: 255 
    0000 0000 0000 0001 0110 .... .... .... = MPLS Label: 22 (0x00016)   <<< we used label 22>>
    .... .... .... .... .... 000. .... .... = MPLS Experimental Bits: 0
    .... .... .... .... .... ...1 .... .... = MPLS Bottom Of Label Stack: 1
    .... .... .... .... .... .... 1111 1111 = MPLS TTL: 255
Internet Protocol Version 4, Src: 172.32.0.5, Dst: 172.32.0.1
Internet Control Message Protocol

Additionally (iBGP): csr5:

csr_5#show ip route 
Gateway of last resort is not set
B        172.16.0.1 [200/0] via 172.32.0.1, 00:14:40


csr_5#show mpls forwarding-table 172.16.0.1
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
24         22         172.32.0.1/32    0             Gi2        192.168.45.4
None       22         172.16.0.1/32    0             Gi2        192.168.45.4 <<< not present we need be more specific


csr_5#show ip cef 172.16.0.1
172.16.0.1/32
  nexthop 192.168.45.4 GigabitEthernet2 label 22-(local:24) <<< we will use next hop label 22


csr_5#ping 172.16.0.1 source 172.16.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds:
Packet sent with a source address of 172.16.0.5 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

csr_5#traceroute 172.16.0.1 source 172.16.0.5                          
Type escape sequence to abort.
Tracing the route to 172.16.0.1
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.45.4 [MPLS: Label 22 Exp 0] 2 msec 1 msec 1 msec
  2  *  *  * <<< this router doesn't know where is 172.16.0.5
  3 192.168.123.1 2 msec 2 msec * 

csr_3#debug ip icmp 
ICMP packet debugging is on
csr_3#
*Jun 12 21:47:42.492: Adding 4 bytes of label stack
*Jun 12 21:47:42.492: MPLS: ICMP: time exceeded (time to live) sent to 172.16.0.5 (dest was 172.16.0.1) sent to src: 192.168.34.3 (origsrc: 192.168.34.3)intbl: 0 outtbl: 0 paktbl: 0 outif: 0x7FB26A6B0130   

csr4:

csr_4#show ip route 172.16.0.1
% Network not in table   <<< packet should be dropped 


csr_4#show mpls forwarding-table           
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
22         22         172.32.0.1/32    5661          Gi2.24     192.168.24.2    <<< but we use mpls switching 
           22         172.32.0.1/32    3036          Gi2.34     192.168.34.3

Download mpls.pcap

Last updated on 13 Jun 2024
Published on 13 Jun 2024
 Edit on GitHub