{"id":609,"date":"2015-07-08T06:15:46","date_gmt":"2015-07-08T06:15:46","guid":{"rendered":"http:\/\/www.davidpapkin.net\/?p=609"},"modified":"2015-07-08T06:15:46","modified_gmt":"2015-07-08T06:15:46","slug":"adjust-administrative-distance-for-route-selection-in-cisco-ios-routers","status":"publish","type":"post","link":"https:\/\/davidpapkin.com\/?p=609","title":{"rendered":"Adjust Administrative Distance for Route Selection in Cisco IOS Routers"},"content":{"rendered":"<p>Administrative distance is the feature that routers use in order to select the best path when there are two or more different routes to the same destination from two different routing protocols. Administrative distance defines the reliability of a routing protocol. The smaller the administrative distance value, the more reliable the protocol.<\/p>\n<p><b>Note:\u00a0<\/b>When you change the default distances, it can lead to routing loops in the network. Change the administrative distance with caution and only after you have thought through what you want to achieve.<\/p>\n<h3>Network Diagram<\/h3>\n<p>Here the router R1 and R2 are connected via parallel serial lines. The routers R1 and R2 are configured with BGP and OSPF. The default administrative distance of OSPF is 110 while that of the eBGP is 20. With the command <b>distance<\/b>, we changed the AD value of BGP to 190. Prior to this command, the router R2 preferred the BGP routes over OSPF since they had the default AD values configured. After the AD value of the BGP changed, the OSPF routes takes the precedence.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cisco.com\/c\/dam\/en\/us\/support\/docs\/ip\/ip-routed-protocols\/113153-adjust-ad-01.gif\" alt=\"adjust-ad-01.gif\" usemap=\"http:\/\/www.cisco.com\/c\/en\/us\/support\/docs\/ip\/ip-routed-protocols\/113153-adjust-ad-00.html\" border=\"0\" \/><\/p>\n<h3>Configurations<\/h3>\n<p>This document uses these configuration<\/p>\n<ul>\n<li><a href=\"http:\/\/www.cisco.com\/c\/en\/us\/support\/docs\/ip\/ip-routed-protocols\/113153-adjust-ad-00.html#t1\">Router R1 Configuration<\/a><\/li>\n<li><a href=\"http:\/\/www.cisco.com\/c\/en\/us\/support\/docs\/ip\/ip-routed-protocols\/113153-adjust-ad-00.html#t2\">Router R2 Configuration<\/a><\/li>\n<\/ul>\n<p><a name=\"t1\"><\/a><\/p>\n<table border=\"1\" width=\"60%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#FFFFFF\">\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\" bgcolor=\"#CCCCFF\" width=\"\" height=\"\">R1 Configuration<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\" bgcolor=\"#FFFFFF\" width=\"\" height=\"\">\n<pre>interface Loopback0\n ip address 1.1.1.1 255.255.255.255\n !\n!\ninterface Loopback10\n ip address 10.10.10.10 255.255.255.255\n !\n!\ninterface Loopback20\n ip address 20.20.20.20 255.255.255.255\n !\n!\ninterface Loopback30\n ip address 30.30.30.30 255.255.255.255\n !\n!\ninterface Serial1\/0\n ip address 100.100.100.1 255.255.255.0\n serial restart-delay 0\n clock rate 64000\n !\n!\ninterface Serial1\/1\n ip address 192.168.12.1 255.255.255.0\n serial restart-delay 0\n clock rate 64000\n !\n!\nrouter ospf 10\n router-id 1.1.1.1\n log-adjacency-changes\n network 1.1.1.1 0.0.0.0 area 0\n network 10.10.10.10 0.0.0.0 area 0\n network 20.20.20.20 0.0.0.0 area 0\n network 100.100.100.1 0.0.0.0 area 0\n!\nrouter bgp 123\n no synchronization\n bgp router-id 1.1.1.1\n bgp log-neighbor-changes\n network 10.10.10.10 mask 255.255.255.255\n network 20.20.20.20 mask 255.255.255.255\n network 30.30.30.30 mask 255.255.255.255\n neighbor 2.2.2.2 remote-as 100\n neighbor 2.2.2.2 ebgp-multihop 5\n neighbor 2.2.2.2 update-source Loopback0\n no auto-summary\n!<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a name=\"t2\"><\/a><\/p>\n<table border=\"1\" width=\"60%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#FFFFFF\">\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\" bgcolor=\"#CCCCFF\" width=\"\" height=\"\">R2 Configuration<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\" bgcolor=\"#FFFFFF\" width=\"\" height=\"\">\n<pre>interface Loopback0\n ip address 2.2.2.2 255.255.255.255\n !\n!\ninterface Serial1\/0\n ip address 100.100.100.2 255.255.255.0\n serial restart-delay 0\n clock rate 64000\n !\n!\ninterface Serial1\/1\n ip address 192.168.12.2 255.255.255.0\n serial restart-delay 0\n clock rate 64000\n !\n\n!\nrouter ospf 10\n router-id 2.2.2.2\n log-adjacency-changes\n network 2.2.2.2 0.0.0.0 area 0\n network 100.100.100.2 0.0.0.0 area 0\n!\nrouter bgp 100\n no synchronization\n bgp router-id 2.2.2.2\n bgp log-neighbor-changes\n neighbor 1.1.1.1 remote-as 123\n neighbor 1.1.1.1 ebgp-multihop 5\n neighbor 1.1.1.1 update-source Loopback0\n distance 190 1.1.1.1 0.0.0.0 \n<i>\n<span style=\"color: #0000ff;\">Changed the AD value of BGP as 190!<\/span>\n<\/i>\n no auto-summary\n!<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><\/h2>\n<h3>On Router R2<\/h3>\n<p><b>When the distance command is not applied on Router R2<\/b><\/p>\n<table border=\"1\" width=\"60%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#FFFFFF\">\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\" bgcolor=\"#CCCCFF\" width=\"\" height=\"\"><b><a href=\"http:\/\/www.cisco.com\/en\/US\/docs\/ios\/12_1\/iproute\/command\/reference\/1rdindep.html#wp1022511\">Show ip route<\/a><\/b><\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\" bgcolor=\"#FFFFFF\" width=\"\" height=\"\">\n<pre>Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\n       E1 - OSPF external type 1, E2 - OSPF external type 2\n       I - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2\n       ia - IS-IS inter area, * - candidate default, U - per-user static route\n       o - ODR, P - periodic downloaded static route, + - replicated route\n\nGateway of last resort is not set\n\n      1.0.0.0\/32 is subnetted, 1 subnets\nO        1.1.1.1 [110\/65] via 100.100.100.1, 00:00:03, Serial1\/0\n      2.0.0.0\/32 is subnetted, 1 subnets\nC        2.2.2.2 is directly connected, Loopback0\n      10.0.0.0\/32 is subnetted, 1 subnets\nB        10.10.10.10 [20\/0] via 1.1.1.1, 00:00:03        \n<i>\n<span style=\"color: #0000ff;\"> BGP Router Preffered Over OSPF<\/span>\n<\/i>\n      20.0.0.0\/32 is subnetted, 1 subnets\nB        20.20.20.20 [20\/0] via 1.1.1.1, 00:00:03\n <i>\n<span style=\"color: #0000ff;\"> BGP Router Preffered Over OSPF<\/span>\n<\/i>\n      30.0.0.0\/32 is subnetted, 1 subnets\nB        30.30.30.30 [20\/0] via 1.1.1.1, 00:00:03\n      100.0.0.0\/8 is variably subnetted, 2 subnets, 2 masks\nC        100.100.100.0\/24 is directly connected, Serial1\/0\nL        100.100.100.2\/32 is directly connected, Serial1\/0\n      192.168.12.0\/24 is variably subnetted, 2 subnets, 2 masks\nC        192.168.12.0\/24 is directly connected, Serial1\/1\nL        192.168.12.2\/32 is directly connected, Serial1\/1<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><b>When the distance command is applied on Router R2<\/b><\/p>\n<table border=\"1\" width=\"60%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#FFFFFF\">\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\" bgcolor=\"#CCCCFF\" width=\"\" height=\"\"><b><a href=\"http:\/\/www.cisco.com\/en\/US\/docs\/ios\/12_1\/iproute\/command\/reference\/1rdindep.html#wp1022511\">Show ip route<\/a><\/b><\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\" bgcolor=\"#FFFFFF\" width=\"\" height=\"\">\n<pre>R2#sh ip route\nCodes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\n       E1 - OSPF external type 1, E2 - OSPF external type 2\n       I - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2\n       ia - IS-IS inter area, * - candidate default, U - per-user static route\n       o - ODR, P - periodic downloaded static route, + - replicated route\n\nGateway of last resort is not set\n\n      1.0.0.0\/32 is subnetted, 1 subnets\nO        1.1.1.1 [110\/65] via 100.100.100.1, 00:00:03, Serial1\/0\n      2.0.0.0\/32 is subnetted, 1 subnets\nC        2.2.2.2 is directly connected, Loopback0\n      10.0.0.0\/32 is subnetted, 1 subnets\nO        10.10.10.10 [110\/65] via 100.100.100.1, 00:00:03, Serial1\/0\n           <i>\n<span style=\"color: #0000ff;\">By increasing the AD of External BGP, OSPF takes precedence<\/span>\n<\/i>\n      20.0.0.0\/32 is subnetted, 1 subnets\nO        20.20.20.20 [110\/65] via 100.100.100.1, 00:00:03, Serial1\/0\n           <i>\n<span style=\"color: #0000ff;\">By increasing the AD of External BGP, OSPF takes precedence<\/span>\n<\/i>\n      30.0.0.0\/32 is subnetted, 1 subnets\nB        30.30.30.30 [190\/0] via 1.1.1.1, 00:00:03\n      100.0.0.0\/8 is variably subnetted, 2 subnets, 2 masks\nC        100.100.100.0\/24 is directly connected, Serial1\/0\nL        100.100.100.2\/32 is directly connected, Serial1\/0\n      192.168.12.0\/24 is variably subnetted, 2 subnets, 2 masks\nC        192.168.12.0\/24 is directly connected, Serial1\/1\nL        192.168.12.2\/32 is directly connected, Serial1\/1<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>http:\/\/www.cisco.com\/c\/en\/us\/support\/docs\/ip\/ip-routed-protocols\/113153-adjust-ad-00.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Administrative distance is the feature that routers use in order to select the best path when there are two or more different routes to the same destination from two different routing protocols. Administrative distance defines the reliability of a routing&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,3,4],"tags":[55,67,70,124],"class_list":["post-609","post","type-post","status-publish","format-standard","hentry","category-cisco","category-computers","category-david-papkin","tag-cisco","tag-david-papkin","tag-davidpapkin","tag-networking"],"_links":{"self":[{"href":"https:\/\/davidpapkin.com\/index.php?rest_route=\/wp\/v2\/posts\/609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davidpapkin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davidpapkin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davidpapkin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davidpapkin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=609"}],"version-history":[{"count":0,"href":"https:\/\/davidpapkin.com\/index.php?rest_route=\/wp\/v2\/posts\/609\/revisions"}],"wp:attachment":[{"href":"https:\/\/davidpapkin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davidpapkin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davidpapkin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}