{"id":478,"date":"2019-06-15T22:32:41","date_gmt":"2019-06-15T19:32:41","guid":{"rendered":"https:\/\/isp-tech.ru\/?p=478"},"modified":"2021-04-19T23:44:31","modified_gmt":"2021-04-19T20:44:31","slug":"bgp-conditional-advertisement-juniper-mx","status":"publish","type":"post","link":"https:\/\/isp-tech.ru\/en\/bgp-conditional-advertisement-juniper-mx\/","title":{"rendered":"How to configure bgp conditional advertisement on Juniper MX triggered by lost of route."},"content":{"rendered":"\n<p>Consider an unusual case of bgp conditional advertisement triggered by lost of route.<br>Our task is: <br>Announce certain networks to backup uplink only if the default route from the main uplink is lost.<br>Both uplinks announce the default route &#8211; 0\/0.<\/p>\n\n\n\n<p>To implement this, we need to check the availability of the route from the main uplink. To do so, we need to put it in a separate table with the RIB group:<\/p>\n\n\n\n<p>Adding RIB group with import policy:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nset routing-options rib-groups inet.0_to_check-conditional export-rib inet.0\nset routing-options rib-groups inet.0_to_check-conditional import-rib &#x5B;inet.0  check-conditional.inet.0]\nset routing-options rib-groups inet.0_to_check-conditional import-policy default-route-only-accept\n<\/pre><\/div>\n\n\n<p>import policy:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nset policy-options policy-statement default-route-only-accept term accept from route-filter 0.0.0.0\/0 exact\nset policy-options policy-statement default-route-only-accept term accept then accept\nset policy-options policy-statement default-route-only-accept term deny then reject\n<\/pre><\/div>\n\n\n<p>Apply RIB group to main upstream peer :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nset protocols bgp group UPSTREAM type external\nset protocols bgp group UPSTREAM local-as 64399\nset protocols bgp group UPSTREAM family inet unicast rib-group  inet.0_to_check-conditional \nset protocols bgp group UPSTREAM neighbor 10.10.10.1 description upstream-main\nset protocols bgp group UPSTREAM neighbor 10.10.10.1 peer-as 64500\n<\/pre><\/div>\n\n\n<p>After commit, we should have a route from the main uplink in the table check-conditional.inet.0<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&gt;show route table check-conditional.inet.0  \n check-conditional.inet.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)\n = Active Route, - = Last Active, * = Both \n 0.0.0.0\/0          *&#x5B;BGP\/170] 00:01:26, localpref 150\n                       AS path: 64500 I, validation-state: unverified\n                     &gt; to  10.10.10.1 via ae10.10\n<\/pre><\/div>\n\n\n<p>Now we can set up conditional check in export policy to a backup upstream.<br>The check is based on the condition mechanism builtin in Junos. <br>Here is how it works:<br>The announcement of our networks is controlled by an upstream-backup-out policy.<br>In the check term, the route is checked in the check-conditional.inet.0 table. If the route is present, the match occurs and action &#8211; reject is executed. <br><br>If no route is matched in the check-conditional.inet.0 table, there will be no match in the check term, and the routes will be processed in the announce term.<br>Thus, if the route disappears from the main uplink, our networks will be announced to backup upstream. <\/p>\n\n\n\n<p>Create conditional policy : <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nset policy-options condition conditional_advertise if-route-exists 0.0.0.0\/0\nset policy-options condition conditional_advertise if-route-exists table check-conditional.inet.0\n<\/pre><\/div>\n\n\n<p>Adding export policy for backup upstream: <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nset policy-options policy-statement upstream-backup-out term check from prefix-list MY-NETWORKS\nset policy-options policy-statement upstream-backup-out term check from condition conditional_advertise\nset policy-options policy-statement upstream-backup-out term check then reject\nset policy-options policy-statement upstream-backup-out term announce from prefix-list MY-NETWORKS \nset policy-options policy-statement upstream-backup-out term  announce  then accept\nset policy-options policy-statement upstream-backup-out term discard-all then reject\n<\/pre><\/div>\n\n\n<p>Apply export policy for backup upstream :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nset protocols bgp group UPSTREAM-BACKUP neighbor 10.20.20.1 export upstream-backup-out\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Consider an unusual case of bgp conditional advertisement triggered by lost of route.Our task is: Announce certain networks to backup uplink only if the default route from the main uplink is lost.Both uplinks announce the default route &#8211; 0\/0. To implement this, we need to check the availability of the route from the main uplink.\u2026 <span class=\"read-more\"><a href=\"https:\/\/isp-tech.ru\/en\/bgp-conditional-advertisement-juniper-mx\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[13],"tags":[15,14],"class_list":["post-478","post","type-post","status-publish","format-standard","hentry","category-bgp","tag-bgp","tag-juniper"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>bgp conditional advertisement Juniper MX how to configure - isp-tech.ru<\/title>\n<meta name=\"description\" content=\"Post describes how to configure bgp conditional advertisement on Juniper MX to backup uplink when route from primary upstream is lost.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/isp-tech.ru\/en\/bgp-conditional-advertisement-juniper-mx\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/isp-tech.ru\/#\/schema\/person\/bfc8f447cee1b54cc04a263ed0673363\"},\"headline\":\"How to configure bgp conditional advertisement on Juniper MX triggered by lost of route.\",\"datePublished\":\"2019-06-15T19:32:41+00:00\",\"dateModified\":\"2021-04-19T20:44:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/\"},\"wordCount\":451,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/isp-tech.ru\/#\/schema\/person\/bfc8f447cee1b54cc04a263ed0673363\"},\"keywords\":[\"BGP\",\"Juniper\"],\"articleSection\":[\"BGP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/\",\"url\":\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/\",\"name\":\"bgp conditional advertisement Juniper MX how to configure - isp-tech.ru\",\"isPartOf\":{\"@id\":\"https:\/\/isp-tech.ru\/#website\"},\"datePublished\":\"2019-06-15T19:32:41+00:00\",\"dateModified\":\"2021-04-19T20:44:31+00:00\",\"description\":\"Post describes how to configure bgp conditional advertisement on Juniper MX to backup uplink when route from primary upstream is lost.\",\"breadcrumb\":{\"@id\":\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"https:\/\/isp-tech.ru\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to configure bgp conditional advertisement on Juniper MX triggered by lost of route.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/isp-tech.ru\/#website\",\"url\":\"https:\/\/isp-tech.ru\/\",\"name\":\"isp-tech.ru\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/isp-tech.ru\/#\/schema\/person\/bfc8f447cee1b54cc04a263ed0673363\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/isp-tech.ru\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/isp-tech.ru\/#\/schema\/person\/bfc8f447cee1b54cc04a263ed0673363\",\"name\":\"admin\",\"logo\":{\"@id\":\"https:\/\/isp-tech.ru\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"bgp conditional advertisement Juniper MX how to configure - isp-tech.ru","description":"Post describes how to configure bgp conditional advertisement on Juniper MX to backup uplink when route from primary upstream is lost.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/isp-tech.ru\/en\/bgp-conditional-advertisement-juniper-mx\/","twitter_misc":{"Written by":"admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/#article","isPartOf":{"@id":"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/"},"author":{"name":"admin","@id":"https:\/\/isp-tech.ru\/#\/schema\/person\/bfc8f447cee1b54cc04a263ed0673363"},"headline":"How to configure bgp conditional advertisement on Juniper MX triggered by lost of route.","datePublished":"2019-06-15T19:32:41+00:00","dateModified":"2021-04-19T20:44:31+00:00","mainEntityOfPage":{"@id":"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/"},"wordCount":451,"commentCount":0,"publisher":{"@id":"https:\/\/isp-tech.ru\/#\/schema\/person\/bfc8f447cee1b54cc04a263ed0673363"},"keywords":["BGP","Juniper"],"articleSection":["BGP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/","url":"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/","name":"bgp conditional advertisement Juniper MX how to configure - isp-tech.ru","isPartOf":{"@id":"https:\/\/isp-tech.ru\/#website"},"datePublished":"2019-06-15T19:32:41+00:00","dateModified":"2021-04-19T20:44:31+00:00","description":"Post describes how to configure bgp conditional advertisement on Juniper MX to backup uplink when route from primary upstream is lost.","breadcrumb":{"@id":"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/isp-tech.ru\/bgp-conditional-advertisement-juniper-mx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"https:\/\/isp-tech.ru\/"},{"@type":"ListItem","position":2,"name":"How to configure bgp conditional advertisement on Juniper MX triggered by lost of route."}]},{"@type":"WebSite","@id":"https:\/\/isp-tech.ru\/#website","url":"https:\/\/isp-tech.ru\/","name":"isp-tech.ru","description":"","publisher":{"@id":"https:\/\/isp-tech.ru\/#\/schema\/person\/bfc8f447cee1b54cc04a263ed0673363"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/isp-tech.ru\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/isp-tech.ru\/#\/schema\/person\/bfc8f447cee1b54cc04a263ed0673363","name":"admin","logo":{"@id":"https:\/\/isp-tech.ru\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/posts\/478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/comments?post=478"}],"version-history":[{"count":33,"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/posts\/478\/revisions"}],"predecessor-version":[{"id":1065,"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/posts\/478\/revisions\/1065"}],"wp:attachment":[{"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/media?parent=478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/categories?post=478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/isp-tech.ru\/en\/wp-json\/wp\/v2\/tags?post=478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}