{"id":174,"date":"2015-06-22T17:46:11","date_gmt":"2015-06-22T17:46:11","guid":{"rendered":"http:\/\/www.balajibandi.com\/blog\/?p=174"},"modified":"2017-02-05T17:55:45","modified_gmt":"2017-02-05T17:55:45","slug":"using-a-linux-host-via-qemu-in-gns3","status":"publish","type":"post","link":"https:\/\/www.balajibandi.com\/?p=174","title":{"rendered":"Using a Linux host via qemu in GNS3"},"content":{"rendered":"<div class=\"article-content entry-content\">So, lately I&#8217;ve been studying for the CCNA exam, which is probably 15 years overdue. \u00a0Part of the exam is running commands on a router or switch. \u00a0Unless you happen to have access to a rack full of Cisco gear you can change at will you&#8217;ll need a simulator. \u00a0GNS3 is just that &#8211; a simulator that lets you set up virtual switches and routers and &#8220;connect&#8221; them virtually. \u00a0It works great!GNS3 also has a built-in QEMU module so you can add virtual hosts to your pretend network. \u00a0That means you can start a web server on one end and a client on the other and actually connect them. \u00a0Or whatever you want really.<\/p>\n<p>But you have enough to do without learning QEMU right? \u00a0So here&#8217;s a quick guide to integrating Damn Small Linux into GNS3. \u00a0I&#8217;m using Windows 7 64bit as my workstation.<\/p>\n<p><b>DSL &#8211; Damn Small Linux.<\/b><br \/>\nI chose this distribution because it&#8217;s tiny, starts quicky and uses very little memory. \u00a0You can start up a DSL virtual instance in 128m of RAM. \u00a0Here are the tricks I used to get it working.<\/p>\n<p><b>Versions used.<\/b><br \/>\nGNS3 0.7.4 &#8211; Ships with QEMU<br \/>\nDamn Small Linux &#8211; 4.4.10 32bit ISO<\/p>\n<p>First obtain the DSL ISO image. \u00a0I downloaded it and placed it directly into the GNS3 program folder in Windows 7, which is located in\u00a0C:\\Program Files (x86)\\GNS3<\/p>\n<p>Start a windows CMD prompt and CD to the GNS3 directory.<\/p>\n<p><b>C:\\Program Files (x86)\\GNS3<\/b><\/p>\n<p>Now create a QEMU virtual disk. \u00a0This will contain your DSL instance.<\/p>\n<p><b>C:\\&gt;\u00a0qemu-img\u00a0create\u00a0dsl 1G<\/b><\/p>\n<p>This creates an 1GB &#8220;container&#8221;. \u00a0You can probably make it smaller, or bigger. \u00a0It can be grown dynamically anyway if you need more space.<\/p>\n<p>Now boot Damn Small Linux from QEMU in the command line.<\/p>\n<p><b>C:\\Program Files (x86)\\GNS3&gt;\u00a0<\/b><em><tt>qemu\u00a0-hda dsl -cdrom\u00a0dsl-4.4.10.iso\u00a0-m\u00a0256 -boot\u00a0d<\/tt><\/em><br \/>\n<em><tt><br \/>\n<\/tt><\/em>&gt; -hda dsl: indicates the &#8220;dsl&#8221; partition you made will be in the &#8220;hda&#8221; physical partition.<br \/>\n<i>&gt; <\/i>a &#8211; cdrom dsl-4.4.10.iso: indicates that the ISO image will be used as your CDROM.<br \/>\n&gt; -m 256: Use 256m of RAM<br \/>\n&gt; -boot d : indicated D drive is the boot drive.<\/p>\n<p>DSL should now spin up. \u00a0Just follow the prompts. \u00a0Eventually the desktop will come up. \u00a0Right click on the desktop and navigate to Apps \/ Tools \/ Install to Hard Drive.<\/p>\n<p>A script will launch. \u00a0Enter these params at the prompts.<\/p>\n<p>Target partition: hda<br \/>\nSupport multii-user? \u00a0Sure, why not. \u00a0Enter &#8216;y&#8217;<br \/>\nUse ext3 filesystem? \u00a0y<br \/>\nLast chance? y<\/p>\n<p>It will warn you that hda is the entire drive and not a partition. \u00a0That&#8217;s OK, confirm it.<\/p>\n<p>Now DSL will install itself into your virtual disk. \u00a0Neat! \u00a0Wait awhile and DSL will ask you if you want a bootloader. \u00a0<b>Confirm Yes and when prompted &#8211; chose LILO by entering &#8216;l&#8217; (lowercase L).<\/b> \u00a0This is important, GRUB will not work.<\/p>\n<p>Eventually DSL will try to reboot. \u00a0It will fail, because it can only be launched by QEMU. \u00a0DSL doesn&#8217;t know it&#8217;s a virtual instance it thinks it&#8217;s on real hardware. \u00a0What it doesn&#8217;t know won&#8217;t hurt it.<\/p>\n<p>Now, your DSL should be fully installed. \u00a0Back in the DOS prompt you should be able to launch it with this command.<\/p>\n<p><b>C:\\Program Files (x86)\\GNS3&gt;\u00a0<\/b><em><tt>qemu\u00a0-hda dsl -m 256<\/tt><\/em><br \/>\n<em><tt><br \/>\n<\/tt><\/em>You can use any amount of RAM you want, I think 256 is safe though.<i><br \/>\n<\/i><\/p>\n<p>Now, let&#8217;s configure GNS3 to launch your desktops by itself.<\/p>\n<p>Launch GNS3 and go to Edit \/ Preferences \/ Qemu section. \u00a0Most of the info will be filled in for you.<\/p>\n<p>Click on the Qemu Host tab. \u00a0Create a new instance for DSL:<\/p>\n<p>Identifier name: Name it whatever, I called it &#8220;DSL-1&#8221;<br \/>\nBinary image: It took me a long time to figure this one out. \u00a0Where does Qemu store its virtual disks??? I finally found them after searching the hard drive. \u00a0Click the &#8220;&#8230;&#8221; button and browse to:<br \/>\n<b>C:\\Users\\\\AppData\\Local\\VirtualStore\\Program Files (x86)\\GNS3\\<\/b> &#8211; your Qemu instances should be in here.<br \/>\nRAM: 256 (or whatever)<br \/>\nNumber of NICs: How many do you want? \u00a0They&#8217;re free! \u00a0I left it at 6.<\/p>\n<p>Pick the rest if it&#8217;s important to you, or leave it at defaults and hit Save. \u00a0Now, test your Qemu settings on the General Settings tab. \u00a0If everything is working, when you launch a Host then a DSL virtual desktop should automatically pop up!<\/p>\n<div class=\"separator\"><a href=\"http:\/\/1.bp.blogspot.com\/-GGM701EoKm8\/T2oMG1PaOLI\/AAAAAAAAENk\/z0yEMFIWZJk\/s1600\/demo.png\"><img decoding=\"async\" src=\"http:\/\/1.bp.blogspot.com\/-GGM701EoKm8\/T2oMG1PaOLI\/AAAAAAAAENk\/z0yEMFIWZJk\/s1600\/demo.png\" alt=\"\" border=\"0\" \/><\/a><\/div>\n<\/div>\n<div class=\"article-footer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>So, lately I&#8217;ve been studying for the CCNA exam, which is probably 15 years overdue. \u00a0Part of the exam is running commands on a router or switch. \u00a0Unless you happen to have access to a rack full of Cisco gear you can change at will you&#8217;ll need a simulator. \u00a0GNS3 is just that &#8211; a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,7],"tags":[],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-gns","category-linux"],"_links":{"self":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=174"}],"version-history":[{"count":3,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":520,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/174\/revisions\/520"}],"wp:attachment":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}