{"id":207,"date":"2020-09-26T13:28:13","date_gmt":"2020-09-26T13:28:13","guid":{"rendered":"https:\/\/dft.wiki\/?p=207"},"modified":"2021-03-03T17:18:18","modified_gmt":"2021-03-03T17:18:18","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 gateway or way to change dynamically when the gateway router goes down.<\/p>\n<p>There is when HSRP gets comes to help. It is able to negotiate between two or more routers who are going to be the virtual router. Provide high availability for the network through redundant routers.<\/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 having two routers in the same network, each has a different IP address and half of the computers go out through <strong>Router1<\/strong> and the other half through <strong>Router2<\/strong> (look at the configured Gateway on the PCs). In case one of the routers stops working the other will not get the traffic.<\/p>\n<p>With HSRP all PCs will have the same default gateway point to a virtual router &#8216;<strong>192.168.1.254<\/strong>&#8216;:<\/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 the 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 but the highest priority becomes the active router for the HSRP group. If there is a tie, the router with the highest IP address becomes the active router.<\/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 created in both routers one standby group number 1 and both have the same IP, but the priority on Router1 was defined as 150 and Router2 has the default priority 100 (the router with the highest priority becomes the Active). The command &#8216;preempt&#8217; takes back the Active status when it comes back.<\/p>\n<p>The route from the PCs to the Internet can be verified by issuing:<\/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 configuration in each Router issue the commands:<\/p>\n<pre>show standby\r\nshow standby brief<\/pre>\n<p>This command informs the router what interfaces it has to monitor:<\/p>\n<pre>standby 1 track G0\/0<\/pre>\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":8,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":1296,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions\/1296"}],"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}]}}