VirtualBox networking…finally!
I honestly never thought I’d see the day, but I’ve finally found a way that seems to work (touch wood!) to allow me to run virtual machines in VirtualBox on my Ubuntu host, and allow two-way access to the network with a bridged interface!
Translation: my virtual machines have an IP address on my internal network and act as if they were machines on my network.
To do this, I’ve hunted high and low and the best summary page I found was this one. Basically:
- Install
brctlanduml-utilities - Create the following script in
/etc/rc.local, replacing everything in [ ]:tunctl -t tap0 -u [username] chmod 0666 /dev/net/tun /usr/sbin/brctl addbr br0 /sbin/ifconfig eth0 0.0.0.0 promisc /usr/sbin/brctl addif br0 eth0 /sbin/dhclient br0 /usr/sbin/brctl addif br0 tap0 ifconfig tap0 [IP for virtual machine] tunctl -t tap0 -u [username] chmod 0666 /dev/net/tun /usr/sbin/brctl addbr br0 /sbin/ifconfig eth0 0.0.0.0 promisc /usr/sbin/brctl addif br0 eth0 /sbin/dhclient br0 /usr/sbin/brctl addif br0 tap0 ifconfig tap0 [IP for virtual machine] up bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp' route add -host [VirtualBox server/PC IP address] dev tap0 arp -Ds [VirtualBox server/PC IP address] eth0 pub exit 0
- In VirtualBox, set the virtual machine to have “Attached to” set to “Host interface” and the “Interface Name” to “tap0″.
It just works!
You should be able to add other taps for other machines…I think.
Leave a Comment