VirtualBox

This is just a page for documenting some tricks I discovered while playing with VirtualBox.

Installing

Just download it from their site www.virtualbox.org and install it like this

dpkg -i name_of_the_downloaded_file.deb

Then start VirtualBox and install the guests. Instead of using a CDROM for installing guests, you can also use an ISO file as CDROM. This is faster.

VirtualBox comes with some kernel modules which need to be recompiled each time the kernel is upgraded. So if you upgrade the kernel, use this command to recompile the VirtualBox modules:

/etc/init.d/vboxdrv setup

VirtualBox works best with the "guest additions" installed. After installing the guest, start it up and use the option in the menu bar to install the guest additions.

Screen size

The graphics drivers of VirtualBox allow you to adjust the guest's screen size to the window size automatically. In KDE and Windows you can also set the screen size the same way you normally do. However in KDE I could not set the screen size to 1280x1024. If you would like to get certain fixed screen resolutions in a Ubuntu guest, add the following to the screen section of your /etc/X11/xorg.conf:

SubSection "Display"
Modes "1280x1024" "1152x864" "1024x768" "800x600"
EndSubSection

Cloning

You can copy a hard disk image of a virtual machine, by using this command to copy it:

VBoxManage clonevdi `pwd`/source.vdi `pwd`/dest.vdi

Note that absolute paths are required, hence the pwd commands.

The new vdi gets a unique (different) UUID. You can add the new image in the "virtual media manager", and create a new virtual machine which uses it.

When you cloned an Ubuntu guest, you may want to remove a file called /etc/udev/rules.d/70-persistent-net.rules in order to clear data about the old MAC address. Otherwise your new network card appears as eth1 instead of eth0.

Networking

By default Virtualbox uses a kind of NAT with a built-in DHCP server for the guests. I used "a kind of", because all guests actually use the same IP address. They cannot see each other and it is impossible to setup an incoming connection. You can access the host using 10.0.2.2. Instead of NAT you can also use "internal network". Now the guests can see each other, but they cannot access the outside world. Then there is "bridged networking" in which you can share the host interface. Disadvantage of that is the fact that the guest's IP-addresses are visible for the outside world. If you want NAT while keeping the ability to route incoming connections and the ability to communicate between guests, then use the following approach.

First install the software needed to create and setup tap interfaces:

aptitude install uml-utilities

Then create a script called tap to setup a tap interface:

#!/bin/sh

sysctl -w net.ipv4.conf.eth0.arp_ignore=1
sysctl -w net.ipv4.ip_forward=1
tunctl -t tap0 -u your_username
ifconfig tap0 192.168.1.1 netmask 255.255.255.0 up

exit 0

The first line prevents the host from responding to ARP requests which query IP addresses that happen to be used for internal networking. The second line enables routing. You can also put the sysctl settings in a file called /etc/sysctl.conf. The third line creates the tap interface. Replace your_username by your username. The fourth line sets up the tap interface.

Now we can setup NAT, using another script, called nat:

#!/bin/sh

iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT
iptables -P FORWARD DROP
iptables -F FORWARD
iptables -t nat -F

iptables -A FORWARD -i eth0 -o tap0 -m state --state ESTABLISHED,RELATED  -j ACCEPT
iptables -A FORWARD -i tap0 -o eth0 -j ACCEPT
iptables -A FORWARD -j LOG
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --dport 53 -i tap0 -j DNAT --to your_dns_server:53
iptables -t nat -A PREROUTING -p udp --dport 53 -i tap0 -j DNAT --to your_dns_server:53

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 5800 -j DNAT \
   --to 192.168.1.100:5800
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 5900 -j DNAT \
   --to 192.168.1.100:5900
iptables -A FORWARD -i eth0 -o tap0 -p tcp --dport 5800 -j ACCEPT
iptables -A FORWARD -i eth0 -o tap0 -p tcp --dport 5900 -j ACCEPT

exit 0

Replace your_dns_server by the IP address of your DNS server.

You may notice we forward ports 5800 and 5900. This is explained later, when we set up a remote desktop using a web browser.

In the VirtualBox network settings of your guest, use bridged network, and specify tap0 as its interface.

Start and setup the guest to use 192.168.1.100 as IP address and 192.168.1.1 as default gateway and DNS server (the latter being forwarded to the real DNS server).

Remote controlling your guests

You can SSH into your linux box and use the following command to startup a guest remotely:

VBoxManage startvm your_guest_name --type vrdp

Use VBoxManage (without arguments) to see what you can do on the command line.

Remote desktop using a web browser

You may have noticed that VirtualBox has a built-in RDP server, which you can enable and this works very well with the rdesktop client.

By default only one client can connect to the built-in RDP server at a given time. To allow simultaneous connections, use this command:

VBoxManage modifyvm "VM name" --vrdpmulticon on

You can also use the built-in RDP-server some guests (like Windows XP) provide. In that case you need to forward port 3389 in the same way we forwarded ports 5800 and 5900 earlier. The reason for forwarding 5800 and 5900 is the fact that there is no good Java based applet for connecting to RDP servers, so I use VNC instead. You may find some Java based RDP clients, like ProperJavaRDP and Elusiva, but those projects are dead and not working for me.

VNC uses port 5900. Port 5800 is used for the VNC web server.

There are many implementations of VNC, the best ones are RealVNC, TightVNC and UltraVNC. For Windows XP guests I use UltraVNC. Installation is pretty straightforward except for the display hook driver. After UltraVNC is installed, use the explorer to extract "c:\program files\UltraVNC\drivers.zip".  Then double click on "c:\program files\UltraVNC\drivers\driver\XP\install.bat".

Reboot the guest and enable the driver in the UltraVNC settings.

Now to use the Java client, just point a browser to http://your_host:5800/. You may notice the defaults are not good (restriction of 64 colors etc.). You can create the following HTML file, modify it to suit your needs and host it on a web server. This way you can create remote desktop hyperlinks to other VNC hosts as well.

<html>
        <head>
                <title>appletTitle</title>
        </head>
        <body>
                <applet code="VncViewer.class" width="1024" height="768">
                        <param name="archive" value="http://your_host:5800/VncViewer.jar">
                        <param name="host" value="your_host">
                        <param name="port" value="5900">
                        <param name="Open New Window" value="No">
                        <param name="Show Controls" value="No">
                        <param name="View only" value="No">
                        <param name="JPEG image quality" value="JPEG off">
                        <param name="Restricted colors" value="Full">
                </applet>
        </body>
</html>

Reference: http://forum.ultravnc.info/viewtopic.php?p=57961

USB devices

In Virtualbox there is a setting called USB filters, which determines which USB devices are available in guest systems running in Virtualbox. It's easiest to specify an empty filter which matches all USB devices. In the menu of the guest window you can enable (connect) and disable (disconnect) USB devices. If an USB device is greyed out, it might be a permissions problem. Check if the current user is a member of the vboxusers group with the groups command. If the user is not a member then add this user to the vboxusers group using the following command:

adduser <user> vboxusers

 

I have read a few of the

I have read a few of the articles on your website now, and I really like your style of blogging. I added it to my favorites blog site list and will be checking back soon. Please check out my site as well and let me know what you think. best refrigerator repair Denver I am unable to read articles online very often, but I’m glad I did today. This is very well written and your points are well-expressed. Please, don’t ever stop writing.

Whilst a few dental test

Whilst a few dental test americaare annual, different can be month-to-month or quarterly. You can not come up with the money for to disregard such check americaeven with the escalating costs of dental care check this out.

It is an incredible site..

It is an incredible site.. The Design looks great.. Continue working like that!. Deals

Much obliged to you for

Much obliged to you for peopling get the data they require. Incredible stuff not surprisingly. Keep up the considerable work!!! Questions to ask your boyfriend

I might want to say this web

I might want to say this web journal truly persuaded me to do it! Much obliged, great post. warehousing facilities in lagos

Incredible things you"ve

Incredible things you"ve generally imparted to us. Simply continue written work this sort of posts.The time which was squandered in going for educational cost now it can be utilized for studies.Thanks check my site

I am trusting the same best

I am trusting the same best exertion from you later on also. Truth be told your experimental writing abilities has propelled me. gta5cash

I truly delighted in perusing

I truly delighted in perusing this post, huge fan. Keep doing awesome me when would you be able to distribute more articles or where would I be able to peruse more on the subject? The Magic of Making Up

I truly like your thoughts on

I truly like your thoughts on the issue. I now have an unmistakable thought on what this matter is about.. builders polythene

This is an awesome post. I

This is an awesome post. I like this topic.This site has heaps of advantage.I discovered numerous fascinating things from this site. It helps me in numerous ways.Thanks for posting this once more. Benefits of Cucumbers

Positive site, where did u

Positive site, where did u think of the data on this posting? I'm satisfied I found it however, sick be inquiring soon to figure out what extra posts you incorporate. Hero Instinct

Your site is truly cool and

Your site is truly cool and this is an incredible rousing article. oil burner repairs

Pianoteq 5 Crack

excellent and nice post. I really appreciate you on good achievement. I got more knowledge from your admin. Pianoteq 5 Crack

That appears to be excellent

That appears to be excellent however i am still not too sure that I like it. At any rate will look far more into it and decide personally! clanlab.co.nz

Hire a live band to make you

Hire a live band to make you party from good to grand. Hire the band based on the kind of party you are hosting or the type of music you prefer. The website tells you how to hire a live bands for the ultimate party success. www.souldesire.co.uk

Tramadol is an opiod type

Tramadol is an opiod type medication for relieve middIe to severe discomfort acting on spinal nerve ceIls and directIy with the mind. Do not drink alcohol in case you are taking Tramadol. BUY TRAMADOL 180

Decent post. I was checking

Decent post. I was checking continually this website and I'm awed! Greatly valuable data exceptionally the last part I nurture such data a considerable measure. I was looking for this sure information for quite a while. Much obliged to you and good fortunes. get more info

It's fitting time to make a

It's fitting time to make a few arrangements for the future and the time has come to be glad. I have perused this post and on the off chance that I might I be able to wish to recommend you few fascinating things or counsel. Maybe you could compose next articles alluding to this article. I longing to peruse much more things about it! Designer shoes for women

acquire ultram 50mg discount | acquire tramadol 50mg pharmacy

People who have to take tramadol might follow some helpful tips that will assist to possess a better knowledge with this drug. It is suggested to take tramadol by mouth with a complete glass of water. In case of an upset abdomen because of the consumption of tramadol, it is advisable to take it preferably with meals or with milk. If you think you have taken an excessive amount of medication, contact the Toxicological Info Service or visit the emergency division immediately. In the event that you forget to have a dose, take the dose as soon as you remember. If it's almost time for your next dose, skip the missed dosage and go back to your regular dosing plan. http://mastertramadol.com

I am trusting the same best

I am trusting the same best exertion from you later on too. Truth be told your experimental writing abilities has roused me. outsource software

I can't envision

I can't envision concentrating sufficiently long to research; significantly less compose this sort of article. You've beaten yourself with this material. This is extraordinary substance. mobile detailing orlando

When was the last time you

When was the last time you gave your personal finances a Check-Up? Since financial planning is such an important component of our lives, I think it is good to step back, at least once a year and give your finances a Check-Up. authentic bags

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to investigate and compose so well. I am exceptionally awed with your vision and knowledge. Sprinkler Repairs

Only a grinning visitant here

Only a grinning visitant here to share the adoration (:, btw exceptional style. AWOL Elite

I as of late ran over your

I as of late ran over your online journal and have been perusing along. I thought I would leave my first remark. I don't comprehend what to say with the exception of that I have appreciated perusing. Pleasant site, I will continue going by this online journal all the time. portable ice makers amazon

hi!! Extremely fascinating

hi!! Extremely fascinating examination happy that I went over such educational post. Keep doing awesome. Happy to be a piece of your net group. cheap postcard printing mailing

tariq

Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! http://hilariouspastor99.blog2learn.com/5153182/getting-a-fishing-kayak

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to investigate and compose so well. I am exceptionally awed with your vision and knowledge. source

It was thinking about whether

It was thinking about whether I could utilize this review on my other site, I will interface it back to your site though.Great Thanks. bonuses

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to investigate and compose so well. I am exceptionally awed with your vision and knowledge. affordable web design

Awesome post, and incredible

Awesome post, and incredible site. A debt of gratitude is in order for the data! The Author Incubator

I as of late ran over your

I as of late ran over your online journal and have been perusing along. I thought I would leave my first remark. I don't realize what to say with the exception of that I have delighted in perusing. Pleasant website. I will continue going by this web journal all the time. The Author Incubator

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to investigate and compose so well. I am exceptionally awed with your vision and knowledge. Click here

Much obliged to you for

Much obliged to you for extremely usefull data.. http://aedsoftware.info/tekla.html

Incredible Article it its

Incredible Article it its truly instructive and inventive update us as often as possible with new upgrades. its was truly important. much obliged. gate control for driveway

Your article has aroused a

Your article has aroused a great deal of positive hobby. I can see why since you have made such a decent showing of making it intriguing. Webhosting

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to investigate and compose so well. I am exceptionally awed with your vision and knowledge. Yio Chu Kang EC

Much thanks for composing

Much thanks for composing such an intriguing article on this point. This has truly made me think and I plan to peruse more. cheap55printing.com

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to investigate and compose so well. I am exceptionally awed with your vision and knowledge. Clash of Clans Gems

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to investigate and compose so well. I am exceptionally awed with your vision and knowledge. correx

If it's not too much trouble

If it's not too much trouble share more like that. RENT A CAR

Your substance is absolutely

Your substance is absolutely splendid from numerous points of view. I think this is connecting with and educational material. Much thanks to you such a great amount for thinking about your substance and your perusers. low cost printers

Merely a smiling visitant

Merely a smiling visitant here to share the love (:, btw outstanding style. Sex Positions

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to investigate and compose so well. I am exceptionally awed with your vision and knowledge. Ponta do Ouro Kangela Estate

I needed to thank you for

I needed to thank you for this magnificent read!! I unquestionably adored each and every piece of it. I have you bookmarked your site to look at the new stuff you post. official statement

Exceptionally pleasant

Exceptionally pleasant article, I appreciated perusing your post, extremely decent share, I need to twit this to my adherents. Much appreciated!. bonuses

"Boredom is a killer—which is

"Boredom is a killer—which is why a cure for boredom can be a lifesaver. The truth is, portable Bluetooth speakers have been the handheld solution to elevate the moment, whether at the beach, the middle of a party, or a lazy afternoon at home for years now—and your brand can get in on that excitement. Right now—with C2BPromo.com, you can put you logo on a wide array of Promotional Bluetooth Speakers, in all different shapes and sizes, from waterproof to resilient wood—with models coming in at 6-7 dollars all the way up to high-end luxury designs. Multiple surfaces on almost every customized Bluetooth speaker can showcase your logo—so no matter which way it’s turned, your name is always center staged." Branded Bluetooth Speaker

I wish more authors of this

I wish more authors of this type of content would take the time you did to research and write so well. I am very impressed with your vision and insight. best seo services company

A debt of gratitude is in

A debt of gratitude is in order for giving late reports with respect to the worry, I anticipate read more. curso adwords

This is a great inspiring

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information... Hero Instinct