Friday, December 31, 2010

Virtualization using (A)QEMU - Tun/Tap configuration


Written By James Ravenscroft



Over the last couple of years, I have used both VirtualBox and VMWare server under Linux, but have not been fully satisfied with either one. I have had problems with VirtualBox or a guest OS intermittently crashing and guest OS video display issues. VMWare’s web interface is cumbersome and problematic. Its web service dies inexplicably and I have found myself having to completely reinstall VMWare server after upgrading my kernel.

I decided recently to try AQEMU, a GUI front end to QEMU (and KVM) to set up a simple lab where I can load virtual machines and have them all be on the same network segment as the host machine. I quickly found that in order to do this, you need to enable bridging and then create virtual ethernet “tun/tap” interfaces for each of your guest OS to use. Unfortunately, this was not straightforward and required some searching and package installation/configuration. A synopsis of the steps using Ubuntu 10.4 is below.

1) Check to make sure all necessary packages are installed and install missing packages. The packages you need are AQEMU, bridge-utils and uml-utlilities. These can all be installed by issuing the following command in a terminal window (with a space between each of the package names) which will download and install all necessary packages:

$sudo apt-get install aqemu bridge-utils uml-utilities

2) Check for /dev/net/tun and if not present, load tun using

$sudo /sbin/modprobe tun

3) Add qemusers group and add your user account to the group (so that qemu will not run as root)

$sudo addgroup qemusers
$sudo adduser <user> qemusers


4) Edit /etc/rc.local to make /dev/net/tun usable for the qemusers group per bold text below. Ownership of tun reverts back to root when you reboot and this corrects ownership so that you will be able to use tun.  I like using the Gedit text editor:

$sudo gedit /etc/rc.local

==================

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.


# Set permissions of tun device
chown root.qemusers /dev/net/tun
chmod g+rw /dev/net/tun

exit 0
==================

5) Edit /etc/network/interfaces to set up the bridge, create tap interfaces and join eth0 and all the tap interfaces to be used by your virtual machines to the bridge. An example of this is below; this creates and initializes 3 tap interfaces, a bridge (with static IP) and joins eth0 and tap0-2 to the bridge. The tunctl_user  listed should be a valid user that is also a member of the qemusers group (step 3 above). You will want to initialize as many tap interfaces as the maximum number of virtual machines that you will want to run at any given time. Alternatively, you could just include the information to set up the bridge (and add eth0 to it) only and create scripts to initialize tap interfaces and join them to the bridge as needed:

$sudo gedit /etc/network/interfaces==================

auto lo
iface lo inet loopback

iface eth0 inet manual

auto tap0 tap1 tap2
iface tap0 inet manual
tunctl_user <user>
iface tap1 inet manual
tunctl_user <user>
iface tap2 inet manual
tunctl_user <user>

auto br0
iface br0 inet static
bridge_ports eth0 tap0 tap1 tap2
bridge_maxwait 0
address 192.168.1.60
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1


All that’s left is to reboot and configure your guests, which I’ll show in my next post. Have a safe and Happy New Year!

Useful links:

Linux bridging: http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge
Tun/Tap Wiki:http://en.wikipedia.org/wiki/TUN/TAP
QEMU Wiki:http://en.wikipedia.org/wiki/QEMU
QEMU bridge/interface configuration:
http://wiki.freaks-unidos.net/qemu-debian
http://compsoc.dur.ac.uk/~djw/qemu.html
http://www.thomaskho.com/blog/2006/02/qemu-and-the-network-bridge/
AQEMU: http://sourceforge.net/projects/aqemu/

Thursday, December 16, 2010

Apple Releases iTunes 10.1.1; Causes Crashes?



Yesterday, Apple updated iTunes to version 10.1.1 to address bugs and may have caused some in the process. There have been multiple reports of iTunes not launching after the update.  It is not clear if the affected users have made any modifications to iTunes such as the hacks to restore the color scheme and minimize buttons to their previous appearance. You may want to wait this update out for a few days until more information is available on this issue.

iTunes 10.1.1 is said to address the following issues:


  • Addresses an issue where some music videos may not play on Macs equipped with NVIDIA GeForce 9400 or 9600 graphics. 

  • Resolves an issue where iTunes may unexpectedly quit when deleting a playlist that has the iTunes Sidebar showing. 

  • Fixes a problem where iTunes may unexpectedly quit when connecting an iPod to a Mac equipped with a PowerPC processor. 

  • Addresses an issue where some music videos may not sync to an iPod, iPhone, or iPad. 

Apple's Mac App Store Launches January 6th



Apple announced their controversial Mac App Store will go live January 6th. The new store is designed to give Mac users a "one stop shop" for all their Mac applications.  This is similar to Apple's iOS App Store with the exception users can still install software from other sources.  For their efforts, Apple is retaining 30% of all revenue from the store.

Wednesday, December 15, 2010

Adam's Edge: An In Depth Look At Running FreeNAS On An Acer EasyStore H340


Why FreeNAS?  Why not Windows Home Server?  I decided to use FreeNAS over WHS because I wanted something that was extremely light weight and did not have to be installed on any of my 4 storage drives.  FreeNAS is versatile in the sense that I can install it on a thumb drive, configure, backup the config, load FreeNAS onto another thumb drive, restore my saved config and I'm back online.  In the event that my host "drive" fails, I'll have my config backed up so I can easily load FreeNAS onto another usb media device, boot up, load my config and I am in business.  If I were using WHS loaded onto one of my storage drives, if that drive failed, I'd lose my OS as well as any data that is not redundant or backed up.


Tuesday, December 14, 2010

Chinese Knock-Off Manufacturer Makes iPad 2 in 1 Camera Connection Kit



File this under "Why didn't Apple design the iPad Camera Connection Kit like this"?  A Chinese knock-off manufacturer has created an unofficial camera connector that combines both USB and SD card slots. The adapter sells for about $26 (US).

Thursday, December 9, 2010

OS X Error 0 While Copying Files




If you receive an error 0 while copying files to an external hard drive in OS X, the issue is most likely due to the file format of the drive.  Most external hard drives are pre-formated as FAT32 which cannot handle files 4GB or larger.

CAUTION: Any data on the drive will be lost during this process. Remember to backup your data first!!!

To reformat the drive, launch Disk Utility and click on your external drive on the left hand side.  In the Format Tab, select Mac OS Extended (Journaled) and name the drive if you like. Now click erase and your drive will be ready.

Sunday, December 5, 2010

Solved - Shuttle SN25P Gigabit NIC Issue

Ever since I bought my Shuttle SN25P computer years ago, I have not been successful with gigabit in Windows. Apparently nVidia has (or had) poor driver support in regards to it's nForce chipset.

Whenever I would attempt to utilize my gigabit connection to its full potential, I would immediately get notified by Windows that my network cable was unplugged. It would then reinitialize, and go out. This was identified as suspend/resume.

If I would switch to 10/100, I would have no problems. As soon as I connect a 1GBPS, any heavy network traffic would cause my NIC to flatline.

Last night I started researching this again, to see if maybe there were any breakthroughs or new drivers. I did find a driver from 2008. After updating the driver for the NVIDIA Network Bus Enumerator then NVIDIA nForce 10/100/1000 Mbps Ethernet, my gigabit connection was still having problems. I had remember reading to disable Checksum Offload through device manager. Upon doing so, I attempted to upload to my FreeNAS machine.

This was it! I had 0 problems and I was able to sustain 340 Mbps uploading with my NIC!

SO, if you have a Shuttle SN25P (or any other nForce chipset/NIC), try updating your drivers and disabling Checksum Offload. Maybe it'll bring you to the 21st century with reliable 1 Gbps speeds.


Saturday, December 4, 2010

Must Have Software For OS X

Let's face it, there are some great software titles on the Mac.  Below are some of my favorites.  Please feel free to add your own to the list.