{"id":612,"date":"2014-04-11T12:36:16","date_gmt":"2014-04-11T10:36:16","guid":{"rendered":""},"modified":"2018-11-01T00:01:38","modified_gmt":"2018-10-31T23:01:38","slug":"connecting-dynamipsdynagen-router-real-network-linux","status":"publish","type":"post","link":"https:\/\/nil.uniza.sk\/en\/connecting-dynamipsdynagen-router-real-network-linux\/","title":{"rendered":"Connecting Dynamips\/Dynagen router with a real network &#8211; in linux"},"content":{"rendered":"<p>\n\tDynamips\/Dynagen supports the interconnection of dynamips router interfaces with a real, in my case <span class=\"postbody\">ethernet, network cards.&nbsp; In this case I&#39;m focusing on linux OSs. Within the article &quot;<a href=\"https:\/\/nil.uniza.sk\/en\/virtualization\/virtualbox\/connecting-gns3-virtualbox-host\/\">Connecting GNS3 with a VirtualBox host<\/a><\/span>&quot; I&#39;m describing how to do that for GNS3 and Windows 7 environment.<\/p>\n<h1>\n\tPrerequisities<\/h1>\n<ol>\n<li>\n\t\tInstalled PC\/Server with working linux OS (debian Wheezy in my case)<\/li>\n<li>\n\t\tDynamips\/dynagen ready environment with correctly working IOS image (which allow us create a network topology), for example c2691-advipservicesk9-mz.124-15.T13.bin.unp<\/li>\n<li>\n\t\tnetwork card connected to a real network with working connectivity<\/li>\n<\/ol>\n<h1>\n\tProcedures<\/h1>\n<p>\n\tFirst, list the real adapters names and connection states within your linux<\/p>\n<pre>\r\n<strong><span style=\"background-color:#ffff00;\">ip -<\/span><\/strong><span style=\"background-color:#ffff00;\">link<\/span>\r\n1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT\r\n    link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\r\n2: <strong><span style=\"color:#ff0000;\">eth0:<\/span><\/strong> &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000\r\n    link\/ether 00:1d:09:f2:7c:47 brd ff:ff:ff:ff:ff:ff\r\n3: eth1: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000\r\n    link\/ether 00:1d:09:f2:7c:49 brd ff:ff:ff:ff:ff:ff<\/pre>\n<p>\n\tas we see, the eth0 interface is up.<\/p>\n<p>\n\tThen we interconnect virtual router interface with working card adapter. Dynamips tutorial is saying (I&#39;m not sure if the original site <a href=\"http:\/\/www.dynagen.org\/tutorial.htm\">http:\/\/www.dynagen.org\/tutorial.htm <\/a>is just temporary off or not, so here is <a href=\"http:\/\/www.kis.fri.uniza.sk\/~palo\/Rozne\/DynamipsTutorial\/Dynamips%20_%20Dynagen%20Tutorial.pdf\">the copy of original tutorial<\/a>):<\/p>\n<blockquote>\n<p>\n\t\t<em>Dynamips can bridge virtual router interfaces real host interfaces, allowing your virtual network to communicate with the real world. On Linux systems, this is done with the NIO_linux_eth NIO descriptor. For example:<\/em><\/p>\n<p>\n\t\t<strong><em>f0\/0 = NIO_linux_eth:eth0<\/em><\/strong><\/p>\n<p>\n\t\t<em>this bridges this router&rsquo;s F0\/0 interface to the eth0 interface on the host. Packets that exit f0\/0 are dumped out on to the real network through eth0, and return packets are forwarded back to the virtual router instance accordingly. <\/em><\/p>\n<\/blockquote>\n<p>\n\t&nbsp;<\/p>\n<p>\n\tSo, let create a simple dynamips topo with just one router to demonstrate:<\/p>\n<pre>\r\nautostart = False\r\n\r\n[localhost:30000]\r\n\r\n        workingdir = \/home\/segi\/IS\/mcast\/Work\r\n        udp = 30000\r\n\r\n        [[2691]]\r\n                ram = 128\r\n                image = \/Topologies\/IOSes\/c2691-advipservicesk9-mz.124-12.bin.unp\r\n                ghostios = True\r\n                sparsemem = True\r\n                slot1 = NM-4T\r\n                confreg = 0x2102\r\n                idlepc = 0x60a29810\r\n\r\n        [[ROUTER R1]]\r\n                model = 2691\r\n                console = 3000\r\n                # Connect f0\/0 interface with my eth1 adapter\r\n<strong><span style=\"background-color:#ffff00;\">                f0\/0 = NIO_linux_eth:eth0<\/span><\/strong>\r\n<\/pre>\n<p>\n\tNow start the topo as the root (see the note at the bottom of the page)<\/p>\n<pre>\r\nCisco Router Simulation Platform (version 0.2.11-amd64\/Linux stable)\r\nCopyright (c) 2005-2011 Christophe Fillot.\r\nBuild date: Mar&nbsp; 5 2014 07:22:36\r\n\r\nLocal UUID: ace2bfea-68f3-4a9c-a841-758409ca92e6\r\n\r\nHypervisor TCP control server started (port 30000).\r\nReading configuration file...\r\n\r\nShutdown in progress...\r\nShutdown completed.\r\nNetwork successfully loaded\r\n\r\nDynagen management console for Dynamips and Pemuwrapper 0.11.0\r\nCopyright (c) 2005-2007 Greg Anuzelli, contributions Pavel Skovajsa\r\n=&gt;\r\n<\/pre>\n<p>\n\tand start the R1 router within dynagen with <em>start R1 <\/em>command<\/p>\n<pre>\r\n=&gt; <strong><span style=\"background-color:#ffff00;\">start R1<\/span><\/strong>\r\nCPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.\r\nNVRAM is empty, setting config register to 0x2142\r\nC2691 instance &#39;R1&#39; (id 0):\r\n  VM Status  : 0\r\n  RAM size   : 128 Mb\r\n  NVRAM size : 112 Kb\r\n  IOS image  : \/Topologies\/IOSes\/c2691-advipservicesk9-mz.124-12.bin.unp\r\n\r\nLoading ELF file &#39;\/Topologies\/IOSes\/c2691-advipservicesk9-mz.124-12.bin.unp&#39;...\r\nELF entry point: 0x80008000\r\n\r\nC2691 &#39;R1&#39;: starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.\r\n100-VM &#39;R1&#39; started\r\n=&gt; list\r\nName       Type       State      Server          Console\r\nR1         2691       <span style=\"background-color:#ffff00;\">running    <\/span>localhost:30000 3000<\/pre>\n<p>\n\tNow we are able to connect to the R1 (<em>telnet localhost 3000<\/em> in my case) and configure router fastEthernet interface with static or dynamic IP address<\/p>\n<pre>\r\nRouter&gt;ena\r\nRouter#conf t\r\nEnter configuration commands, one per line.  End with CNTL\/Z.\r\nRouter(config)#int fa 0\/0\r\nRouter(config-if)#no sh\r\nRouter(config-if)#<strong><span style=\"background-color:#ffff00;\">ip address dhcp<\/span><\/strong>\r\n*Mar&nbsp; 1 00:02:08.723: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0\/0 assigned DHCP address 158.193.152.59, mask 255.255.255.0, hostname Router\r\nRouter(config-if)#<strong><span style=\"background-color:#ffff00;\">do sh ip int brief<\/span><\/strong>\r\nInterface                  IP-Address      OK? Method Status                Protocol\r\nFastEthernet0\/0            158.193.152.59  YES DHCP   up                    up\r\nFastEthernet0\/1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unassigned&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; YES unset&nbsp; administratively down down\r\nSerial1\/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unassigned&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; YES unset&nbsp; administratively down down\r\nSerial1\/1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unassigned&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; YES unset&nbsp; administratively down down\r\nSerial1\/2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unassigned&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; YES unset&nbsp; administratively down down\r\nSerial1\/3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unassigned&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; YES unset&nbsp; administratively down down\r\n<\/pre>\n<p>\n\tand finally we check connectivity pinging some real IP address within a real network, in my case<\/p>\n<pre>\r\nping 158.193.152.2\r\n\r\nType escape sequence to abort.\r\nSending 5, 100-byte ICMP Echos to 158.193.152.2, timeout is 2 seconds:\r\n!!!!!\r\nSuccess rate is 100 percent (5\/5), round-trip min\/avg\/max = 4\/8\/16 ms\r\n<\/pre>\n<p>\n\tWorking.<\/p>\n<p>\n\t<strong>Note:<\/strong><\/p>\n<p>\n\t1) If the dynagen \/dynamips return following message<\/p>\n<pre>\r\neth_init_socket: socket: Operation not permitted\r\n*** Warning:  Connecting R1 f0\/0 to NIO_linux_eth:eth1 resulted in:\r\n        206-unable to create Linux raw ethernet NIO<\/pre>\n<p>\n\tCheck your linux permissions under which you are running Dynagen, because using <em>gen_eth <\/em>and <em>linux_eth <\/em>NIO you must run the dynamips process with the &quot;root&quot; account.<\/p>\n<p>\n\t&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>\n\tDynamips\/Dynagen supports the interconnection of dynamips router interfaces with a real, in my case <span class=\"postbody\">ethernet, network cards.&nbsp; In this case I&#39;m focusing on linux OSs. Within the article &quot;<a href=\"https:\/\/nil-test.kis.fri.uniza.sk\/virtualization\/virtualbox\/connecting-gns3-virtualbox-host\">Connecting GNS3 with a VirtualBox host<\/a><\/span>&quot; I&#39;m describing how to do that for GNS3 and Windows 7 environment.<\/p>","protected":false},"author":7,"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":[685],"tags":[],"class_list":["post-612","post","type-post","status-publish","format-standard","hentry","category-linux_-_howto-en"],"taxonomy_info":{"category":[{"value":685,"label":"Linux - HOWTO"}]},"featured_image_src_large":false,"author_info":{"display_name":"admin","author_link":"https:\/\/nil.uniza.sk\/en\/author\/admin\/"},"comment_info":9,"category_info":[{"term_id":685,"name":"Linux - HOWTO","slug":"linux_-_howto-en","term_group":0,"term_taxonomy_id":683,"taxonomy":"category","description":"","parent":0,"count":71,"filter":"raw","cat_ID":685,"category_count":71,"category_description":"","cat_name":"Linux - HOWTO","category_nicename":"linux_-_howto-en","category_parent":0}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/612","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\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/comments?post=612"}],"version-history":[{"count":0,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/612\/revisions"}],"wp:attachment":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/media?parent=612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/categories?post=612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/tags?post=612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}