{"id":2980,"date":"2021-02-01T16:26:56","date_gmt":"2021-02-02T00:26:56","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=2980"},"modified":"2021-02-01T16:26:57","modified_gmt":"2021-02-02T00:26:57","slug":"what-are-route-distinguishers-and-route-targets","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=2980","title":{"rendered":"What are Route Distinguishers and Route Targets"},"content":{"rendered":"\n<p>People new to MPLS VPN are often unclear on what functions route distinguishers and route targets serve, and the difference between the two. Let&#8217;s see if we can clear up some of that confusion. If you could use a refresher on VRF fundamentals, I encourage you to first check out my earlier articles on the topic,\u00a0Intro to VRF Lite\u00a0and\u00a0Inter-VRF Routing with VRF Lite.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"route-distinguisher\">Route Distinguisher<\/h3>\n\n\n\n<p>As you know, VRFs allow IP address space to be reused among isolated routing domains. For example, assume you have to connect to three customer sites, all of which are using 192.168.0.0\/24 as their local network. We can assign each customer its own VRF so that the overlapping networks are kept isolated from one another in their respective routing domains.<\/p>\n\n\n\n<p>This works well, but we need a way to keep track of which 192.168.0.0\/24 route belongs to which customer. This is where route distinguishers come in. As its name implies, a route distinguisher (RD)&nbsp;<em>distinguishes<\/em>&nbsp;one set of routes (one VRF) from another. It is a unique number prepended to each route within a VRF to identify it as belonging to that particular VRF or customer. An RD is carried along with a route via MP-BGP when exchanging VPN routes with other PE routers.<\/p>\n\n\n\n<p>An RD is 64 bits in length comprising three fields: type (two bytes), administrator, and value. There are currently\u00a0three defined formats\u00a0which can be used by a provider:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/packetlife.net\/media\/blog\/attachments\/684\/RD_formats.png\" alt=\"RD_formats.png\"\/><\/figure>\n\n\n\n<p>The choice of format is largely cosmetic: It makes no difference to BGP as the RD is effectively just a flat number prepended to a route. The choice of formats exists solely to allow for flexible administration of the number space.<\/p>\n\n\n\n<p>Here&#8217;s an example IOS config showing RDs assigned to VRFs using the two-byte AS format. The type is implied by the format in which we&#8217;ve assigned the RD.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ip vrf Site_A\n rd 65000:10\n!\nip vrf Site_B\n rd 65000:20\n!\nip vrf Site_C\n rd 65000:30\n<\/pre>\n\n\n\n<p>When VPN routes are advertised among PE routers via MP-BGP, the RD is included as part of the route along with the IP prefix. For example, a route for 192.0.2.0\/24 in VRF Site_B is effectively advertised as 65000:20:192.0.2.0\/24 (ignoring some complexities concerning the actual prefix length).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"route-targets\">Route Targets<\/h2>\n\n\n\n<p>Whereas route distinguishers are used to maintain uniqueness among identical routes in different VRFs, route targets can be used to share routes among them. We can apply route targets to a VRF to control the import and export of routes among it and other VRFs.<\/p>\n\n\n\n<p>A route target takes the form of an extended BGP community with a structure similar to that of a route distinguisher (which is probably why the two are so easily confused). One or more route targets can be affixed to routes within a VRF using the VRF configuration command&nbsp;<code>route-target export<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ip vrf Customer_A\n rd 65000:100\n route-target export 65000:100\n<\/pre>\n\n\n\n<p>Routes contained within this VRF will be exported with an RT of 65000:100. We can use Wireshark to examine precisely how this information is carried in an MP-BGP update:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/packetlife.net\/media\/blog\/attachments\/686\/wireshark.png\" alt=\"wireshark.png\"\/><\/figure>\n\n\n\n<p>In practice, we typically want all instances of a VRF across the network to learn about all other routes within that VRF on neighboring routers. So, we add a second statement to enable importation as well:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ip vrf Customer_A\n rd 65000:100\n route-target export 65000:100\n <em>route-target import 65000:100<\/em>\n<\/pre>\n\n\n\n<p>(Tip: You can use the shortcut command&nbsp;<code>route-target both<\/code>&nbsp;as a macro to add both commands simultaneously. Both commands will show up separately in the running configuration.)<\/p>\n\n\n\n<p>Now, this VRF will export its own routes with an RT of 65000:100 as well as import any routes exported from other VRFs tagged with 65000:100. It makes sense to reuse the VRF&#8217;s RD as a route target here, but this isn&#8217;t a hard rule. (Remember, route targets are just numeric tags: We can use whatever values we want.)<\/p>\n\n\n\n<p>Next, let&#8217;s say both customers A and B need to import routes from a third VRF named Shared. We can configure the two customer VRFs to also import routes tagged with the Shared VRF&#8217;s export RT of 65000:300:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ip vrf Customer_A\n rd 65000:100\n route-target export 65000:100\n route-target import 65000:100\n <em>route-target import 65000:300<\/em>\n!\nip vrf Customer_B\n rd 65000:200\n route-target export 65000:200\n route-target import 65000:200\n <em>route-target import 65000:300<\/em>\n!\nip vrf Shared\n rd 65000:300\n route-target export 65000:300\n route-target import 65000:300\n<\/pre>\n\n\n\n<p>VRFs Customer_A and Customer_B will now import routes exported from VRF Shared in addition to their own &#8220;native&#8221; routes. To complete our VRF configuration, VRFs Customer_A and Customer_B also need to export their native routes to VRF Shared. But wait a minute. If we configure the customer VRFs to export to 65000:300, they&#8217;ll end up learning each other&#8217;s routes, because both are already importing 65000:300. We don&#8217;t want that!<\/p>\n\n\n\n<p>The solution here is to export using a different RT than the one used for import. You can pick whatever number you want. To illustrate this point, we&#8217;ll use 65000:1234.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ip vrf Customer_A\n rd 65000:100\n route-target export 65000:100\n <em>route-target export 65000:1234<\/em>\n route-target import 65000:100\n route-target import 65000:300\n!\nip vrf Customer_B\n rd 65000:200\n route-target export 65000:200\n <em>route-target export 65000:1234<\/em>\n route-target import 65000:200\n route-target import 65000:300\n!\nip vrf Shared\n rd 65000:300\n route-target export 65000:300\n <em>route-target import 65000:1234<\/em>\n<\/pre>\n\n\n\n<p>With this approach, both customers can reach the Shared VRF but not each other, and the Shared VRF can reach both customers.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/packetlife.net\/media\/blog\/attachments\/685\/VRF_import_export.png\" alt=\"VRF_import_export.png\"\/><\/figure>\n\n\n\n<p>Alternatively, we could have configured VRF Shared to import routes with tagged with 65000:100 and 65000:200. This would have worked, however this approach doesn&#8217;t scale well. Imagine if we had a hundred customer VRFs to export to: An additional community would need to be imported for each. Designating a separate RT for export to the Shared VRF allows us to scale to any number of customer VRFs using only a single pair of targets.<\/p>\n\n\n\n<p>Ref: <\/p>\n\n\n\n<p>1, <a href=\"https:\/\/packetlife.net\/blog\/2013\/jun\/10\/route-distinguishers-and-route-targets\/\">https:\/\/packetlife.net\/blog\/2013\/jun\/10\/route-distinguishers-and-route-targets\/<\/a><\/p>\n\n\n\n<p>2, <a href=\"https:\/\/www.cisco.com\/c\/en\/us\/td\/docs\/optical\/15000r8_0\/ethernet\/454\/guide\/d80ether\/r8vrf.pdf\">https:\/\/www.cisco.com\/c\/en\/us\/td\/docs\/optical\/15000r8_0\/ethernet\/454\/guide\/d80ether\/r8vrf.pdf<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>People new to MPLS VPN are often unclear on what functions route distinguishers and route targets serve, and the difference between the two. Let&#8217;s see if we can clear up some of that confusion. If you could use a refresher on VRF fundamentals, I encourage you to first check out my earlier articles on the <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=2980\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9,19],"tags":[572,573],"class_list":["post-2980","post","type-post","status-publish","format-standard","hentry","category-networks","category-router-switch","tag-route-distinguisher","tag-route-target"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/2980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2980"}],"version-history":[{"count":1,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/2980\/revisions"}],"predecessor-version":[{"id":2981,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/2980\/revisions\/2981"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}