{"id":2994,"date":"2023-04-13T22:05:00","date_gmt":"2023-04-14T03:05:00","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=2994"},"modified":"2023-04-14T08:18:46","modified_gmt":"2023-04-14T13:18:46","slug":"simple-ospf-between-mikrotik-routers","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/simple-ospf-between-mikrotik-routers\/","title":{"rendered":"Simple OSPF between Mikrotik Routers"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p><a href=\"https:\/\/help.mikrotik.com\/docs\/display\/ROS\/OSPF\">https:\/\/help.mikrotik.com\/docs\/display\/ROS\/OSPF<\/a><\/p>\n\n\n\n<p>Setting up OSPF between Mikrotik routers is not too difficult.  The following commands should work with RouterOS version 7+.  Run these commands on each Mikrotik changing out the router-id.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create a Loop-back interface<\/h2>\n\n\n\n<p>First it would be a good idea to create an loopback interface that will stay up.  We&#8217;ll use this address as the router-id.  This should be unique per router.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/interface\/bridge\/add name=loopback<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">\/ip\/address\/add address=1.2.3.4 interface=loopback<\/pre>\n\n\n\n<p>Now lets setup OSPF.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create OSPF Instance<\/h2>\n\n\n\n<p>First we&#8217;ll create the instance.  Use the address from the above loopback address.  Technically you can use whatever id you want as long as it is a 32 bit &#8220;address&#8221; and is unique.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/routing\/ospf\/instance\/add name=default router-id=1.2.3.4<\/pre>\n\n\n\n<p>IMPORTANT NOTE: If this router is also the default gateway, you&#8217;ll need to specify the &#8220;originate-default=always&#8221; option to share the default gateway over OSPF to the other routers.  You don&#8217;t have to do this if you don&#8217;t want to share the default route.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create OSPF Area<\/h2>\n\n\n\n<p>Now we can create an OSPF area.  For a simple OSPF setup, we&#8217;ll just use the default 0.0.0.0 area.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">routing\/ospf\/area\/ add name=default area-id=0.0.0.0 instance=default<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Create Instance<\/h2>\n\n\n\n<p>Now we can add an instance.  This is responsible for what networks get shared with OSPF.  If you want to do all the addresses on the router, then use 0.0.0.0\/0.  If you only want to do specific networks, run an entry for every network, changing 0.0.0.0\/0 to the network of interest.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/routing\/ospf\/interface-template\/add networks=0.0.0.0\/0 area=default<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>After that we can check to make sure things worked.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/routing\/ospf\/neighbor\/print<\/pre>\n\n\n\n<p>You should see at a neighbor.  It can take a little bit for the neighbors to show up.<\/p>\n\n\n\n<p>You can also check the routes on the router.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/ip\/route\/print<\/pre>\n\n\n\n<p>OSPF has a default distance of 110, so checking the routes is a quick way to verify the routes are getting updated.  Do note that if you have a static route in with a lower distance, that will take precedence over OSPF.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/help.mikrotik.com\/docs\/display\/ROS\/OSPF Setting up OSPF between Mikrotik routers is not too difficult. The following commands should work with RouterOS version 7+. Run these commands on each Mikrotik changing out the router-id. Create a Loop-back interface First it would be a good &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/simple-ospf-between-mikrotik-routers\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[452,669],"tags":[301,128,1372,388,1451,1450],"class_list":["post-2994","post","type-post","status-publish","format-standard","hentry","category-mikrotik","category-networking-3","tag-mikrotik","tag-networking-2","tag-ospf","tag-routeros","tag-routeros-7","tag-routing"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=2994"}],"version-history":[{"count":9,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2994\/revisions"}],"predecessor-version":[{"id":4989,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2994\/revisions\/4989"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=2994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=2994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=2994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}