Strony

Saturday, 17 August 2013

MPLS - Basics

Multiprotocol Label Switching (MPLS) - is packet forwarding technology which uses labels to make data forwarding decisions. Layer 3 header is analysed once - at the moment when  packet enters the MPLS domain.
Label is added betwen data link layer (Layer 2) header and network  layer (Layer 3) header (label is removed when packet leaves MPLS domain).
MPLS network consist of Label Switch Routers (LSR's). Router which add label to the packet is called edge LSR.
Routing tables of LSR's are computed with Interior Gateway Protocols (for example OSPF).
Label distribution protocol (LDP) is responsible for binding routes with labels and for advertising those informations. Bindings are checked against routing table - if the route learned by LDP matches the route present in the routing table (learned from IGP) entry is made in the LFIB (Label Forwarding Information Base). According to the information stored in the LFIB - data forwarding decisions are made.
Let's try to configure basic MPLS scenario.
This is network topology used in the example :
Configuration is based on Cisco devices (IOS).
Cisco Express Forwarding (CEF) must be enabled on the devices where MPLS will be configured (command ip cef).
All routers have addresses set on proper interfaces and OSPF runs between them (routing tables computed with interior gateway protocol - in this example OSPF). All devices are present in area 0.
On router  R2 (int Fa1/0), R3 (int Fa0/0 and Fa1/0) and R4 (int Fa0/0)  - MPLS will be launched.
To accomplish this - command mpls ip is added on the proper interfaces.
Added command on R2 :
!
interface FastEthernet1/0
mpls ip 

Added commands on R3 :
!
interface FastEthernet0/0
mpls ip
!
interface FastEthernet1/0
mpls ip

Added command on R4 :
!
interface FastEthernet1/0
mpls ip

There is no need to start LDP - it will run by default.
At this moment - MPLS is ready to operate.
Let's take a closer look at the data forwarding process.
The communication between loopback interface of R1 (192.168.1.1) and loopback interface of R5 will be analysed (192.168.5.5).

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

The ping from 192.168.1.1 to 192.168.5.5 was succesfull. Lets's check - how the labels were processed during this communication on LSR's (R2, R3, R4).
To check Label Forwarding Information Base - command show mpls forwarding-table is used (labels are set dynamically - so the output may vary after reload of the device/devices, there is also possibility to set labels statically - this will be described in other scenario).

Router  R2
R2#show mpls forwarding-table
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
16     16          192.168.5.5/32    0          Fa1/0      10.1.23.3
17     18          10.1.45.0/24      0          Fa1/0      10.1.23.3
18     Pop tag     10.1.34.0/24      0          Fa1/0      10.1.23.3
19     Untagged    192.168.1.1/32    0          Fa0/0      10.1.12.1

R2 is the first LSR on the road - so after checking the Layer 3 address (destination 192.168.5.5/32) label 16 is added (for 10.1.45.0/24 network - MPLS label 18 would be set). Packet is sent to R3.


Packet sent from R2 to R3 - after adding Label

Router R3
R3#show mpls forwarding-table 192.168.5.5
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
16     19          192.168.5.5/32    1180       Fa1/0      10.1.34.4

On R3 MPLS label 16 is removed, and label 19 is set. Packet is sent to R4.

Packet sent from R3 to R4 - after changing the label

Router R4

R4#show mpls forwarding-table 192.168.5.5
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
19     Untagged    192.168.5.5/32    2850       Fa1/0      10.1.45.5

 On R4 MPLS label 19 is removed. Packet is sent to R5 (without MPLS label).
 
Packet sent from R4 to R5 - without label


After leaving the R2 router - all forwarding decisions were made by the information in the labels (no checking of the Layer 3 header).

Of course there is far more wisdom to gain in the area of MPLS - but journey need to be started somewhere :)

No comments:

Post a Comment