{"id":1023,"date":"2022-08-07T17:02:46","date_gmt":"2022-08-07T16:02:46","guid":{"rendered":"https:\/\/www.labtinker.net\/?p=1023"},"modified":"2022-08-07T17:02:46","modified_gmt":"2022-08-07T16:02:46","slug":"mpls-and-mp-bgp","status":"publish","type":"post","link":"http:\/\/18.135.13.153\/?p=1023","title":{"rendered":"MPLS and MP-BGP"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">To me MPLS has always been a cloud on a network diagram that was someone else&#8217;s problem. But I decided to lab it up and see how it worked. Happily, I found someone who had described how to set up the lab to do just this:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/packetlife.net\/blog\/2011\/may\/16\/creating-mpls-vpn\/\">https:\/\/packetlife.net\/blog\/2011\/may\/16\/creating-mpls-vpn\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The rest of the post assumes you have read this link but I will repeat or emphasise relevant aspects of it. Firstly, kudos to Jeremy Stretch for creating this lab. Having set up the lab,  I determined to try and work out in more detail exactly how a packet got from one end of the toplogy to the other.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you haven&#8217;t read the link above (and I urge you to as this post will only make limited sense without it): MPLS is a protocol which inserts a label into a packet and particpating devices use said label to forward said packet rather than an ip address. The MP is for Multi-Protocol so it doesn&#8217;t have to be IP. The lab above recreates how it can be used in conjunction with MP-BGP to forward traffic for different customers across a WAN whilst keeping that traffic separate (to the extent that different customers can use the same prefixes on their networks without interfering with each other. For different customers, think different VRFs)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is the topology, indentical to the one outlined in the link above:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"394\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image.png\" alt=\"\" class=\"wp-image-1028\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image.png 602w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-300x196.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I set out to ping from CE1A to an interface on CE2A (routers that belong to the same Cusomer\/VRF) and work out how the packet got there. A word of warning, please do not consider my words authorative: it&#8217;s just my interpretation of what I believe is going on after consulting several sources. (If anyone wishes to comment please do so by email: I disabled comments as they were being filled with links to vape, CDB and erotic websites.)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s check the interfaces on both routers (I use an alias I&#8217;d defined so the command &#8216;sib = show ip int brief&#8217;)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"141\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-1.png\" alt=\"\" class=\"wp-image-1029\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-1.png 602w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-1-300x70.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"151\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-2.png\" alt=\"\" class=\"wp-image-1030\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-2.png 602w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-2-300x75.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So from CE1A, let&#8217;s use traceroute to tell us how to get to 172.16.2.1.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"157\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-3.png\" alt=\"\" class=\"wp-image-1031\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-3.png 473w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-3-300x100.png 300w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The first hop is to 10.0.1.1 and is using good old fashioned ip routing to PE1. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"530\" height=\"57\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-4.png\" alt=\"\" class=\"wp-image-1032\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-4.png 530w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-4-300x32.png 300w\" sizes=\"auto, (max-width: 530px) 100vw, 530px\" \/><figcaption class=\"wp-element-caption\">On PE1<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"123\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-5.png\" alt=\"\" class=\"wp-image-1033\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-5.png 602w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-5-300x61.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So from hereon we see from our traceroute that we are using labels to foward the traffic. Let&#8217;s see which labels are attached to which prefixes:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"528\" height=\"279\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-6.png\" alt=\"\" class=\"wp-image-1034\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-6.png 528w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-6-300x159.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We are interested in the prefix 172.16.2.1 and we immediately see the outgoing label for that is 21 which is what we saw in the traceroute: so far, so good. But the traceroute also had the label 19 in there as well &#8211; where did that that come from? Well, before we answer that, let&#8217;s consider where we learnt about 172.16.2.1. The &#8216;V&#8217; in brackets tells us &#8211; this stands for VPN &#8211; the prefix was learnt over a VPN that exists between  PE1 and PE2. So let&#8217;s get more information on this VPN:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"591\" height=\"273\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-7.png\" alt=\"\" class=\"wp-image-1036\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-7.png 591w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-7-300x139.png 300w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now we see 172.16.2.1. has a next hop of 10.0.0.4 (the loopback address of the router which terminates the other end of the VPN. The VPN here is explained in the link above). If you refer back to the MPLS forward table you&#8217;ll see the label for the prefix 10.0.0.4 is 19. So it seems to make sense that that label gets inserted into our packet to get it to PE2. Let&#8217;s capture the traffic between PE1 and P1<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"231\" height=\"263\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-8.png\" alt=\"\" class=\"wp-image-1037\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To those unfamiliar with GNS3,  a magnifying glass denotes a Wireshark capture. And the MPLS label from this capture reaffirms what was seen in our traceroute output and what I discerned above.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"183\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-9.png\" alt=\"\" class=\"wp-image-1038\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-9.png 602w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-9-300x91.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So now the packet arrives at P1. This is using MPLS and its forwarding table is as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"548\" height=\"129\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-10.png\" alt=\"\" class=\"wp-image-1040\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-10.png 548w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-10-300x71.png 300w\" sizes=\"auto, (max-width: 548px) 100vw, 548px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So P1 reads the label 19 (incoming) and replaces this with the label 16 (outgoing) and sends it out of gi0\/0. Let&#8217;s have a look&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"384\" height=\"122\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-11.png\" alt=\"\" class=\"wp-image-1041\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-11.png 384w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-11-300x95.png 300w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"41\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-12.png\" alt=\"\" class=\"wp-image-1042\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-12.png 602w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-12-300x20.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Notice, it hasn&#8217;t touched the other label. So now let&#8217;s take a look at P2.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"546\" height=\"128\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-13.png\" alt=\"\" class=\"wp-image-1043\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-13.png 546w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-13-300x70.png 300w\" sizes=\"auto, (max-width: 546px) 100vw, 546px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For the incoming label of 16, we&#8217;re going to pop (remove) the label. How does P1 know to pop the label if it&#8217;s not bottom of stack? I have not read this explicitly but my surmise is that the router &#8216;recognises&#8217; that address as belonging to its LDP neighbour so that the label to get the packet to 10.0.0.4 will be redundant or irrelevant to the next router so there&#8217;s no point sending it. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"566\" height=\"334\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-14.png\" alt=\"\" class=\"wp-image-1044\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-14.png 566w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-14-300x177.png 300w\" sizes=\"auto, (max-width: 566px) 100vw, 566px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This means the remaining label is 21.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Anyway, let&#8217;s have another look at the packet from PE2 to P2<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"197\" height=\"240\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-15.png\" alt=\"\" class=\"wp-image-1045\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"90\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-18.png\" alt=\"\" class=\"wp-image-1048\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-18.png 602w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-18-300x45.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;bottom of stack&#8217; flag tells the next router this label is the er.. the bottom of the label stack and if this is removed then the packet has to be fowarded using ipv4 (as the protocol we&#8217;re using with MPLS) . As we see on PE2 the MPLS forwarding table has removed the final label for 172.16.2.1<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"549\" height=\"147\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-17.png\" alt=\"\" class=\"wp-image-1047\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-17.png 549w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-17-300x80.png 300w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So let&#8217;s check the routing table for our VRF<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"270\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-20.png\" alt=\"\" class=\"wp-image-1053\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-20.png 580w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/image-20-300x140.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And there it is, the next hop is 10.0.2.2 which is CE2, the final destination.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below are the configurations of the the routers involved in the lab.<\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-43b10b68-b09a-4840-812d-d887c6508774\" href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/CE1A.txt\">CE1A<\/a><a href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/CE1A.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-43b10b68-b09a-4840-812d-d887c6508774\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-f7ee4203-76f9-48fd-b2a8-9a6ca22c73d4\" href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/CE1B.txt\">CE1B<\/a><a href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/CE1B.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-f7ee4203-76f9-48fd-b2a8-9a6ca22c73d4\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-d1876bc1-f4b9-4c9b-9c0e-60fb3f305c42\" href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/PE1.txt\">PE1<\/a><a href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/PE1.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-d1876bc1-f4b9-4c9b-9c0e-60fb3f305c42\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-b7560591-7307-4032-8062-63b98b8110b6\" href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/P1.txt\">P1<\/a><a href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/P1.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-b7560591-7307-4032-8062-63b98b8110b6\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-e7429f04-09a5-433d-a30d-01bde0ac88bf\" href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/P2.txt\">P2<\/a><a href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/P2.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-e7429f04-09a5-433d-a30d-01bde0ac88bf\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-df984684-6046-4820-ab00-2fdfb6ecd083\" href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/PE2.txt\">PE2<\/a><a href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/PE2.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-df984684-6046-4820-ab00-2fdfb6ecd083\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-dca47285-1c25-42b0-bfa0-821ba5e084d1\" href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/CE2A.txt\">CE2A<\/a><a href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/CE2A.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-dca47285-1c25-42b0-bfa0-821ba5e084d1\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-9ae54240-125c-4bb8-8046-b728b48d1527\" href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/CE2B.txt\">CE2B<\/a><a href=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/08\/CE2B.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-9ae54240-125c-4bb8-8046-b728b48d1527\">Download<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>To me MPLS has always been a cloud on a network diagram that was someone else&#8217;s problem. But I decided to lab it up and see how it worked. Happily, I found someone who had described how to set up the lab to do just this: https:\/\/packetlife.net\/blog\/2011\/may\/16\/creating-mpls-vpn\/ The rest of the post assumes you have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-1023","post","type-post","status-publish","format-standard","hentry","category-networking"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts\/1023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1023"}],"version-history":[{"count":0,"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts\/1023\/revisions"}],"wp:attachment":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1023"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}