Sunday, November 11, 2012

Juniper LDP Signaled LSP

LDP Signaled LSP
R1 Configuration
protocols {
    mpls {
        interface all;
    }
    bgp {
        group ibgp {
            type internal;
            local-address 1.1.1.1;
            neighbor 2.2.2.2;
            neighbor 3.3.3.3;
            neighbor 4.4.4.4;
        }
    }
    ospf {
        area 0.0.0.1 {
            stub;
            interface em1.12;
            interface em1.13;
            interface lo0.1 {
                passive;               
            }
        }
    }
    ldp {
        interface all;
    }
}
routing-options {
    autonomous-system 100;
}


Verifying OSPF Routes and Database
root@Olive# run show ospf database logical-system r1

    OSPF database, Area 0.0.0.1
 Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len
Router  *1.1.1.1          1.1.1.1          0x8000000c   432  0x20 0x67b7  60
Router   2.2.2.2          2.2.2.2          0x80000007   438  0x20 0x5cd2  36
Router   3.3.3.3          3.3.3.3          0x80000007   434  0x20 0x3ee4  36
Network  192.168.12.2     2.2.2.2          0x80000003   438  0x20 0xa905  32
Network  192.168.13.3     3.3.3.3          0x80000003   434  0x20 0x980c  32
Summary  0.0.0.0          2.2.2.2          0x80000001   530  0x20 0xcf5d  28
Summary  0.0.0.0          3.3.3.3          0x80000001   534  0x20 0xb177  28
Summary  2.2.2.2          2.2.2.2          0x80000002   106  0x20 0xd21   28
Summary  2.2.2.2          3.3.3.3          0x80000003   433  0x20 0xf631  28
Summary  3.3.3.3          2.2.2.2          0x80000003   432  0x20 0xe641  28
Summary  3.3.3.3          3.3.3.3          0x80000003   118  0x20 0xbe66  28
Summary  4.4.4.4          2.2.2.2          0x80000002   432  0x20 0xba6a  28
Summary  4.4.4.4          3.3.3.3          0x80000002   433  0x20 0x9c84  28
Summary  192.168.23.0     2.2.2.2          0x80000008   438  0x20 0xb7f6  28
Summary  192.168.23.0     3.3.3.3          0x80000003   478  0x20 0xa30c  28
Summary  192.168.24.0     2.2.2.2          0x80000008   432  0x20 0xac01  28
Summary  192.168.24.0     3.3.3.3          0x80000003   433  0x20 0xa20b  28
Summary  192.168.34.0     2.2.2.2          0x80000003   432  0x20 0x5255  28
Summary  192.168.34.0     3.3.3.3          0x80000006   433  0x20 0x247d  28
Summary  192.168.45.0     2.2.2.2          0x80000002   432  0x20 0xdac2  28
Summary  192.168.45.0     3.3.3.3          0x80000002   433  0x20 0xbcdc  28
Summary  192.168.46.0     2.2.2.2          0x80000002   432  0x20 0xcfcc  28
Summary  192.168.46.0     3.3.3.3          0x80000002   433  0x20 0xb1e6  28


root@Olive# run ping 4.4.4.4 logical-system r1 rapid
PING 4.4.4.4 (4.4.4.4): 56 data bytes
!!!!!
--- 4.4.4.4 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.968/1.201/1.576/0.232 ms


root@Olive# run show ldp interface logical-system r1 detail
Interface            Label space ID        Nbr count   Next hello
lo0.1                1.1.1.1:0                0           0
  Hello interval: 15, Hold time: 45, Transport address: 1.1.1.1
em1.12               1.1.1.1:0                1           3
  Hello interval: 5, Hold time: 15, Transport address: 1.1.1.1
em1.13               1.1.1.1:0                1           4
  Hello interval: 5, Hold time: 15, Transport address: 1.1.1.1

root@Olive# run show ldp neighbor logical-system r1 detail    
Address            Interface          Label space ID         Hold time
192.168.12.2       em1.12             2.2.2.2:0                13
  Transport address: 2.2.2.2, Configuration sequence: 1
  Up for 00:10:20
192.168.13.3       em1.13             3.3.3.3:0                11
  Transport address: 3.3.3.3, Configuration sequence: 1
  Up for 00:10:20


Default ldp hello-interval 5s, hold time 15s, MPLS Router use loopback interfaces for LDP establish.
LDP protocol priority is 9, if the network use IGP and LDP together, because the LDP priority is
lower than any priority other IGP protocol [9], So it will select LDP routing protocol,
but the LDP is inseparable from the IGP path, that is why the LDP and IGP path is same.

See LDP routing table
root@Olive# run show route table inet.3 logical-system r1        

inet.3: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

2.2.2.2/32         *[LDP/9] 00:13:39, metric 1
                    > to 192.168.12.2 via em1.12
3.3.3.3/32         *[LDP/9] 00:13:35, metric 1
                    > to 192.168.13.3 via em1.13
4.4.4.4/32         *[LDP/9] 00:13:35, metric 1
                      to 192.168.12.2 via em1.12, Push 299808
                    > to 192.168.13.3 via em1.13, Push 299792



To 2.2.2.2/32 use label POP, because r1-r2 is connected directly
To 4.4.4.4/32 use label PUSH, PUSH label 299808
When traffic reach R2 the label will be POP
root@Olive# run show route table mpls.0 logical-system r2 label 299792

mpls.0: 9 destinations, 9 routes (9 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

299792             *[LDP/9] 00:16:00, metric 1
                    > to 192.168.12.1 via em2.12, Pop     
299792(S=0)        *[LDP/9] 00:16:00, metric 1
                    > to 192.168.12.1 via em2.12, Pop


root@Olive# run show route table mpls.0 logical-system r2 label 299808   

mpls.0: 9 destinations, 9 routes (9 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

299808             *[LDP/9] 00:16:46, metric 1
                    > to 192.168.24.4 via em2.24, Pop     
299808(S=0)        *[LDP/9] 00:16:46, metric 1
                    > to 192.168.24.4 via em2.24, Pop


LDP routing table only has other router’s loopback interface /32 route.
It use for reach the bgp protocol next-hop

Traceroute BGP Route,It's use LDP path or not
root@Olive# run traceroute 5.5.5.5 logical-system r1
traceroute to 5.5.5.5 (5.5.5.5), 30 hops max, 40 byte packets
1 192.168.12.2 (192.168.12.2) 0.951 ms 0.518 ms 0.355 ms
2 192.168.24.4 (192.168.24.4) 0.750 ms 0.886 ms 0.924 ms
3 5.5.5.5 (5.5.5.5) 1.334 ms 1.974 ms 2.987 ms
 

Strange, its not using LDP path, but directly through IGP path.
The reason is R1 learn bgp route 5.5.5.5/32’s next-hop is R5
root@Olive# run show route 5.5.5.5 extensive logical-system r1
inet.0: 18 destinations, 18 routes (18 active, 0 holddown, 0 hidden)
5.5.5.5/32 (1 entry, 1 announced)
TSI:
KRT in-kernel 5.5.5.5/32 -> {indirect(131077)}
*BGP Preference: 170/-101
Next hop type: Indirect
Next-hop reference count: 3
Source: 4.4.4.4
Next hop type: Router, Next hop index: 131073
Next hop: 192.168.12.2 via em1.12, selected
Next hop: 192.168.13.3 via em1.13
Protocol next hop: 192.168.45.5
Indirect next hop: 8d4b0a8 131077
State:


Use next-hop self policy in R4, when R4 export route to IBGP Peers
root@Olive# show r4 policy-options policy-statement nhs
term 1 {
    from {
        protocol bgp;
        neighbor [ 192.168.45.5 192.168.46.6 ];
    }
    then {
        next-hop self;
    }
}

root@Olive# show r4 protocols bgp group ibgp
type internal;
local-address 4.4.4.4;
export nhs;
neighbor 1.1.1.1;
neighbor 2.2.2.2;
neighbor 3.3.3.3;


check route table
root@Olive# run show route 5.5.5.5/32 logical-system r1

inet.0: 18 destinations, 18 routes (18 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

5.5.5.5/32         *[BGP/170] 00:20:59, localpref 100, from 4.4.4.4
                      AS path: 200 I
                    > to 192.168.12.2 via em1.12, Push 299808
                      to 192.168.13.3 via em1.13, Push 299792
 

Now the route has MPLS label
root@Olive# run traceroute 5.5.5.5 logical-system r1
traceroute to 5.5.5.5 (5.5.5.5), 30 hops max, 40 byte packets
 1  192.168.12.2 (192.168.12.2)  1.452 ms  0.889 ms  1.188 ms
     MPLS Label=299808 CoS=0 TTL=1 S=1
 2  192.168.24.4 (192.168.24.4)  0.972 ms  1.111 ms  1.105 ms
 3  5.5.5.5 (5.5.5.5)  1.545 ms  1.425 ms  1.580 ms