I have Lubuntu 12.04 (64bit) with VirtualBox 4.2 installed and the setup below:

  1. eth0 adapter connected to LAN (having static IP and it is the default gateway).
  2. ISC DHCP server listening on eth0, to configure PCs (in LAN) with dynamic IPs.
  3. ppp0 adapter (wirless Mblaze USB modem) to connect to Internet.
  4. eth0 has NATed to ppp0, so that all PCs connected to the LAN can have Internet.
  5. vboxnet0 host only network (selected for the Virtual Machines).

Setup before bridging

I would like to have a bridge combining vboxnet0 and eth0 to make it a single network (say br0) and have the DHCP server serve IPs through this new bridge. br0 now should take the static IP of eth0, so that the bridge can be the new gateway.

Please note I neither need Bridged Adapter nor NAT solution in VirtualBox setting UI. I would like to configure all these manually editing all the associated configuration files.

Any help deeply appreciated. Thanks in advance.


This is fixed. For anyone interested please see the details below.

  1. Install bridge-utils.

  2. sudo leafpad /etc/network/interfaces

    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet static
  3. sudo leafpad /etc/rc.d/rc.local

    vboxmanage hostonlyif ipconfig vboxnet0 --ip --netmask
    brctl addbr br0
    ifconfig eth0 down
    ifconfig vboxnet0 down
    brctl addif br0 eth0
    brctl addif br0 vboxnet0
    ifconfig eth0 up
    ifconfig vboxnet0 up
    ifconfig br0 netmask up
    /sbin/iptables -P FORWARD ACCEPT
    /sbin/iptables --append FORWARD --in-interface br0 -j ACCEPT
    /sbin/iptables --table nat -A POSTROUTING -s -o ppp0 -j MASQUERADE
    restart isc-dhcp-server
    exit 0
  4. sudo leafpad /etc/default/isc-dhcp-server

    INTERFACES="br0 eth0"
  5. Restart your computer

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.