Spreadfirefox Affiliate Button
Custom Search

Sunday, February 15, 2009

VirtualBox Host-Guest Interface Networking (Generic)

This way is a bit harder, but it allows you to see the VirtualMachine as a "real" computer on your local network.

1. Create a new bridge with this command:
# brctl addbr br0

2. If you are not using DHCP, run ifconfig and note down the network configuration of your existing network interface (e.g. eth0), which we will need to copy to the bridge in a minute.

(Note: You will need this settings so make sure you don't lose them!!!)

3. Switch your physical network adapter to "promiscuous" mode so that it will accept Ethernet frames for MAC addresses other than its own (replace eth0 with your network interface):

# ifconfig eth0 0.0.0.0 promisc

(Note: You will lose network connectivity on eth0 at this point.)

4. Add your network adapter to the bridge:

# brctl addif br0 eth0

5. Transfer the network configuration previously used with your physical ethernet adapter to the new bridge. If you are using DHCP, this should work:

# dhclient br0

Note:

Use "dhcpcd -t 30 -h yourhostname br0 &" instead of the above

Otherwise, run ifconfig br0 x.x.x.x netmask x.x.x.x and use the values that you noted down previously.

6. To create a permanent host interface called vbox0 (all host interfaces created in this way must be called vbox followed by a number) and add it to the network bridge created above, use the following command:

VBoxAddIF vbox0 vboxuser br0

Replace vboxuser with the name of the user who is supposed to be able to use the new interface.

(Note: VboxAddIF is located in /opt/VirtualBox-VERSION OF VIRTUALBOX/VBoxAddIF)

Alternatively, you can setup VirtualBox networking through your /etc/rc.conf to enable a bridged connection.

No comments: