Configure MPLS (L3 IP VPN) - Prum Soriya

Hot

Post Top Ad

Friday, 14 June 2024

Configure MPLS (L3 IP VPN)

 



Step 1-Config IP address of MPLS Core and OSPF (R1, R2, R3)

    R1
        int lo0
            ip add 1.1.1.1 255.255.255.255
        int f0/0
            ip add 10.0.0.1 255.255.255.252
            no shu
        router ospf 1
            router-id 1.1.1.1
            net 1.1.1.1 0.0.0.0 area 0
            net 10.0.0.0 0.0.0.3 area 0

    R2
        int lo0
            ip add 2.2.2.2 255.255.255.255
        int f0/0
            ip add 10.0.0.2 255.255.255.252
            no shu
        int f0/1
            ip add 10.0.0.5 255.255.255.252
            no shu
        router ospf 1
            router-id 2.2.2.2
            net 2.2.2.2 0.0.0.0 area 0
            net 10.0.0.0 0.0.0.3 area 0
            net 10.0.0.4 0.0.0.3 area 0

    R3
        int lo0
            ip add 3.3.3.3 255.255.255.255
        int f0/0
            ip add 10.0.0.6 255.255.255.252
            no shu
        router ospf 1
            router-id 3.3.3.3
            net 3.3.3.3  0.0.0.0 area 0
            net 10.0.0.4 0.0.0.3 area 0

You should now have full ip connectivity between R1, R2, R3 to verify this we need to see if we can ping between the loopbacks of R1 and R3:
    R1#ping 3.3.3.3 source lo0
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
    Packet sent with a source address of 1.1.1.1
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max = 40/52/64 ms
    R1#

Step 2 – Configure LDP on all the interfaces in the MPLS Core
    In order to run MPLS you need to enable it, there are two ways to do this.
  •  At each interface enter the mpls ip command
  • Under the ospf process use the mpls ldp autoconfig command
    R1
        router ospf 1
            mpls ldp autoconfig

    R2
        router ospf 1
            mpls ldp autoconfig

    R3
        router ospf 1
            mpls ldp autoconfig

  To verify the mpls interfaces the command is very simple – sh mpls interface
  This is done on R2 and you can see that both interfaces are running mpls and using LDP

    R2#sh mpls interface
    Interface              IP            Tunnel   Operational
    FastEthernet0/0        Yes (ldp)     No       Yes
    FastEthernet0/1        Yes (ldp)     No       Yes

 You can also verify the LDP neighbors with the sh mpls ldp neighbors command.

    R2#sh mpls ldp neigh
    Peer LDP Ident: 1.1.1.1:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 1.1.1.1.646 - 2.2.2.2.37909
        State: Oper; Msgs sent/rcvd: 16/17; Downstream
        Up time: 00:07:46
        LDP discovery sources:
          FastEthernet0/0, Src IP addr: 10.0.0.1
        Addresses bound to peer LDP Ident:
          10.0.0.1        1.1.1.1
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 3.3.3.3.22155 - 2.2.2.2.646
        State: Oper; Msgs sent/rcvd: 12/11; Downstream
        Up time: 00:03:30
        LDP discovery sources:
          FastEthernet0/1, Src IP addr: 10.0.0.6
        Addresses bound to peer LDP Ident:
          10.0.0.6        3.3.3.3

One more verification to confirm LDP is running ok is to do a trace between R1 and R3 and verify if you get MPLS Labels show up in the trace.

    R1#trace 3.3.3.3
    Type escape sequence to abort.
    Tracing the route to 3.3.3.3
      1 10.0.0.2 [MPLS: Label 17 Exp 0] 84 msec 72 msec 44 msec
      2 10.0.0.6 68 msec 60 msec *

Step 3 – MPLS BGP Configuration between R1 and R3
    We need to establish a Multi Protocol BGP session between R1 and R3 this is done by configuring the vpnv4  address family as below

    R1

        router bgp 1
            neighbor 3.3.3.3 remote-as 1
            neighbor 3.3.3.3 update-source loopback0
            no auto-summary
            address-family vpnv4
            neighbor 3.3.3.3 activate

    R3

      router bgp 1
            neighbor 1.1.1.1 remote-as 1
            neighbor 1.1.1.1 update-source loopback0
            no auto-summary
            address-family vpnv4
            neighbor 1.1.1.1 activate

To verify the BGP session between R1 and R3 issue the command sh bgp vpnv4 unicast all summary

    R1#sh bgp vpnv4 unicast all summary
    BGP router identifier 1.1.1.1, local AS number 1
    BGP table version is 1, main routing table version 1

    Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
    3.3.3.3         4        1        218        218            1        0       0    03:17:48           0

Step 4 – Create VRFs

    R4

        int lo0
            ip add 4.4.4.4 255.255.255.255
        int f0/0
            ip add 10.0.0.10 255.255.255.252
            no shu
        router ospf 2
            router-id 4.4.4.4
            net 4.4.4.4 0.0.0.0 area 2
            net 10.0.0.8 0.0.0.3 area 2

    R1
        int f0/1
            ip add 10.0.0.9 255.255.255.252
            no shu
            exit
        ip vrf RED
            rd 4:4
            route-target both 4:4
            exit
        int f0/1
            ip vrf forwarding RED
        % Interface FastEthernet0/1 IP address 192.168.1.1 removed due to enabling VRF RED
        int f0/1
            ip add 10.0.0.9 255.255.255.252
            ip ospf 2 area 2
    R5

        int lo0
            ip add 5.5.5.5 255.255.255.255
        int f0/0
            ip add 10.0.0.14 255.255.255.252
            no shu
        router ospf 2
            router-id 5.5.5.5 
            net 5.5.5.5  0.0.0.0 area 2
            net 10.0.0.12 0.0.0.3 area 2

    R3

        int f0/1
            ip add 10.0.0.13 255.255.255.252
            no shu
            exit
        ip vrf RED
            rd 4:4
            route-target both 4:4
        int f0/1
            ip vrf forwarding RED
        % Interface FastEthernet0/1 IP address 192.168.1.1 removed due to enabling VRF RED
        int f0/1
            ip add 10.0.0.13 255.255.255.252
            ip ospf 2 area 2

Now if we view the config on R1 int f0/1 you can see the VRF configured.

    R1#sh run int f0/1
    Building configuration...
    Current configuration : 119 bytes
    !
    interface FastEthernet0/1
     ip vrf forwarding RED
     ip address 10.0.0.10 255.255.255.252
     duplex auto
     speed auto
     end

Now we can start to look int VRF’s and how they operate – you need to understand now that there are 2 routing tables within R1
  • The Global Routing Table
  • The Routing Table for VRF RED
If you issue the command sh ip route this shows the routes in the global table and you will notice that you do not see 10.0.0.8/32

    R1#sh ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
     D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
     N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
     E1 - OSPF external type 1, E2 - OSPF external type 2
     i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
     ia - IS-IS inter area, * - candidate default, U - per-user static route
     o - ODR, P - periodic downloaded static route

    Gateway of last resort is not set

    1.0.0.0/32 is subnetted, 1 subnets
    C 1.1.1.1 is directly connected, Loopback0
    2.0.0.0/32 is subnetted, 1 subnets
    O 2.2.2.2 [110/11] via 10.0.0.2, 01:03:48, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
    O 3.3.3.3 [110/21] via 10.0.0.2, 01:02:29, FastEthernet0/0
    10.0.0.0/24 is subnetted, 2 subnets
    C 10.0.0.0 is directly connected, FastEthernet0/0
    O 10.0.0.4 [110/20] via 10.0.0.2, 01:02:39, FastEthernet0/0

If you now issue the command sh ip route vrf RED – this will show the routes in the routing table for VRF RED

    R1#sh ip route vrf RED

    Routing Table: RED
     Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
     D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
     N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
     E1 - OSPF external type 1, E2 - OSPF external type 2
     i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
     ia - IS-IS inter area, * - candidate default, U - per-user static route
     o - ODR, P - periodic downloaded static route

    Gateway of last resort is not set

    4.0.0.0/32 is subnetted, 1 subnets
     O 4.4.4.4 [110/11] via 192.168.1.4, 00:00:22, FastEthernet0/1
     C 10.0.0.8/32 is directly connected, FastEthernet0/1

Check the routes on R4

    R4#sh ip route
    4.0.0.0/32 is subnetted, 1 subnets
    C 4.4.4.4 is directly connected, Loopback0
    C 192.168.1.0/24 is directly connected, FastEthernet0/0

Check the routes on R1

    R1#sh ip route 
    1.0.0.0/32 is subnetted, 1 subnets
    C 1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
    O 2.2.2.2 [110/11] via 10.0.0.2, 00:01:04, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
    O 3.3.3.3 [110/21] via 10.0.0.2, 00:00:54, FastEthernet0/0
     10.0.0.0/24 is subnetted, 2 subnets
    C 10.0.0.0 is directly connected, FastEthernet0/0
    O 10.0.1.0 [110/20] via 10.0.0.2, 00:00:54, FastEthernet0/0

    R1#sh ip route vrf RED
    Routing Table: RED
    4.0.0.0/32 is subnetted, 1 subnets
    O 4.4.4.4 [110/11] via 10.0.0.10, 00:02:32, FastEthernet0/1
    C 10.0.0.8/24 is directly connected, FastEthernet0/1

Redistribute OSPF into MP-BGP

  • The final step to get full connectivity across the MPLS core is to redistribute the routes in OSPF on R1 and R3 into MP-BGP and MP-BGP into OSPF
  • We need to redistribute the OSPF routes from R4 into BGP in the VRF on R1, the OSPF routes from R6 into MP-BGP in the VRF on R3 and then the routes in MP-BGP in R1 and R3 back out to OSPF
  •  Now, we need to do the following;
    • Redistribute OSPF into MP-BGP on R1
    • Redistribute MP-BGP into OSPF on R1
    • Redistribute OSPF into MP-BGP on R3
    • Redistribute MP-BGP into OSPF on R3
    R1
        router bgp 1
            address-family ipv4 vrf RED 
            redistribute ospf 2

    R3
        router bgp 1
            address-family ipv4 vrf RED 
            redistribute ospf 2

We can check the routes from R4 and R6 are now showing in the BGP table for their VRF with this command sh ip bgp vpnv4 vrf RED

    R1#sh ip bgp vpnv4 vrf RED
    BGP table version is 9, local router ID is 1.1.1.1
    Status codes: s suppressed, d damped, h history, * valid, > best, r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete
     Network Next Hop Metric LocPrf Weight Path
    Route Distinguisher: 4:4 (default for vrf RED)
    *> 4.4.4.4/32 192.168.1.4 11 32768 ?
    *>i5.5.5.5/32 3.3.3.3 11 100 0 ?
    *> 10.0.0.8 0.0.0.0 0 32768 ?
    *>i10.0.0.12 3.3.3.3 0 100 0 ?

We can check the routes from R4 and R6 are now showing in the BGP table for their VRF with this command sh ip bgp vpnv4 vrf RED

    R3#sh ip bgp vpnv4 vrf RED
    BGP table version is 9, local router ID is 3.3.3.3
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete
    Network Next Hop Metric LocPrf Weight Path
    Route Distinguisher: 4:4 (default for vrf RED)
    *>i4.4.4.4/32 1.1.1.1 11 100 0 ?
    *> 5.5.5.5/32 10.0.0.14 11 32768 ?
    *>i10.0.0.8 1.1.1.1 0 100 0 ?
    *> 10.0.0.12 0.0.0.0 0 32768 ?

The final step is to get the routes that have come across the MPLS back into OSPF and then we can get end to end connectivity

    R1
        router ospf 2 
            redistribute bgp 1 subnets 

    R3
        router ospf 2 
            redistribute bgp 1 subnets 

    R4#sh ip route 
    4.0.0.0/32 is subnetted, 1 subnets
    C 4.4.4.4 is directly connected, Loopback0
     6.0.0.0/32 is subnetted, 1 subnets
    O IA 6.6.6.6 [110/21] via 10.0.0.9, 00:01:31, FastEthernet0/0
    C 10.0.0.8/32 is directly connected, FastEthernet0/0
    O E2 10.0.0.12/32 [110/1] via 10.0.0.9, 00:01:31, FastEthernet0/0

    R6#sh ip route
    4.0.0.0/32 is subnetted, 1 subnets
    O IA 4.4.4.4 [110/21] via 10.0.0.13, 00:01:22, FastEthernet0/0
    6.0.0.0/32 is subnetted, 1 subnets
    C 6.6.6.6 is directly connected, Loopback0
    O IA 10.0.0.8/32 [110/11] via 10.0.0.13,00:01:22,FastEthernet0/0
    C 10.0.0.12/32 is directly connected, FastEthernet0/0

    R4#ping 6.6.6.6

    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max= 40/48/52ms

    R4#trace 6.6.6.6
    Type escape sequence to abort.
    Tracing the route to 6.6.6.6
    1 192.168.1.1 20 msec 8 msec 8 msec
    2 10.0.0.2 [MPLS: Labels 17/20 Exp 0] 36 msec 40 msec 36 msec
    3 192.168.2.1 [MPLS: Label 20 Exp 0] 16 msec 40 msec 16 msec
    4 192.168.2.6 44 msec 40 msec 56 msec

Source: R. Perkin. MPLS Configuration Example Step by Step. Available: https://www.rogerperkin.co.uk/ccie/mpls/cisco-mpls-tutorial/

No comments:

Post a Comment

ISP Network Design Research Project

Post Top Ad