{"id":635,"date":"2018-10-26T22:52:29","date_gmt":"2018-10-26T22:52:29","guid":{"rendered":"http:\/\/feralpacket.org\/?p=635"},"modified":"2018-10-26T22:52:29","modified_gmt":"2018-10-26T22:52:29","slug":"multi-protocol-label-switching-mpls-notes","status":"publish","type":"post","link":"https:\/\/feralpacket.org\/?p=635","title":{"rendered":"Multi-protocol Label Switching (MPLS) Notes"},"content":{"rendered":"<p><span style=\"font-weight: bold;\">Multi-protocol Label Switching (MPLS)<\/span><\/p>\n<p>\nTraditional routing<\/p>\n<p>\n&#8211; Destination IP -&gt; Next hop\n<\/p>\n<p>\nMPLS<\/p>\n<p>\n&#8211; Labels -&gt; Next hop<\/p>\n<p>\n&#8211; No need to look to routing table\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/e3678e325030e3e45e2aaf4323f5f460.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/3583d198f6c43f270a4b8a30949b16d5.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/b02085b1a27ae57ed3504ca4da6b827c.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p>DLCI -&gt; Labels<\/p>\n<p><span style=\"font-weight: bold;\">MPLS Architecture<\/span><\/p>\n<p>\u00a0&#8211; Labels<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 32-bit value used for data propogation<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/3fc1516d064d9d6850d56cb819bdd12c.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p>Label number -&gt; 2^20<\/p>\n<p>Experimental bits<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; QoS<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 8 possible values<\/p>\n<p>Bottom of Stack<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 0 &#8211; More labels to follow<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 1 &#8211; Last label<\/p>\n<p>TTL<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Default is 255<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/e18d7201c8b9b90661d80cd5758db4d9.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p><span style=\"font-weight: bold;\">Terminology<\/span><\/p>\n<p>\u00a0&#8211; LSR<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Label Switching Router<\/p>\n<p>\u00a0&#8211; LSP<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Label Switched Path<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; The path a\u00a0labeled\u00a0packet takes to reach destination<\/p>\n<p><span style=\"font-weight: bold;\">Label Switching Protocols<\/span><\/p>\n<p>\u00a0&#8211; TDP<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Tag Distribution Protocol<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Cisco Proprietary<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Deprecated<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Appears in the Troubleshooting section of the R&amp;S lab<\/p>\n<p>\u00a0&#8211; LDP<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Label Distribution Protocol<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Open standard<\/p>\n<p><span style=\"font-weight: bold;\">Forward Equivalency Class (FEC)<\/span><\/p>\n<p>\u00a0&#8211; A group of packets which receive similar treatment in terms of data forwarding<\/p>\n<p><span style=\"font-weight: bold;\">Label Distribution Protocol<\/span><\/p>\n<p>\u00a0&#8211; Used for layer 2 purposes<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; To generate labels for all routes found in the routing table<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; Except for BGP routes<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Distribute labels to neighbors<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; The labels a route generates are used by LDP neighbors<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/a23289235cac9b5230655df5d320e3c1.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p>Label Forwarding Information Base (LFIB)<\/p>\n<p>\u00a0&#8211; Used by CEF<\/p>\n<p>\u00a0<\/p>\n<p>Frame header has a protocol type file<\/p>\n<p>\u00a0&#8211; Code for MPLS packet<\/p>\n<p>\u00a0&#8211; Code for IP packet<\/p>\n<p>Packet with label<\/p>\n<p>\u00a0&#8211; Check LFIB<\/p>\n<p>Packet without label<\/p>\n<p>\u00a0&#8211; Check FIB<\/p>\n<p>A label for every route is listed in the FIB<\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh ip cef<\/span><\/p>\n<p>\u00a0&#8211; Will show the labels if LDP is enable<\/p>\n<p>R1 -&gt; R2<\/p>\n<p>\u00a0&#8211; CEF lookup<\/p>\n<p>\u00a0&#8211; Push -&gt; Imposing a label<\/p>\n<p>R2 -&gt; R3<\/p>\n<p>\u00a0&#8211; LFIB -&gt; Label lookup<\/p>\n<p>\u00a0&#8211; Swap -&gt; Change label to next hop<\/p>\n<p>R3 -&gt; R4<\/p>\n<p>\u00a0&#8211; LFIB -&gt; Label lookup<\/p>\n<p>\u00a0&#8211; Swap -&gt; Change label to next hop<\/p>\n<p>R4 -&gt; Destination<\/p>\n<p>\u00a0&#8211; LFIB -&gt; Label lookup<\/p>\n<p>\u00a0&#8211; Pop -&gt; Remove the label<\/p>\n<p>\u00a0&#8211; CEF lookup<\/p>\n<p>The last hop router has to do two lookup<\/p>\n<p>\u00a0&#8211; To change to one lookup<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; R3 uses label &#8220;3&#8221; instead of 20<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; When R4 sees label &#8220;3&#8221;, it doesn&#8217;t do an LFIB looup<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; It Pops the label and goes straight to a CEF lookup<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; show command doesn&#8217;t show &#8220;3&#8221;, but &#8220;POP&#8221;<\/p>\n<p>Instructor comment, &#8220;MPLS requires the most structured teaching.&#8221;<\/p>\n<p>LDP uses UDP port 646 to find neighbors<\/p>\n<p>\u00a0&#8211; Discovery phase<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 224.0.0.2 (all routers) UDP port 646<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; After finding a potential neighbor, a TCP session is established on TCP port 646<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Hellos are sent every 5 seconds<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Hold down timer is 15 seconds<\/p>\n<p>\u00a0&#8211; TCP Session<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Once a TCP session is established<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; Keepalives are sent every 60 seconds<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; Hold down timer is 180 seconds<\/p>\n<p>\u00a0&#8211; After neighbor formation<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Labels are exchanged<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Kept in Label Information Base (LIB)<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; LIB contains all labels, but might not have the best path (route)<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; The best labels from the LIB are sent to the LFIB<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; The routing table is referenced to determine the exit interface<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/744a51e01bc602a4eeba05bb3e5e5a94.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/f37c2d09aab7b4a31b9fa06fad3e0d22.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/33c7824c30f751c219a98d5f21ccbdf2.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p>LIB<\/p>\n<p>\u00a0&#8211; Locally generated label for 23.0.0.0<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 20<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 12.0.0.3 &#8211; 3<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 23.0.0.3 &#8211; 3<\/p>\n<p>LFIB<\/p>\n<p>\u00a0in \u00a0| out \u00a0 \u00a0 next-hop<\/p>\n<p>\u00a020 | 3 \u00a0 \u00a0 \u00a0 \u00a0fa0\/0 -&gt; 12.0.0.2<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/13fc418e20e617d79643f5c4ae4b3bef.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p><span style=\"font-weight: bold;\">Configuration<\/span><\/p>\n<p>\u00a01. Activate CEF (activated by default)<\/p>\n<p>\u00a02. Activate MPLS<\/p>\n<p>\u00a03. Activate LDP<\/p>\n<p>\u00a04. Configure LDP on the interfaces where neighbors can be found<\/p>\n<p>R1(config)# <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">ip cef<\/span><\/p>\n<p>\u00a0<span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ip<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Enabled if an interface is configured<\/p>\n<p>\u00a0<span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls label protocol { ldp | tdp }<\/span><\/p>\n<p>\u00a0<span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">int s0\/0<\/span><\/p>\n<p>\u00a0 <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ip<\/span><\/p>\n<p>&#8220;Always check CEF&#8221;<\/p>\n<p>\u00a0 \u00a0 \u00a0 -&gt; During troubleshooting section of the R&amp;S lab<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/21cef1a2b80e644e625916edd336e47f.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p><span style=\"font-weight: bold;\">OSPF Autoconfig<\/span><\/p>\n<p>\u00a0&#8211; Configures MPLS on all interfaces configured for OSPF<\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">router ospf 1<\/span><\/p>\n<p>\u00a0<span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ldp autoconfig<\/span><\/p>\n<p>After MPLS and LDP is configured, LDP selects a router-id<\/p>\n<p>\u00a0&#8211; Manual<\/p>\n<p>\u00a0&#8211; Highest loopback IP address<\/p>\n<p>\u00a0&#8211; Highest physical interface IP address<\/p>\n<p>LDP starts sending &#8220;discovery hellos&#8221; to 224.0.0.2, UDP port 646<\/p>\n<p>\u00a0&#8211; Contains<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Router-id (LDP)<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Transport address<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; Used for TCP session<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; By default, the router-id is used<\/p>\n<p>Scenario -&gt; The loopbacks of R1 and R2 can not be advertised in IGP<\/p>\n<p>\u00a0<\/p>\n<p>Solution 1 -&gt; Change the LDP router-id to something reachable<\/p>\n<p>R1(config)# <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ldp router-id { &lt;interface&gt; | &lt;ip address&gt; } [force]<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Force is optional, but always use it<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; Without force, the LDP router-id will only change after the next reboot<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; Interface uses the IP address of the interface<\/p>\n<p>Solution 2 -&gt; Change the transport IP address<\/p>\n<p>\u00a0 \u00a0 \u00a0&#8211; Interface specific command<\/p>\n<p>R1(config)# <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">int s0\/0<\/span><\/p>\n<p>\u00a0<span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ldp discovery transport-address { &lt;interface&gt; | &lt;ip address&gt; }<\/span><\/p>\n<p>Discovery Timer<\/p>\n<p>R1(config)# <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ldp discovery hello { interval | hello } &lt;seconds&gt;<\/span><\/p>\n<p>TCP Keepalive Timer<\/p>\n<p>R1(config)# <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ldp holddown &lt;seconds&gt;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/feralpacket.org\/wp-content\/uploads\/2018\/10\/4dd5ae1a0e3462a657ed0abae1bcc419.jpeg\" style=\"\" width=\"600\" height=\"\"\/><\/p>\n<p>Label Numbers<\/p>\n<p>\u00a0&#8211; 2^20<\/p>\n<p>\u00a0&#8211; But in Cisco, only 0 &#8211; 100000 are used<\/p>\n<p>Reserved Labels<\/p>\n<p>\u00a0&#8211; 0 &#8211; 15<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 0 &#8211; explicit NULL<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; Used when you keep the experimental bit (Used for QoS)<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; Last router will have to do two lookups<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0-&gt; LFIB<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0-&gt; CEF<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; 3 &#8211; implicit NULL<\/p>\n<p>\u00a0<\/p>\n<p>To use explicit NULL (0)<\/p>\n<p>R1(config)# <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ldp explicit-null<\/span><\/p>\n<p>To change the label range<\/p>\n<p>R1(config)# <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls label range &lt;lower&gt; &lt;upper&gt;<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls label range<\/span><\/p>\n<p><span style=\"font-weight: bold;\">mpls ldp advertise-label<\/span><\/p>\n<p>\u00a0&#8211; LDP, by default, generates the labels for every route in the routing table and advertises them to neighbors<\/p>\n<p>\u00a0&#8211; This behavior can be changed to control which labels (routes) are advertised and to which neighbors they can be advertised<\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">no mpls ldp advertise-labels<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mlps ldp advertise-labels for &lt;acl&gt; [to &lt;peer acl&gt;]<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; for &lt;acl&gt;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; For which routes labels are to be advertised<\/p>\n<p>\u00a0 \u00a0 \u00a0-&gt; to &lt;peer acl&gt;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -&gt; To which neighbors labels will be advertised<\/p>\n<p>Scenario -&gt; On R1 and R2, advertise labels only for loopbacks.<\/p>\n<p>R1(config)# <span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">access-list 1 permit 1.1.1.1<\/span><\/p>\n<p>\u00a0<span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">access-list 1 permit 2.2.2.2<\/span><\/p>\n<p>\u00a0<span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">no mpls ldp advertise-labels<\/span><\/p>\n<p>\u00a0<span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">mpls ldp advertise-labels for 1<\/span><\/p>\n<p>The ACL must list all &#8220;routes&#8221; to be advertised<\/p>\n<p>Instructor comment, &#8220;LDP is a huge topic. \u00a0I highly recommend reading a book on LDP.&#8221;<\/p>\n<p><span style=\"font-weight: bold;\">Verification:<\/span><\/p>\n<p><span style=\"font-weight: bold;\">IOS:<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls int<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls ldp nei<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls forwarding-table<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls int vrf ABC<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls ldp nei vrf ABC<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls forwarding-table vrf ABC<\/span><\/p>\n<p><span style=\"font-weight: bold;\">XR:<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls int<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls ldp nei<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls forwarding<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 250, 165);-evernote-highlight:true;\">sh mpls forwarding vrf ABC<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Multi-protocol Label Switching (MPLS)<\/p>\n","protected":false},"author":1,"featured_media":623,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[32,31],"class_list":["post-635","post","type-post","status-publish","format-standard","hentry","category-ccie","tag-mpls","tag-published"],"_links":{"self":[{"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/posts\/635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=635"}],"version-history":[{"count":1,"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/posts\/635\/revisions"}],"predecessor-version":[{"id":708,"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/posts\/635\/revisions\/708"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=\/wp\/v2\/media\/623"}],"wp:attachment":[{"href":"https:\/\/feralpacket.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/feralpacket.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}