{"id":4442,"date":"2013-01-28T15:14:09","date_gmt":"2013-01-28T21:14:09","guid":{"rendered":"http:\/\/gregsowell.com\/?p=4442"},"modified":"2013-01-28T15:14:09","modified_gmt":"2013-01-28T21:14:09","slug":"openflow-and-mikrotik","status":"publish","type":"post","link":"https:\/\/gregsowell.com\/?p=4442","title":{"rendered":"OpenFlow And Mikrotik"},"content":{"rendered":"<p>As of <a href=\"http:\/\/wiki.mikrotik.com\/wiki\/Manual:OpenFlow\">RouterOS V6 RC8, Mikrotik has integrated an Alpha version<\/a> of <a href=\"http:\/\/www.openflow.org\/wp\/learnmore\/\">OpenFlow<\/a>.  The first thing I said was &#8220;Oh neat&#8230;what is OpenFlow?&#8221;  <\/p>\n<blockquote><p>OpenFlow is an open standard that enables researchers to run experimental protocols in the campus networks we use every day. OpenFlow is added as a feature to commercial Ethernet switches, routers and wireless access points \u2013 and provides a standardized hook to allow researchers to run experiments, without requiring vendors to expose the internal workings of their network devices. OpenFlow is currently being implemented by major vendors, with OpenFlow-enabled switches now commercially available.<\/p><\/blockquote>\n<p>What does this really mean, though?<\/p>\n<p>You start with an OF switch and a controller.  The OF switch is a switch\/router\/access point that runs the OF client.  Most switches have a &#8220;flow table&#8221; built from TCAM.  This flow table determines which traffic moves where.<\/p>\n<p><a href=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of1.png\" alt=\"\" title=\"of1\" width=\"401\" height=\"342\" class=\"aligncenter size-full wp-image-4449\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of1.png 401w, https:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of1-300x255.png 300w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/a><\/p>\n<p>OpenFlow(OF) is meant to be a means of testing new routing or forwarding methods to build these flow tables.  It is designed to allow for layer 3 or layer 2 forwarding based on: port, MAC, VLAN, TCP header, or IP header.  <\/p>\n<p>The way it accomplishes this is to establish a secure SSH tunnel between the OF switch and the controller.  The controller will run whatever this new routeing process is.  When a new flow starts, it sends the first packets to the controller.  The controller then builds an entry into the flow table to handle the remainder of this connection.  This is very reminiscent of Cisco&#8217;s original <a href=\"http:\/\/gregsowell.com\/?p=610\">Netflow<\/a>.  Netflow was often referred to as &#8220;route once, switch many.&#8221;  You are probably thinking, &#8220;how many connections can this controller sustain?&#8221;  Their documentation says that a standard PC running controller software should be able to support 10,000 new flows per second.  This would be &#8220;enough for a large campus network.&#8221;  This is definitely some heavy lifting.<\/p>\n<p>They also have the ability to segregate the OF flow table from that of the standard switch.  The idea is you can choose a handful of ports on a device and have them participate in the OF test.  Your controller will then update all of the OF switches in the chain with the new flow information.  Since this is a separate flow table the device will continue to process all other traffic based on the standard flow table.<\/p>\n<p><a href=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of2.png\" alt=\"\" title=\"of2\" width=\"404\" height=\"465\" class=\"aligncenter size-full wp-image-4450\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of2.png 404w, https:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of2-260x300.png 260w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/a><\/p>\n<p>I&#8217;ve read that in addition to this you can also have all traffic meeting given criteria to flow to the controller; this would be good for captures.  You could also in theory use this to move all traffic sourced from certain ports to flow through an IPS or transparent proxy.<\/p>\n<p><a href=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of3.png\" alt=\"\" title=\"of3\" width=\"388\" height=\"369\" class=\"aligncenter size-full wp-image-4451\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of3.png 388w, https:\/\/gregsowell.com\/wp-content\/uploads\/2013\/01\/of3-300x285.png 300w\" sizes=\"auto, (max-width: 388px) 100vw, 388px\" \/><\/a><\/p>\n<p>One of the examples I read is if you come up with your own super cool version of OSPF, then you can test it on live traffic without affecting the bulk of your users.  I really like the idea of being able to write complex algorithms on my own&#8230;:)  I can then have that push through the entirety of my Mikrotik domain.<\/p>\n<p>So long as you can maintain the SSH connectivity to the controller you can write your own proprietary mesh algorithm and have the MTKs use it.  You could write your own algorithm that monitors all of your ISP interfaces via SNMP and adjust routing on the fly according to congestion&#8230;really the sky is the limit at this point.<\/p>\n<p>Right now there are really only two commands in the Mikrotik:<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">#Specify the OF switch and controller address\r\n\/openflow add name=ofswitch1 controllers=1.1.1.1\r\n\r\n#Add ports to the OF switch\r\n\/openflow port add switch=ofswitch1 interface=ether2<\/code><\/pre>\n<p>BTW, MTK says that since it is so early in the dev state that it is NOT ready for production \ud83d\ude09<\/p>\n<p>There is a list of OF <a href=\"http:\/\/www.openflow.org\/wp\/openflow-components\/\">controllers here<\/a>.  There is also a slicer there&#8230;more or less a load balancer for the controllers.<\/p>\n<p>Anyone interested in running my proprietary protocol?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As of RouterOS V6 RC8, Mikrotik has integrated an Alpha version of OpenFlow. The first thing I said was &#8220;Oh neat&#8230;what is OpenFlow?&#8221; OpenFlow\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-4442","post","type-post","status-publish","format-standard","hentry","category-mikrotik"],"_links":{"self":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/4442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4442"}],"version-history":[{"count":15,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/4442\/revisions"}],"predecessor-version":[{"id":4460,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/4442\/revisions\/4460"}],"wp:attachment":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}