{"id":6453,"date":"2023-12-05T15:00:59","date_gmt":"2023-12-05T14:00:59","guid":{"rendered":"https:\/\/nil.uniza.sk\/?p=6453"},"modified":"2023-12-05T19:38:51","modified_gmt":"2023-12-05T18:38:51","slug":"setting-simple-lan-network-with-mikrotik-routeros-and-cisco-ios","status":"publish","type":"post","link":"https:\/\/nil.uniza.sk\/en\/setting-simple-lan-network-with-mikrotik-routeros-and-cisco-ios\/","title":{"rendered":"Setting a simple LAN network with Mikrotik RouterOS and Cisco IOS"},"content":{"rendered":"<p>In this article, as the RouterOS CLI newbie, I will set up a simple LAN network consisting of two PCs, one Mikrotik box that acts as a simple L2 LAN switch, and one Cisco router that connects everything to the internet using NAT. All four devices are in the same broadcast domain and have IP addresses from the network address space : 10.1.1.0\/24<\/p>\n\n\n\n<p>Devices addresses:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PC1: 10.1.1.101\/24<\/li>\n\n\n\n<li>PC2: 10.1.1.102\/24<\/li>\n\n\n\n<li>Mikrotik box: 10.1.1.2\/24<\/li>\n\n\n\n<li>Cisco router as a defautl gw: 10.1.1.1\/24<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img alt=\"\" decoding=\"async\" width=\"462\" height=\"279\" src=\"https:\/\/nil.uniza.sk\/wp-content\/uploads\/2023\/12\/image.png\" class=\"wp-image-6454\" srcset=\"https:\/\/nil.uniza.sk\/wp-content\/uploads\/2023\/12\/image.png 462w, https:\/\/nil.uniza.sk\/wp-content\/uploads\/2023\/12\/image-300x181.png 300w\" sizes=\"(max-width: 462px) 100vw, 462px\" \/><\/figure>\n\n\n\n<p>The R1 router config is quite simple:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hostname R1\ninterface FastEthernet0\/0\n ip address dhcp\n ip nat outside\ninterface FastEthernet0\/1\n ip address 10.1.1.1 255.255.255.0\n ip nat inside\nip access-list standard 1\n  permit 10.1.1.0 0.0.0.255\nip nat inside source list 1 int fa 0\/0 overload<\/code><\/pre>\n\n\n\n<p>A simple test of connectivity<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nR1(config)#do ping 1.1.1.1 so fa 0\/1\nType escape sequence to abort.\nSending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:\nPacket sent with a source address of 10.1.1.1\n!!!!!\nSuccess rate is 100 percent (5\/5), round-trip min\/avg\/max = 8\/16\/40 ms\nR1(config)#\n<\/code><\/pre>\n\n\n\n<p>However, I&#8217;m focusing on RouterOS. In GNS3 the Mikrotik boot empty, and there is no configuration. <\/p>\n\n\n\n<p>Therefore, to enable LAN switching, we have <strong>to create the bridge<\/strong>. We will do it by typing<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;admin@MikroTik] \/interface\/bridge\n&#91;admin@MikroTik] \/interface\/bridge&gt; <strong>add name=main mtu=auto auto-mac=yes<\/strong><\/code><\/pre>\n\n\n\n<p>Where<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>name is the name<\/li>\n\n\n\n<li>auto-mac &#8211; choose MAC address from the first added port<\/li>\n<\/ul>\n\n\n\n<p>all other parameters of the bridge stay in their default values (more at  <a href=\"https:\/\/help.mikrotik.com\/docs\/display\/ROS\/Bridging+and+Switching\">https:\/\/help.mikrotik.com\/docs\/display\/ROS\/Bridging+and+Switching<\/a>).<\/p>\n\n\n\n<p>Then, we have to <strong>assign physical ports<\/strong> to the bridge<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;admin@MikroTik] \/interface\/bridge&gt; port add bridge=main interface=ether1\n&#91;admin@MikroTik] \/interface\/bridge&gt; port add bridge=main interface=ether2\n&#91;admin@MikroTik] \/interface\/bridge&gt; port add bridge=main interface=ether3<\/code><\/pre>\n\n\n\n<p>The final bridge will look like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>admin@MikroTik] \/interface\/bridge&gt; <strong>port\/print<\/strong>\nColumns: INTERFACE, BRIDGE, HW, PVID, PRIORITY, PATH-COST, INTERNAL-PATH-COST, HORIZON\n# INTERFACE  BRIDGE  HW   PVID  PRIORITY  PATH-COST  INTERNAL-PATH-COST  HORIZON\n0 ether1     main    yes     1  0x80             10                  10  none\n1 ether2     main    yes     1  0x80             10                  10  none\n2 ether3     main    yes     1  0x80             10                  10  none\n<\/code><\/pre>\n\n\n\n<p>Adding physical ports forms the software switch\/bridge, where all connected devices may communicate. Here PC2 will be able to ping PC1 and ad vice versa, and similarly, we are able to ping the default gateway or internet IP addresses<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PC2&gt; ping 10.1.1.101\n84 bytes from 10.1.1.101 icmp_seq=1 ttl=64 time=0.579 ms\n84 bytes from 10.1.1.101 icmp_seq=2 ttl=64 time=1.089 ms\n84 bytes from 10.1.1.101 icmp_seq=3 ttl=64 time=1.104 ms\n84 bytes from 10.1.1.101 icmp_seq=4 ttl=64 time=0.844 ms\n84 bytes from 10.1.1.101 icmp_seq=5 ttl=64 time=0.957 ms<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>PC2&gt; ping 10.1.1.1\n\n84 bytes from 10.1.1.1 icmp_seq=1 ttl=255 time=60.355 ms\n84 bytes from 10.1.1.1 icmp_seq=2 ttl=255 time=16.283 ms\n84 bytes from 10.1.1.1 icmp_seq=3 ttl=255 time=5.571 ms\n^C\nPC2&gt; ping 1.1.1.1\n\n84 bytes from 1.1.1.1 icmp_seq=1 ttl=50 time=25.608 ms\n84 bytes from 1.1.1.1 icmp_seq=2 ttl=50 time=16.361 ms\n84 bytes from 1.1.1.1 icmp_seq=3 ttl=50 time=15.478 ms\n^C\nPC2&gt;\n<\/code><\/pre>\n\n\n\n<p>Finally, we may assign an IP address to the bridge to access or test connectivity from the Mikrotik.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;admin@MikroTik] &gt; ip address\n&#91;admin@MikroTik] \/ip\/address&gt; add address=10.1.1.2\/24 interface=main network=10.1.1.0<\/code><\/pre>\n\n\n\n<p>where ping works now<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;admin@MikroTik] \/ip\/address&gt; \/ping 10.1.1.1\n  SEQ HOST                                     SIZE TTL TIME       STATUS\n    0 10.1.1.1                                   56 255 92ms971us\n    1 10.1.1.1                                   56 255 14ms356us\n    2 10.1.1.1                                   56 255 11ms668us\n    3 10.1.1.1                                   56 255 4ms973us\n    4 10.1.1.1                                   56 255 3ms15us\n    sent=5 received=5 packet-loss=0% min-rtt=3ms15us avg-rtt=25ms396us\n   max-rtt=92ms971us<\/code><\/pre>\n\n\n\n<p>As the bridge is doing what bridge must, it learns MAC addresses and bridge\/switch frames, we may see its bridging table<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;admin@MikroTik] &gt; <strong>interface bridge host print where bridge=main<\/strong>\nFlags: D - DYNAMIC; L - LOCAL\nColumns: MAC-ADDRESS, VID, ON-INTERFACE, BRIDGE\n#    MAC-ADDRESS        VID  ON-INTERFACE  BRIDGE\n4 DL 0C:CC:C9:B0:00:00       main          main\n5 D  00:50:79:66:68:00    1  ether2        main\n6 D  00:50:79:66:68:01    1  ether3        main\n7 DL 0C:CC:C9:B0:00:00    1  main          main\n8 D  CA:01:37:1A:00:06    1  ether1        main\n<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>In this article, as the RouterOS CLI newbie, I will set up a simple LAN network consisting of two PCs, one Mikrotik box that acts as a simple L2 LAN switch, and one Cisco router that connects everything to the internet using NAT. All four devices are in the same broadcast domain and have IP&#8230;<\/p>","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[747,1502],"tags":[],"class_list":["post-6453","post","type-post","status-publish","format-standard","hentry","category-practical_-_cisco-en","category-prcatical-mikrotik"],"taxonomy_info":{"category":[{"value":747,"label":"Practical - Cisco"},{"value":1502,"label":"Practical \u2013 Mikrotik"}]},"featured_image_src_large":false,"author_info":{"display_name":"palo73","author_link":"https:\/\/nil.uniza.sk\/en\/author\/palo73\/"},"comment_info":16,"category_info":[{"term_id":747,"name":"Practical - Cisco","slug":"practical_-_cisco-en","term_group":0,"term_taxonomy_id":745,"taxonomy":"category","description":"","parent":0,"count":17,"filter":"raw","cat_ID":747,"category_count":17,"category_description":"","cat_name":"Practical - Cisco","category_nicename":"practical_-_cisco-en","category_parent":0},{"term_id":1502,"name":"Practical \u2013 Mikrotik","slug":"prcatical-mikrotik","term_group":0,"term_taxonomy_id":1500,"taxonomy":"category","description":"","parent":0,"count":2,"filter":"raw","cat_ID":1502,"category_count":2,"category_description":"","cat_name":"Practical \u2013 Mikrotik","category_nicename":"prcatical-mikrotik","category_parent":0}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/6453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/comments?post=6453"}],"version-history":[{"count":0,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/6453\/revisions"}],"wp:attachment":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/media?parent=6453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/categories?post=6453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/tags?post=6453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}