{"id":207,"date":"2020-09-26T13:28:13","date_gmt":"2020-09-26T13:28:13","guid":{"rendered":"https:\/\/dft.wiki\/?p=207"},"modified":"2026-06-09T14:51:06","modified_gmt":"2026-06-09T18:51:06","slug":"hsrp-on-cisco-routers","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=207","title":{"rendered":"HSRP on Cisco Routers"},"content":{"rendered":"<p>The only way out of a network is through the Default Gateway, and there is no alternative or dynamic way to reroute traffic when the gateway router goes down.<\/p>\n<p>That is where HSRP comes in. It negotiates between two or more routers to elect a virtual router, providing high availability through redundancy.<\/p>\n<p>Given the scenario:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" class=\"wp-image-420\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/09\/image-74.png\" alt=\"\" \/><\/figure>\n<\/div>\n<p>Even with two routers on the same network, each has a different IP address, and half the computers exit through <strong>Router1<\/strong> while the other half exit through <strong>Router2<\/strong> (see the configured Gateway on the PCs). If one router goes down, the other will not pick up its traffic.<\/p>\n<p>With HSRP, all PCs share the same default gateway pointing to a virtual router at <strong>192.168.1.254<\/strong>:<\/p>\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>Switch<\/p>\n<pre>No configuration at all.\r\nAll the ports are part of VLAN1.<\/pre>\n<p>PC-1<\/p>\n<pre>IP Address: 192.168.1.101\r\nDefault Gateway: 192.168.1.254<\/pre>\n<p>PC-n<\/p>\n<pre>IP Address: 192.168.1.1n\r\nDefault Gateway: 192.168.1.254<\/pre>\n<p>PC-24<\/p>\n<pre>IP Address: 192.168.1.124\r\nDefault Gateway: 192.168.1.254<\/pre>\n<\/div>\n<div class=\"wp-block-column\">\n<p>Router Internet<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname Internet\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous<\/pre>\n<p>interface g0\/0<br \/>\nip address 10.0.0.1 255.255.255.252<br \/>\nno shutdown<br \/>\ninterface g0\/1<br \/>\nip address 10.0.1.1 255.255.255.252<br \/>\nno shutdown<br \/>\ninterface lo0<br \/>\nip address 8.8.8.8 255.255.255.0<br \/>\nno shutdown<br \/>\ninterface lo1<br \/>\nip address 8.8.4.4 255.255.255.0<br \/>\nno shutdown<\/p>\n<p>router rip<br \/>\nversion 2<br \/>\nno auto-summary<br \/>\nnetwork 8.8.8.8<br \/>\nnetwork 8.8.4.4<br \/>\nnetwork 10.0.0.0<br \/>\nnetwork 10.0.1.0<br \/>\npassive-interface lo0<br \/>\npassive-interface lo1<\/p>\n<p class=\"has-background has-subtle-background-background-color\">The Loopback interfaces simulate the internet.<\/p>\n<\/div>\n<\/div>\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>Router1<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname Router1\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous<\/pre>\n<p>interface g0\/0<br \/>\nip address 10.0.0.2 255.255.255.252<br \/>\nno shutdown<br \/>\ninterface g0\/1<br \/>\nip address 192.168.1.1 255.255.255.0<br \/>\nno shutdown<\/p>\n<p>router rip<br \/>\nversion 2<br \/>\nno auto-summary<br \/>\nnetwork 192.168.1.0<br \/>\nnetwork 10.0.0.0<br \/>\nnetwork 10.0.1.0<br \/>\npassive-interface g0\/1<\/p>\n<\/div>\n<div class=\"wp-block-column\">\n<p>Router2<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname Router2\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous<\/pre>\n<p>interface g0\/0<br \/>\nip address 10.0.1.2 255.255.255.252<br \/>\nno shutdown<br \/>\ninterface g0\/1<br \/>\nip address 192.168.1.2 255.255.255.0<br \/>\nno shutdown<\/p>\n<p>router rip<br \/>\nversion 2<br \/>\nno auto-summary<br \/>\nnetwork 192.168.1.0<br \/>\nnetwork 10.0.0.0<br \/>\nnetwork 10.0.1.0<br \/>\npassive-interface g0\/1<\/p>\n<\/div>\n<\/div>\n<p><strong>Setting up HSRP on Routers 1 and 2:<\/strong><\/p>\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>Router1<\/p>\n<pre>interface g0\/1\r\nstandby version 2\r\nstandby 1 ip 192.168.1.254<\/pre>\n<p>Optional commands on Router1:<\/p>\n<pre>standby 1 priority 150\r\nstandby 1 preempt<\/pre>\n<\/div>\n<div class=\"wp-block-column\">\n<p>By default, the priority is 100, and the router with the highest priority becomes the active router for the HSRP group. If there is a tie, the router with the highest IP address wins.<\/p>\n<p>Router2<\/p>\n<pre>interface g0\/1\r\nstandby version 2\r\nstandby 1 ip 192.168.1.254<\/pre>\n<\/div>\n<\/div>\n<p>The commands above create standby group 1 on both routers, sharing the same virtual IP. Router1 has a priority of 150 while Router2 uses the default of 100, making Router1 the Active router. The <code>preempt<\/code> command ensures Router1 reclaims the Active role when it recovers.<\/p>\n<p>The route from the PCs to the Internet can be verified with:<\/p>\n<pre>tracert 8.8.8.8<\/pre>\n<p>OR<\/p>\n<p>tracert 8.8.4.4<\/p>\n<p>To check the HSRP configuration on each router:<\/p>\n<pre>show standby\r\nshow standby brief<\/pre>\n<p>To configure interface tracking, use:<\/p>\n<pre>standby 1 track G0\/0<\/pre>\n<p>This tells the router which interface to monitor.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The only way out of a network is through the Default Gateway, and there is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-ccna"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=207"}],"version-history":[{"count":9,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":5839,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions\/5839"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}