VirtualBox Guest IP Address
UPDATE: VirtualBox host networking is much easier now, and is completely automated on both Windows and Linux.
There are two ways to interact with your guest operating system. You can either forward a port on the host machine, or you can have the guest operating system utilize dhcp to retrieve an IP address from your router. The following are three terminal commands, utilizing the VBoxManage command with a variety of options. To forward a port to your guest OS do the following; replace guestOS with your VirtualBox OS, port 2222 with the port on your host machine that you want to forward, and port 22 for the desired port on the guest OS:
VBoxManage setextradata guestOSname VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort 2222
VBoxManage setextradata guestOSname VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort 22
VBoxManage setextradata guestOSname VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol TCP
Now this method I find really really really cool !!! We are going to configure your VirtualBox guest OS to get a regular IP address from your routers DHCP server. By doing this you will be able to access your VirtualBox guest OS as you would any regular computer. Doing this really establishes a Virtual Operating System that truly and completely functions as a real computer. First install a couple of files via apt; the packages were in my Debian Etch repositories, therefore I have no doubt that they are in Ubuntu’s: sudo apt-get install bridge-utils uml-utilities The best part it its only a couple of command that can be thrown in a script that is automatically run on boot. Add the following lines to a script, you can name the file something like “virtualbridge.sh”:
#replace user with the main username that you use to login
sudo tunctl -t tap0 -u user
sudo chmod 666 /dev/net/tun
sudo /usr/sbin/brctl addbr br0 sudo /sbin/ifconfig eth0 0.0.0.0 promisc
sudo /usr/sbin/brctl addif br0 eth0 sudo /sbin/dhclient br0
sudo /usr/sbin/brctl addif br0 tap0 #replace tap0ipaddress with an unused local ipaddress
sudo ifconfig tap0 tap0ipaddress up
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp' #replace hostipaddress
sudo route add -host hostipaddress dev tap0 #also replace hostipaddress with the host ip address
sudo arp -Ds hostipaddress eth0 pub
#END of SCRIPT
Now configure your VirtualBox Guest OS to use the tap0 network interface. This can all be done graphically. Add these lines to a empty new text file and name it what you wish. Set it to be executable with a quick chmod 777 command. Add it to your sessions to be automatically run on user login. Also add your VirtualBox OS to boot on login; you can do this with:
#replace GuestOS with the desired GuestOS
VBoxManage startvm GuestOS
Now your script will run automatically on login, and the GuestOS will automatically boot. Viola, you now have a GuestOS that automatically boots, and is practically indistinguishable from a real computer complete with a real local ipaddress
No trackbacks yet.
Mod Security for Apache – Web Server Smart Firewall
February 22, 2010 - 9:25 am
Tags: debian repositories, denial of service, denial of service attacks, mod, module, security, security options, spamhaus, sudo, ubuntu
Posted in Apache, firewall, mod, security | No comments
Mod security has features that go above and beyond a standard firewall. It will help to prevent denial of service attacks, and also can be used to block traffic based on realtime blackhole lists issued by Spamhaus and others. Mod security is apparently in the Debian repositories as well as Ubuntu. In the Ubuntu repos [...]
Apache2 Server Side Includes
February 16, 2010 - 9:32 am
Tags: benifit, caption, client web, code, directory, directory path, document, gt options, host containers, html, Server, server parameters, shtml, side, sudo, Wikipedia
Posted in Server, apache2, include, side, ssi | No comments
Server side includes allow for external html documents to be injected into a page prior to it rendering on the client web browser. The benifit of this is eliminating the need to repetitiously repeat code over and over again. If you include the same scripts, on each of your website pages, you can create an [...]
Apache 2 Manage Modules and Sites – Configuration Structure
February 14, 2010 - 10:52 am
Tags: Apache, com, conf, default, document, document roots, example, host containers, php5, servername, software modules, sudo, virtualhost, www data
Posted in a2dismod, a2dissite, a2enmod, a2ensite, apache2, mod, php5 | No comments
Apache2 implements a structured method of organizing and enabling/disabling modules and sites. The default apache2 host is automatically turned on in /etc/apache2/sites-enabled/, and it includes the virtual hosting option. Therefore, by default, virtual hosting is enabled. Create your virtual host containers in /etc/apache2/sites-available, and then enable them by issuing the command:
sudo a2ensite xxxxx.com
VirtualHost containers are [...]
Remote Server Management in Local Facility – LTSP
February 13, 2010 - 9:26 am
Tags: boot sequence, dhcp, dhcp servers, domain default, local ip, ltsp, machine, Server, server option, sudo
Posted in Server, inet, ltsp, tftp | No comments
I’m using LTSP to manage a server remotely in a local facility. I setup an LTSP server on the host machine, and will place it in an air-conditioned room to preserve longevity. I configured a machine, of much lower power, to PXE boot from the server. There are several nuances to setting up an LTSP [...]
Nvidia Driver on Linux – Easy, and Quick
February 7, 2010 - 9:07 am
Tags: desktop, desktop cd, driver, gdm, modules package, nvidia, nvidia driver, open source driver, startup settings, sudo
Posted in driver, gcc, headers, linux, modules, nvidia, xorg | 1 comment
Image via CrunchBase
There is a buzz that installing the Linux based Nvidia accelerated graphics driver is complicated. I consider it rather straight forward. First install build-essential, and the headers for your kernel. Those may appear to be some bigs words in the previous sentence, but it is really one line in a terminal window. Build [...]
Sshd_config Settings Rundown
February 3, 2010 - 12:38 pm
Tags: change, internet, login, login attempts, password, port, port 22, pound symbol, root login, ssh login
Posted in iptables, login, root, rsa, setting, sshd, tcp | No comments
Image via Wikipedia
First change the port you are using. Do not use port 22 on servers that have internet connectivity. This is the first port that will be checked by countless robots searching the internet for vulnerabilities. Change the port to whatever, and then use the -p option in your ssh login attemt. Then make [...]
Linux CUPS Configuration – Foomatic
January 16, 2010 - 3:58 pm
Tags: configure, foomatic, hp drivers, ppd, printer, printer configuration, setup script, static ip address, sudo, Webmin
Posted in cups, driver, foomatic, linux, open, ppd, print | No comments
First install all needed packages. Your going to need cups, and the client, and the foomatic and openprinting drivers.
sudo apt-get install cupsys cupsys-client
Then install everything in:
sudo apt-cache search foomatic
If its an HP printer your going to want that library. HP has an auto setup script. Install the package and run:
sudo hp-setup
Installing all the foomatic, [...]
Scrub – File Shredding for Linux
December 26, 2009 - 9:06 am
Tags: cronjob, folder, free space, gigs, global path, home folder, scrub, shred, space, sudo
Posted in free, linux, scrub, shred, space | No comments
With this handy little app you can shred files and folders, but more conveniently you can shred your entire free space. Just make sure you’ve erased all the files you want to shred. Empty the trans, issue:
sudo apt-get autoclean && localepurge
Download scrub from Sourceforge:
http://sourceforge.net/projects/diskscrub
Its a simply source so configure, make and install. It will install [...]
Spin Down USB Hdd – Ehh I don’t Think Its Working
December 23, 2009 - 9:34 am
Tags: backup, fstab, hdd, mount dev, pseudo, rsync, sudo, thing, umount, usb drives
Posted in backup, fstab, mount, umount | No comments
Oh, given my previously elabored backup configuations I have one further thing I would like to do. Since backup 1, and 2 are only used once per day I would like to spin down the hard drivers to increase longevity. I figured dismounting the drive would be effective, but I have encountered several things. First, [...]
Gnome Shell – Move Over Compiz, or Not?
December 19, 2009 - 2:53 pm
Tags: alternate shells, Compiz, default shell, gnome, install, new addition, server environment, shell, sudo
Posted in Compiz, gnome, shell | 1 comment
Gnome is moving ahead making great progress. Every successive release gets better. A new addition to Gnome is a build in shell supporting compositing. Install it in Ubuntu with:
sudo apt-get install gnome-shell
Then implement it the same way you implement compiz:
sudo gnome-shell –replace
You may want to have the fusion-icon open in the system tray to conveniently [...]



August 28, 2007 - 6:37 am
cheers for that post mate
August 28, 2007 - 11:35 am
your very welcome. I’m here to help.
February 13, 2008 - 2:15 am
My network hangs on setting my eth to promisc mode. Any suggestions? Can I ommit this step?
August 29, 2008 - 12:34 am
good stuff man, this is tagged.
December 14, 2008 - 6:08 pm
could we get instructions for the people who use virtualbox installed on windows?
March 26, 2009 - 5:06 pm
Good example, there is a simpler way to make this permanent instead that using rc.local but editing file /etc/network/interfaces
here is an example
http://docs.google.com/Doc?id=dg3zpxp5_58gxg82vgj
February 5, 2010 - 7:23 pm
Another great post.
Thanks for the tips and help.
Everyone, bookmark this site.
March 7, 2010 - 2:51 am
I’m doing my best to follow your directions. How do I configure Virtualbox to start the “virtualbridge.sh” script at startup?
March 7, 2010 - 8:54 am
Please read the top line of this post. It is written in big red letters. It will help you out!