Bridged networking with virtualbox, ubuntu and static ips

This is a little howto where I explain how I configured bridged networking for virtualbox with static ips on an Ubuntu host in order to make the virtual machine accessible from outside the host system.

sudo aptitude install bridge-utils uml-utilities

sudo adduser $USER uml-net

Login again so the change takes effect.

Modify /etc/network/interfaces so it has the following content:

auto lo
iface lo inet loopback

iface eth0 inet static
address 0.0.0.0

auto eth0

auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user david

auto br0
iface br0 inet static
address 192.168.0.12
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports eth0 tap0

Restart networking:

sudo /etc/init.d/networking restart

Open virtualbox. Click on settings and choose network. Where it says “Attached to” select Host Interface. In the text field labeled “Interface Name” insert tap0.

Boot your guest OS and configure networking under your guest OS the same way you would configure any other machine on your local LAN.

References:
Chapter 6, Virtual Networking, from the Virtualbox User Manual

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: