{"id":211,"date":"2020-09-26T13:29:31","date_gmt":"2020-09-26T13:29:31","guid":{"rendered":"https:\/\/dft.wiki\/?p=211"},"modified":"2021-04-07T16:31:56","modified_gmt":"2021-04-07T16:31:56","slug":"ospf-on-cisco-routers","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=211","title":{"rendered":"OSPF on Cisco Routers"},"content":{"rendered":"<p>OSPF is one open standard (no proprietary) routing protocol. It is a link-state protocol and allows all the routers on the network to map the whole network to make its own decisions based on the big print.<\/p>\n<p>Given the scenario below, PC1 needs to reach PC2:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/09\/image-72.png\" alt=\"This image has an empty alt attribute; its file name is image-72.png\" \/><\/figure>\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\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\nhostname Router1<\/pre>\n<pre>interface g0\/0\r\nip address 192.168.3.1 255.255.255.252\r\nno shutdown\r\ninterface g0\/1\r\nip address 192.168.1.1 255.255.255.0\r\nno shutdown<\/pre>\n<\/div>\n<div class=\"wp-block-column\">\n<p>Router2<\/p>\n<pre>enable \r\nconfigure terminal \r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\nhostname Router2<\/pre>\n<pre>interface g0\/0\r\nip address 192.168.3.2 255.255.255.252\r\nno shutdown\r\ninterface g0\/1\r\nip address 192.168.2.1 255.255.255.0\r\nno shutdown<\/pre>\n<\/div>\n<\/div>\n<p><strong>Example of a Single Area configuration:<\/strong><\/p>\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>Router1<\/p>\n<pre>router ospf 1\r\nnetwork 192.168.1.0 0.0.0.255 area 0\r\nnetwork 192.168.3.0 0.0.0.3 area 0\r\npassive-interface GigabitEthernet0\/1<\/pre>\n<\/div>\n<div class=\"wp-block-column\">\n<p>Router2<\/p>\n<pre>router ospf 1\r\nnetwork 192.168.2.0 0.0.0.255 area 0\r\nnetwork 192.168.3.0 0.0.0.3 area 0\r\npassive-interface GigabitEthernet0\/1<\/pre>\n<\/div>\n<\/div>\n<p>For simple networks with few routers it works perfectly. The problem start when there are many routers, let&#8217;s say 50. When one link goes down all the routers start to change list state messages and this could be avoided be segmenting the network in zones:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" class=\"wp-image-435\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/09\/image-79.png\" alt=\"\" \/><\/figure>\n<\/div>\n<p><strong>Configuring the Interfaces according to the diagram above:<\/strong><\/p>\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>RouterA1<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname RA1\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\ninterface g0\/0\r\nip address 10.0.0.2 255.255.255.0\r\nno shutdown\r\ninterface s0\/0\/0\r\nip address 10.0.1.1 255.255.255.0\r\nno shutdown<\/pre>\n<p>RouterA3<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname RA3\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\ninterface s0\/0\/1\r\nip address 10.0.3.1 255.255.255.0\r\nno shutdown\r\ninterface g0\/1\r\nip address 10.0.2.2 255.255.255.0\r\nno shutdown<\/pre>\n<p>RouterB2<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname RB2\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\ninterface g0\/0\r\nip address 10.0.6.1 255.255.255.0\r\nno shutdown\r\ninterface g0\/1\r\nip address 10.0.5.2 255.255.255.0\r\nno shutdown<\/pre>\n<p>Router Gateway<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname Gateway\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\ninterface s0\/0\/0\r\nip address 10.0.4.2 255.255.255.0\r\nno shutdown\r\ninterface s0\/0\/1\r\nip address 10.0.7.2 255.255.255.0\r\nno shutdown\r\ninterface s0\/1\/0\r\nip address 10.0.1.2 255.255.255.0\r\nno shutdown\r\ninterface s0\/1\/1\r\nip address 10.0.3.2 255.255.255.0\r\nno shutdown<\/pre>\n<\/div>\n<div class=\"wp-block-column\">\n<p>RouterA2<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname RA2\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\ninterface g0\/0\r\nip address 10.0.0.1 255.255.255.0\r\nno shutdown\r\ninterface g0\/1\r\nip address 10.0.2.1 255.255.255.0\r\nno shutdown<\/pre>\n<p>RouterB1<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname RB1\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\ninterface g0\/0\r\nip address 10.0.6.2 255.255.255.0\r\nno shutdown\r\ninterface s0\/0\/1\r\nip address 10.0.7.1 255.255.255.0\r\nno shutdown<\/pre>\n<p>RouterB3<\/p>\n<pre>enable \r\nconfigure terminal \r\nhostname RB3\r\nno ip domain lookup\r\nline con 0\r\nlogging synchronous\r\ninterface s0\/0\/0\r\nip address 10.0.4.1 255.255.255.0\r\nno shutdown\r\ninterface g0\/1\r\nip address 10.0.5.1 255.255.255.0\r\nno shutdown<\/pre>\n<\/div>\n<\/div>\n<p><strong>Configuring the OSPF according to the Areas on the diagram:<\/strong><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" class=\"wp-image-439\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/09\/image-83.png\" alt=\"\" \/><\/figure>\n<\/div>\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>RouterA1<\/p>\n<pre>router ospf 1\r\nnetwork 10.0.0.0 0.0.0.255 area 1\r\nnetwork 10.0.1.0 0.0.0.255 area 1<\/pre>\n<p>RouterA2<\/p>\n<pre>router ospf 1\r\nnetwork 10.0.0.0 0.0.0.255 area 1\r\nnetwork 10.0.2.0 0.0.0.255 area 1<\/pre>\n<p>RouterA3<\/p>\n<pre>router ospf 1\r\nnetwork 10.0.2.0 0.0.0.255 area 1\r\nnetwork 10.0.3.0 0.0.0.255 area 1<\/pre>\n<p>Router Gateway<\/p>\n<pre>router ospf 1\r\nnetwork 10.0.1.0 0.0.0.255 area 1\r\nnetwork 10.0.3.0 0.0.0.255 area 1\r\nnetwork 10.0.7.0 0.0.0.255 area 2\r\nnetwork 10.0.4.0 0.0.0.255 area 2<\/pre>\n<\/div>\n<div class=\"wp-block-column\">\n<p>RouterB1<\/p>\n<pre>router ospf 1\r\nnetwork 10.0.7.0 0.0.0.255 area 2\r\nnetwork 10.0.6.0 0.0.0.255 area 2<\/pre>\n<p>RouterB2<\/p>\n<pre>router ospf 1\r\nnetwork 10.0.6.0 0.0.0.255 area 2\r\nnetwork 10.0.5.0 0.0.0.255 area 2<\/pre>\n<p>RouterB3<\/p>\n<pre>router ospf 1\r\nnetwork 10.0.5.0 0.0.0.255 area 2\r\nnetwork 10.0.4.0 0.0.0.255 area 2<\/pre>\n<p><strong>Note:<\/strong><\/p>\n<ul>\n<li>Routers A* are area 1, so they are colled Internal;<\/li>\n<li>Routers B* are area 2, so they are colled Internal;<\/li>\n<li>Router Gateway has interfaces in area 1 and area 2, so it is called Area Border or Backbone;<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p>The router gateway to outside the network has to have this config:<\/p>\n<pre>router ospf 1\r\ndefault-information originate\r\nip route 0.0.0.0 0.0.0.0 g0\/0<\/pre>\n<p>This will inform all the other routers who of them is the &#8216;<strong>gateway of last resort<\/strong>&#8216; when one network is unknown.<\/p>\n<p>To check the configuration in each Router issue the commands:<\/p>\n<pre>show ip route\r\nshow ip route ospf\r\nshow ip protocols\r\nshow ip interface brief\r\nshow ip ospf\r\nshow ip ospf interface brief\r\nshow ip ospf interface\r\nshow ip ospf neighbor\r\nshow ip ospf database<\/pre>\n<p>Reference Bandwidth (for optimized route calculation):<\/p>\n<pre>router ospf 1\r\nauto-cost reference-bandwidth 10000\r\nip ospf cost 22222<\/pre>\n<p>Set all interfaces as Passive by Default:<\/p>\n<pre>passive-interface default\r\nno passive-interface Serial0\/0\/0\r\nno passive-interface Serial0\/0\/1<\/pre>\n<p>To apply <strong>authentication<\/strong> to join the OSPF, issue the same command <strong>in all interfaces in all routers<\/strong>:<\/p>\n<pre>ip ospf message-digest-key 1 md5 PASSWORD\r\nip ospf authentication message-digest<\/pre>\n<p>Remember to replace &#8216;PASSWORD&#8217; with one secret of your choice.<\/p>\n<p>Learn more about [<a href=\"https:\/\/www.youtube.com\/watch?v=kfvJ8QVJscc\">OSPF Single<\/a> &#8211; CertBros]<\/p>\n<p>Learn more about [<a href=\"https:\/\/www.youtube.com\/watch?v=PIMnj2oqYIo\">OSPF Multi<\/a> &#8211; CertBros]<\/p>\n<p>The preview Post was about RIPv2 [<a href=\"https:\/\/dft.wiki\/?p=205\">Read It<\/a>].<\/p>\n<p>The following Post is about EIGRP [<a href=\"https:\/\/dft.wiki\/?p=209\">Read It<\/a>].<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OSPF is one open standard (no proprietary) routing protocol. It is a link-state protocol and [&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-211","post","type-post","status-publish","format-standard","hentry","category-ccna"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/211","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=211"}],"version-history":[{"count":10,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions"}],"predecessor-version":[{"id":1718,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions\/1718"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}