Tuesday, July 12, 2011

Step By Step MPLS – Basic MPLS Setup

 

image

Initial configuration , very basic with no MPLS, connectivity only to directly connected interfaces.

R1 R2 R3 R4

!
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 10.0.31.1 255.255.255.0
duplex auto
speed auto
!

!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 10.0.42.2 255.255.255.0
duplex auto
speed auto
!

!
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
no clns route-cache
!
interface FastEthernet0/0
ip address 10.0.31.3 255.255.255.0
duplex auto
speed auto
  no clns route-cache
!
interface Serial1/0
ip address 10.0.43.3 255.255.255.0
  serial restart-delay 0
no clns route-cache
!

!
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
no clns route-cache
!
interface FastEthernet0/0
ip address 10.0.42.4 255.255.255.0
duplex auto
speed auto
!
interface Serial1/0
ip address 10.0.43.4 255.255.255.0
  serial restart-delay 0
no clns route-cache
!

adding to the following configuration MPLS labels we will start with default label distribution protocol (on most new IOS’s LDP is the default) you can verify your IOS default 

R2(config)#mpls label protocol ?
  ldp  Use LDP (default)
  tdp  Use TDP

now I have enabled on R3 and R4 under all the interfaces MPLS label distribution after I have verified that both are using the LDP by default see example:

R4(config)#int f0/0
R4(config-if)#mp
R4(config-if)#mpls ip
R4(config-if)#int s1/0
R4(config-if)#mpls ip
R4(config-if)#exit
R4(config)#mpl
R4(config)#mpls ip
====================
R3(config)#mpls ip
R3(config)#int f0/0
R3(config-if)#mpls ip
R3(config-if)#int s1/0
R3(config-if)#mpls ip

And I would like to verify LDP has been established correctly

# I see interfaces are configured properly
R3#sh mpls interfaces
Interface              IP            Tunnel   BGP Static Operational
FastEthernet0/0        Yes (ldp)     No       No  No     Yes
Serial1/0              Yes (ldp)     No       No  No     Yes
# But No neighbor???!
R3#sh mpls ldp neighbor
# see below local LDP id and recived LDP id!!! I do not have a route!
R3#sh mpls ldp discovery
 Local LDP Identifier:
    3.3.3.3:0
    Discovery Sources:
    Interfaces:
        FastEthernet0/0 (ldp): xmit
        Serial1/0 (ldp): xmit/recv
            LDP Id: 4.4.4.4:0; no route
R3#
=============================================
#also I can do debug and see, notice below to the connection attempt to open
R4#debug mpls ldp transport events
00:25:43: ldp: Send ldp hello; Serial1/0, src/dst 10.0.43.4/224.0.0.2, inst_id 0
00:25:43: ldp: Rcvd ldp hello; Serial1/0, from 10.0.43.3 (3.3.3.3:0), intf_id 0, opt 0xC
00:25:43: ldp: ldp Hello from 10.0.43.3 (3.3.3.3:0) to 224.0.0.2, opt 0xC
00:25:43: ldp: local idb = Serial1/0, holdtime = 15000, peer 10.0.43.3 holdtime = 15000
00:25:43: ldp: Link intvl min cnt = 2, intvl = 5000, idb = Serial1/0
00:25:43: ldp: Opening ldp conn; adj 0x63D88708, 4.4.4.4 <-> 3.3.3.3
00:25:43: ldp: No route to peer 3.3.3.3; set LDP_CTX_HANDLE_ROUTEUP
=============================================
# as soon as I am setting up a ip route routers for the loopback interface
R4(config)#ip route 3.3.3.3 255.255.255.255 10.0.43.3
R3(config)#ip route 4.4.4.4 255.255.255.255 10.0.43.4
R3(config)#
00:56:41: tagcon: Assign peer id; 4.4.4.4:0: id 0
00:56:41: %LDP-5-NBRCHG: LDP Neighbor 4.4.4.4:0 is UP
00:56:41: tagcon: peer 4.4.4.4:0 (pp 0x63D6E478): advertise 10.0.31.3
00:56:41: tagcon: peer 4.4.4.4:0 (pp 0x63D6E478): advertise 10.0.43.3
00:56:41: tagcon: peer 4.4.4.4:0 (pp 0x63D6E478): advertise 3.3.3.3
00:56:41: tagcon: peer 4.4.4.4:0 (pp 0x63D6E478): advertise 3.3.3.3/32, label 3 (imp-null) (#2)
00:56:41: tagcon: peer 4.4.4.4:0 (pp 0x63D6E478): advertise 10.0.31.0/24, label 3 (imp-null) (#4)
00:56:41: tagcon: peer 4.4.4.4:0 (pp 0x63D6E478): advertise 10.0.43.0/24, label 3 (imp-null) (#6)
00:56:41: tagcon: peer 4.4.4.4:0 (pp 0x63D6E478): advertise 4.4.4.4/32, label 1000 (#8)
00:56:41: tagcon: Allocating address 10.0.42.4 advertised by LDP router-id 4.4.4.4
R3(config)#
00:56:41: tagcon: Allocating address 10.0.43.4 advertised by LDP router-id 4.4.4.4
00:56:41: tagcon: Allocating address 4.4.4.4 advertised by LDP router-id 4.4.4.4
R4(config)#^Z
R4#un all
00:56:40: %LDP-5-NBRCHG: LDP Neighbor 3.3.3.3:0 is UP
00:56:41: %SYS-5-CONFIG_I: Configured from console by console

 

Now notice as after the LDP has been established using multicast UDP a TCP session is created (similar to BGP) sourced from high port to TCP port 646

R4#sh mpls ldp neighbor
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 4.4.4.4:0
        TCP connection: 3.3.3.3.646 - 4.4.4.4.11586
        State: Oper; Msgs sent/rcvd: 10/10; Downstream
        Up time: 00:02:36
        LDP discovery sources:
          Serial1/0, Src IP addr: 10.0.43.3
        Addresses bound to peer LDP Ident:
          10.0.31.3       10.0.43.3       3.3.3.3

you can see above the TCP connection parameters, using the loopback interfaces from 4.4.4.4 to 3.3.3.3

next step to allow end to end connectivity and avoid to have and setup multiple static route statements, I have configured OSPF under all 4 routers:

!
router ospf 1
 router-id <loopbcak_ip>
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
!

And verified I have end to end connectivity:

R2#ping 1.1.1.1 source lo0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/44/56 ms
R2#

Now you ask where is the MPLS here, you have done a simple OSPF setup and that is true, basic MPLS such as that have no benefit, however that is the basic, I do not want to show the complex before we all understand the first step.

So here is my LFIB label forwarding information base:

R2#sh mpls forwarding-table
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
17     1002        10.0.31.0/24      0          Fa0/0      10.0.42.4
18     1003        1.1.1.1/32        0          Fa0/0      10.0.42.4
19     1000        3.3.3.3/32        0          Fa0/0      10.0.42.4
20     Pop tag     4.4.4.4/32        0          Fa0/0      10.0.42.4
21     Pop tag     10.0.43.0/24      0          Fa0/0      10.0.42.4

 

each router is building such a table according to the LDP information received and sent.
What is the information you see? Local tag this are the local generated tags used to generate downstream away from the destination, the outgoing tag is used for the upstream labeling to the destination, you cab also see how much bytes of label switching was done, very informative.

Note: I normally like to modify the range of labeling just to sort the table for my self see below.

R4(config)#mpls label range 1000 2000

the default is:

R2#sh mpls label range
Downstream Generic label region: Min/Max label: 16/100000

last issue, you saw from above that the byte counter on R2 is 0 but you remember I did a connectivity check end to end from R2 to R1, so why did it not show as increased?! PHP (not the programming language) penultimate hop popping a long name for short task.

R4#sh mpls forwarding-table
Local  Outgoing      Prefix            Bytes Label   Outgoing   Next Hop
Label  Label or VC   or Tunnel Id      Switched      interface
1000   Pop Label     3.3.3.3/32        0             Se1/0      point2point
1001   Pop Label     2.2.2.2/32        1140          Fa0/0      10.0.42.2
1002   Pop Label     10.0.31.0/24      0             Se1/0      point2point
1003   1001          1.1.1.1/32        1080          Se1/0      point2point
R4#

when I sent ping from 2.2.2.2 to 1.1.1.1 R2 pushed label 1003 to the echo request R4 received 1003 and swap with 1001

R3#sh mpls forwarding-table
Local  Outgoing      Prefix            Bytes Label   Outgoing   Next Hop
Label  Label or VC   or Tunnel Id      Switched      interface
1000   Pop Label     4.4.4.4/32        0             Se1/0      point2point
1001   Pop Label     1.1.1.1/32        1140          Fa0/0      10.0.31.1
1002   Pop Label     10.0.42.0/24      0             Se1/0      point2point
1003   1001          2.2.2.2/32        1080          Se1/0      point2point

R3 received 1001 POP the label and sent to R1

R1#sh mpls forwarding-table
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
16     1003        2.2.2.2/32        0          Fa0/0      10.0.31.3
17     Pop tag     3.3.3.3/32        0          Fa0/0      10.0.31.3
18     Pop tag     10.0.43.0/24      0          Fa0/0      10.0.31.3
19     1000        4.4.4.4/32        0          Fa0/0      10.0.31.3
20     1002        10.0.42.0/24      0          Fa0/0      10.0.31.3
as you can see R1 byte counters are also clean. R1 received normal ip with icmp echo request, replaying with echo replay now pushing 1003 and R3 swapping 1003 to 1001 and finally R4 popping 1001 sending normal echo replay to R2 
R2#ping 1.1.1.1 source lo0 repeat 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 64/64/64 ms
R2#
R4#
01:46:35: MPLS turbo: Fa0/0: rx: Len 118 Stack {1003 0 255} - ipv4 data
01:46:35: MPLS turbo: Se1/0: tx: Len 108 Stack {1001 0 254} - ipv4 data
01:46:35: MPLS turbo: Se1/0: rx: Len 108 Stack {1001 0 254} - ipv4 data
R4#
R3#
01:46:35: MPLS turbo: Se1/0: rx: Len 108 Stack {1001 0 254} - ipv4 data
01:46:35: MPLS turbo: Fa0/0: rx: Len 118 Stack {1003 0 255} - ipv4 data
01:46:35: MPLS turbo: Se1/0: tx: Len 108 Stack {1001 0 254} - ipv4 data
R3#
R1#deb ip pack de
*Mar  1 01:39:04.799: IP: s=2.2.2.2 (FastEthernet0/0), d=1.1.1.1, len 100, rcvd 4
*Mar  1 01:39:04.803:     ICMP type=8, code=0
*Mar  1 01:39:04.803: ICMP: echo reply sent, src 1.1.1.1, dst 2.2.2.2
*Mar  1 01:39:04.803: IP: tableid=0, s=1.1.1.1 (local), d=2.2.2.2 (FastEthernet0/0), routed via FIB
*Mar  1 01:39:04.803: IP: s=1.1.1.1 (local), d=2.2.2.2 (FastEthernet0/0), len 100, sending
*Mar  1 01:39:04.803:     ICMP type=0, code=0

 

I hope that was helpful, I would like you to try it for your self so again here is my basic GNS setup:

autostart = False
[127.0.0.1:7200]
    workingdir = C:\Users\shiran\AppData\Local\Temp
    udp = 10000
    [[3640]]
        image = E:\ Root\SOFTWARE\CISCO\c3640-jk9o3s-mz.124-16.bin
        idlepc = 0x605ac320
        ghostios = True
        chassis = 3640
    [[ROUTER R1]]
        model = 3640
        console = 2000
        aux = 2100
        cnfg = R1.cfg
        slot0 = NM-1FE-TX
        f0/0 = R3 f0/0
        x = -533.0
        y = -198.0
    [[ROUTER R2]]
        model = 3640
        console = 2001
        aux = 2101
        cnfg = R2.cfg
        slot0 = NM-1FE-TX
        f0/0 = R4 f0/0
        x = 227.0
        y = -202.0
[127.0.0.1:7201]
    workingdir = C:\Users\shiran\AppData\Local\Temp
    udp = 10100
    [[7200]]
        image = E:\ Root\SOFTWARE\CISCO\c7200-k91p-mz.122-25.S15.bin
        idlepc = 0x608ca290
        ghostios = True
    [[ROUTER R4]]
        console = 2004
        cnfg = C:\Program Files (x86)\GNS3\R4.cfg
        slot0 = C7200-IO-2FE
        f0/0 = R2 f0/0
        slot1 = PA-4T+
        s1/0 = R3 s1/0
        x = -31.0
        y = -87.0
    [[ROUTER R3]]
        console = 2003
        cnfg = C:\Program Files (x86)\GNS3\R3.cfg
        slot0 = C7200-IO-2FE
        f0/0 = R1 f0/0
        slot1 = PA-4T+
        s1/0 = R4 s1/0
        x = -271.0
        y = -87.0
[GNS3-DATA]
    configs = C:\Program Files (x86)\GNS3
    [[NOTE 1]]
        text = s1/0
        x = -6.86874660092
        y = 25.2377529973
        interface = R4 s1/0
    [[NOTE 2]]
        text = f0/0
        x = 69.5349221487
        y = 5.71505408099
        interface = R4 f0/0
    [[NOTE 3]]
        text = s1/0
        x = 72.8687466009
        y = 18.7622470027
        interface = R3 s1/0
    [[NOTE 4]]
        text = f0/0
        x = -3.83092469005
        y = 6.39605862368
        interface = R3 f0/0
    [[NOTE 5]]
        text = f0/0
        x = -6.99933176856
        y = 21.7687899898
        interface = R2 f0/0
    [[NOTE 6]]
        text = f0/0
        x = 72.9993317686
        y = 22.2312100102
        interface = R1 f0/0

3 comments:

the net works said...

Hello thx for the step by step setup

I don't see where have you issue the command mpls ip on R2 interface
and according to the output R2 as a mpls forwarding-table

cciep3 said...

You are correct, I didn't show you explicitly that I have entered the mpls ip, I apologize if that was confusing however I did enable MPLS on all 4 routers as my goal was to show you
1) LDP neighbor relationship
2) LDP POP/PUSH/SWAP and PHP

Next time I will probably be more explicit, so thank you :-)

weznagwama said...

Thanks for your analysis and easy-to-understand breakdown.