Tuesday, August 23, 2011

Installing Tinycore linux in virtualbox for GNS3 IPv6

The 0.8.1 GNS3 release now easily supports virtualbox hosts, and Tinycore linux is a nice easy way to add hosts to your topologies without consuming hefty amounts of memory and CPU.  First, download it from the tinycore linux downloads site  Then create a vm in virtualbox with at least 64 meg of memory, and a gig or  two of drive space (I created it as linux other, since there wasn't a tiny core linux type).  Set that vm to boot from the iso downloaded from tinycore linux earlier.  Then boot it.  It should come up quickly.  The follow steps will install a bootable tinycore on the VM's drive:

  • Go to the app browser (click anywhere on the desktop and select it from the 'system tools' menu) click the "Connect" button to get a list and search for cfdisk.  Click the "go" button to download and install it.
  • Then search the app browser for grub, and download/install grub-0.97-splash.tcz
  •  Then open a terminal (click anywhere on the desktop and select it from the 'system tools' menu)
  • enter "sudo su" to get to root.  The prompt should be "root@box"
  • type "cfdisk /dev/hda" to make a new partition.  Select 'new', and 'bootable', then 'write'.  After that, quit
  • type "mkfs.ext3 /dev/hda1" to put a filesystem on the new partition
  • type "reuildfstab" so its available to mount.
  • type "mount /dev/hda1" to mount it.

The bootable parts are either in /dev/hdb or /dev/hdc.  Try mounting either with "mount /dev/hdb" or "mount /dev/hdc".  Then look in /mnt/hdb and/or /mnt/hdc for a boot directory that has a file named "bzImage"  We'll assume its in /dev/hdb for now.  Continuing on:

  • Type “mkdir -p /mnt/hda1/boot”, then type “mkdir -p /mnt/hda1/boot/grub”
  •  Type “mkdir –p /mnt/hda1/tce”
  •  Type “touch /mnt/hda1/tce/mydata.tgz”
  • Type “cp -p /usr/lib/grub/i386-pc/* /mnt/hda1/boot/grub/”
  •  Type “vi /mnt/hda1/boot/grub/menu.lst”, type “i” to enter Interactive mode, then type:
default 0
timeout 5
title tinycore
kernel /boot/bzImage quiet
initrd /boot/tinycore.gz
  • Press <Esc> then type “:x” to save and exit vi
  • Type “grub”  once at the grub> prompt, type:
root (hd0,0)
setup (hd0)
  • Type "cp /mnt/hdb/boot/bzImage  /mnt/hda1/boot/"
  • Type "cp /mnt/hdb/boot/tinycore.gz /mnt/hda1/boot/"
  • Type “umount /mnt/hda”
  • shutdown, and remove the tinycore iso from the VM's storage devices.
  • Start the VM.

If you want IPv6, go to the app browser, and search for IPv6.  Download/install ipv6- and ipv6-  Reboot, open a terminal and enter the command "ifconfig", if you see an IPv6 address, you're now able to communicate via IPv6.  Try ping6 to hit an IPv6 address you know will respond.  There are tons of other goodies like firefox (did I say 64M of RAM above? Oops), dillo, traceroute, openssh, tftp, nmap, ethtool, tcpdump, web servers like lighthttp, - the list goes on and on.  One thing I haven't done is figure out the virtualbox guest extensions for tinycore, and so mouse focus is a bit dodgy, although far from unworkable.

Friday, August 5, 2011

Building QEMU for GNS3 under OSX

I have GNS.74 and wanted to run qemu to put hosts on network simulations.  I found I had to maunally start qemuwrapper with:

python /Applications/GNS3.app/Contents/Resources/qemuwrapper.py

Which initially worked - I could add qemu hosts (with the 3.4 qemu images from gns3.net), start them, and get a qemu console.  However, I found that once I added a router to the topology, I could not start or restart qemu hosts - a qemu console window would just appear and vanish too quickly to see anything.  GNS3, conveniently, logs little to nothing.  Up to this point, I had installed qemu 0.14.1 via brew, so I uninstalled it.  Then I set out to build qemu with the UDP Multicast patch. I downloaded qemu-0.13, downloaded the udp-multicast patch, and patched the multicast patch file after putting it in the untarred/ungzipped qemu directory:

patch -p1 -i qemu-0.13.0-mcast-udp.patch

Then configged it:

./configure --disable-kvm --enable-cocoa --disable-sdl --target-list=i386-softmmu

then just make, sudo make install (okay I did sudo make -n install to see what make would do first)

I also got an IPv6 qemu image so I could do IPv6.  This is a 4shared.com link, so it may die of old age in future.  As of this post, (Aug 5, 2011) it worked.

That did the trick.  Qemuwrapper still has to be manually started, but now qemu hosts start up right alongside routers in a topology.