{"id":28,"date":"2009-02-04T10:57:02","date_gmt":"2009-02-04T10:57:02","guid":{"rendered":"https:\/\/n0c.us\/?p=28"},"modified":"2026-02-20T19:03:45","modified_gmt":"2026-02-20T19:03:45","slug":"manipulation-of-administrative-distance","status":"publish","type":"post","link":"https:\/\/n0c.us\/?p=28","title":{"rendered":"Manipulation of Administrative Distance"},"content":{"rendered":"\n<p>For a variety of reasons you may want to keep routes that have been learned by a routing protocol from reaching the forwarding table or for a less \u201cbelievable\u201d protocol to take precedence over a more \u201cbelievable\u201d protocol. In this post we\u2019ll explore some of those options. We do this to the end that knowing about these options gives you the flexibility to use them, in addition to being aware that someone else may have used them and that is why routes that you are expecting to see in the routing table are not there.<\/p>\n\n\n\n<p>While you may know that administrative distance is there and know what it is for, you should also be aware that it is very configurable. You may not have known, but\u2026<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can change the administrative distance for an entire routing protocol.<\/li>\n\n\n\n<li>You can change the administrative distance for a type of route within a routing protocol (OSPF: internal, E1, E2, ISIS: L1, L2).<\/li>\n\n\n\n<li>You can change the administrative distance for a specific subnet.<\/li>\n<\/ul>\n\n\n\n<p>Pretty neat, huh?<\/p>\n\n\n\n<p>To change the AD for an entire routing protocol, the method depends on the protocol, but they are all really similar. No matter which routing protocol you\u2019re using, the AD always gets changed under the routing process. In this example we\u2019ll use OSPF.<\/p>\n\n\n\n<p>First lets check out what OSPF\u2019s contribution to the routing table looks like before we start noodling.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1#sh ip route ospf\n     10.0.0.0\/24 is subnetted, 4 subnets\nO IA    10.1.2.0 [110\/65] via 10.1.0.2, 00:01:39, Serial1\/1\nO       10.1.4.0 [110\/2] via 10.1.1.3, 00:01:39, FastEthernet0\/0\nP1R1#<\/pre>\n\n\n\n<p>There we are, good old standard OSPF all around. We have an inter-area route and an intra-area route. Let\u2019s make some adjustments.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1#conf t\nEnter configuration commands, one per line.  End with CNTL\/Z.\nP1R1(config)#router ospf 1\nP1R1(config-router)#distance ?\n  &lt;1-255&gt;  Administrative distance\n  ospf     OSPF distance\n\nP1R1(config-router)#distance 120\nP1R1(config-router)#<\/pre>\n\n\n\n<p>That\u2019s it. Now when we back out of the routing process and go to an exec prompt, we can see the fruits of our labor:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1#sh ip route ospf\n     10.0.0.0\/24 is subnetted, 4 subnets\nO IA    10.1.2.0 [120\/65] via 10.1.0.2, 00:00:01, Serial1\/1\nO       10.1.4.0 [120\/2] via 10.1.1.3, 00:00:01, FastEthernet0\/0\nP1R1#<\/pre>\n\n\n\n<p>Notice that the OSPF routes have an administrative distance of 120; mission accomplished. Next let\u2019s talk about just altering the administrative distance for just one route type.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1#conf t\nEnter configuration commands, one per line.  End with CNTL\/Z.\nP1R1(config)#router ospf 1\nP1R1(config-router)#distance ospf ?\n  external    External type 5 and type 7 routes\n  inter-area  Inter-area routes\n  intra-area  Intra-area routes\n\nP1R1(config-router)#distance ospf intra-area 130\nP1R1(config-router)#end\nP1R1#sh ip route ospf\n     10.0.0.0\/24 is subnetted, 4 subnets\nO IA    10.1.2.0 [120\/65] via 10.1.0.2, 00:00:05, Serial1\/1\nO       10.1.4.0 [130\/2] via 10.1.1.3, 00:00:05, FastEthernet0\/0<\/pre>\n\n\n\n<p>Now, for routes that are intra-area, that is, routes within our current area of area 1, we have an AD of 130 while every other route learned via OSPF should be still at 120 (from before).<\/p>\n\n\n\n<p>We can remove the statements, and we\u2019re back to scratch.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1#conf t\nEnter configuration commands, one per line.  End with CNTL\/Z.\nP1R1(config)#router ospf 1\nP1R1(config-router)#no distance 120\nP1R1(config-router)#no distance ospf intra-area 130\nP1R1(config-router)#end\nP1R1#sh ip\n*Feb  4 19:13:56.863: %SYS-5-CONFIG_I: Configured from console by console\nP1R1#sh ip route ospf\n     10.0.0.0\/24 is subnetted, 4 subnets\nO IA    10.1.2.0 [110\/65] via 10.1.0.2, 00:01:39, Serial1\/1\nO       10.1.4.0 [110\/2] via 10.1.1.3, 00:01:39, FastEthernet0\/0<\/pre>\n\n\n\n<p>From here, let\u2019s look at changing the AD for just a specific route. Maybe we want to leave everything intact with an AD of 110, but for a single subnet. In this example we\u2019ll change 10.1.4.0 to an AD of 155. This is a bit more complicated than the other options because we are adding the extra step of creating an access-list to match our networks. Next, the syntax is a bit different than what we have been working with so far. We start off with \u201cdistance 155\u2033 much like the first part of this exercise, but then we quantify the <strong>routing source<\/strong> before we reference our access list. This allows us the opportunity to be even more granular with our matching. While I won\u2019t go too much further into this here, let\u2019s just say that you could keep&nbsp; your normal AD set except for when you get the route from a certain router. Here I am going to say that 0.0.0.0 (any IP) and wildcard mask 255.255.255.255 (all \u201cI don\u2019t care\u201d bits) so that any route source (any router) that sends us routes matching access-list 10 (10.1.4.0\/24) matches and will set the AD to 155.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1(config)#access-list 10 permit 10.1.4.0 0.0.0.255\nP1R1(config)#router ospf 1\nP1R1(config-router)#distance 155 0.0.0.0 255.255.255.255 10\nP1R1(config-router)#end\nP1R1#\n*Feb  5 00:09:25.134: %SYS-5-CONFIG_I: Configured from console by console<\/pre>\n\n\n\n<p>With the configuration complete, we\u2019re ready to check out how we did. Fingers crossed\u2026<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1#sh ip route ospf\n     10.0.0.0\/24 is subnetted, 4 subnets\nO IA    10.1.2.0 [110\/65] via 10.1.0.2, 00:02:30, Serial1\/1\nO       10.1.4.0 [155\/2] via 10.1.1.3, 00:02:30, FastEthernet0\/0\nP1R1#<\/pre>\n\n\n\n<p>There you go!<\/p>\n\n\n\n<p>For a final note on our Administrative distance portion I want to remind you that the higher the value of the administrative distance, the less believable it is considered by the router. Also, be aware that if you set an AD to 255, it will NEVER get into the routing table. Take a look\u2026<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1(config)#router ospf 1\nP1R1(config-router)#distance 255 0.0.0.0 255.255.255.255 10\nP1R1(config-router)#end\n*Feb  5 00:51:55.398: %SYS-5-CONFIG_I: Configured from console by console\nP1R1#sh ip route ospf\n     10.0.0.0\/24 is subnetted, 3 subnets\nO IA    10.1.2.0 [110\/65] via 10.1.0.2, 00:00:05, Serial1\/1\nP1R1#<\/pre>\n\n\n\n<p>Not there. But what\u2019s this? It *IS* in the link-state database! Check it\u2026<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-small-font-size\">P1R1#sh ip ospf database<br><br>            OSPF Router with ID (10.1.1.1) (Process ID 1)<br><br>                Router Link States (Area 0)<br><br>Link ID         ADV Router      Age         Seq#       Checksum Link count<br>10.1.1.1        10.1.1.1        1110        0x8000000D 0x00ED69 2<br>10.1.2.2        10.1.2.2        1018        0x8000000B 0x00CA8B 2<br><br>                Summary Net Link States (Area 0)<br><br>Link ID         ADV Router      Age         Seq#       Checksum<br>10.1.1.0        10.1.1.1        1110        0x8000000B 0x0076A2<br>10.1.2.0        10.1.2.2        1018        0x8000000B 0x005EB7<br><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#b06b6b\" class=\"has-inline-color\">10.1.4.0        10.1.1.1        847         0x8000000B 0x005FB5<\/mark><br><\/strong><br>                Router Link States (Area 1)<br><br>Link ID         ADV Router      Age         Seq#       Checksum Link count<br>10.1.1.1        10.1.1.1        1110        0x8000000C 0x00BC36 1<br>10.200.200.13   10.200.200.13   863         0x8000000C 0x00B2E7 2<br><br>                Net Link States (Area 1)<br><br>Link ID         ADV Router      Age         Seq#       Checksum<br>10.1.1.1        10.1.1.1        1110        0x8000000B 0x009AC5<br><br>                Summary Net Link States (Area 1)<br><br>Link ID         ADV Router      Age         Seq#       Checksum<br>10.1.0.0        10.1.1.1        1129        0x8000000B 0x00F9E0<br>10.1.2.0        10.1.1.1        1129        0x8000000B 0x00EDE9<br>P1R1#<\/pre>\n\n\n\n<p>There you have it. The AD of 255 killed the 10.1.4.0\/24 route.<\/p>\n\n\n\n<p>That pretty much wraps up this post. I hope you enjoyed our little adventure in manipulating administrative distances \u2013 I know that I\u2019ll have a hard time sleeping tonight =). Please email if you have any questions or comments, or if you feel that something was not clearly explained or if you feel that something is in error.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a variety of reasons you may want to keep routes that have been learned by a routing protocol from reaching the forwarding table or for a less \u201cbelievable\u201d protocol to take precedence over a more \u201cbelievable\u201d protocol. In this post we\u2019ll explore some of those options. We do this to the end that knowing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-network"],"_links":{"self":[{"href":"https:\/\/n0c.us\/index.php?rest_route=\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/n0c.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/n0c.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/n0c.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/n0c.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=28"}],"version-history":[{"count":7,"href":"https:\/\/n0c.us\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions"}],"predecessor-version":[{"id":36,"href":"https:\/\/n0c.us\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions\/36"}],"wp:attachment":[{"href":"https:\/\/n0c.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/n0c.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/n0c.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}