Bridging eth0 and vboxnet0 and using ISC DHCP server to provide dynamic IPs
This is fixed. For anyone interested please see the details below.
Install bridge-utils.
sudo leafpad /etc/network/interfaces
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 dns-nameservers 10.228.129.113 10.228.129.114
sudo leafpad /etc/rc.d/rc.local
vboxmanage hostonlyif ipconfig vboxnet0 --ip 192.168.0.3 --netmask 255.255.255.0 brctl addbr br0 ifconfig eth0 0.0.0.0 down ifconfig vboxnet0 0.0.0.0 down brctl addif br0 eth0 brctl addif br0 vboxnet0 ifconfig eth0 up ifconfig vboxnet0 up ifconfig br0 192.168.0.1 netmask 255.255.255.0 up /sbin/iptables -P FORWARD ACCEPT /sbin/iptables --append FORWARD --in-interface br0 -j ACCEPT /sbin/iptables --table nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE restart isc-dhcp-server exit 0
sudo leafpad /etc/default/isc-dhcp-server
INTERFACES="br0 eth0"
Restart your computer
Related videos on Youtube
AVarghese
Updated on September 18, 2022Comments
-
AVarghese almost 2 years
I have Lubuntu 12.04 (64bit) with VirtualBox 4.2 installed and the setup below:
eth0
adapter connected to LAN (having static IP192.168.0.1
and it is the default gateway).- ISC DHCP server listening on
eth0
, to configure PCs (in LAN) with dynamic IPs. ppp0
adapter (wirless Mblaze USB modem) to connect to Internet.eth0
has NATed toppp0
, so that all PCs connected to the LAN can have Internet.vboxnet0
host only network (selected for the Virtual Machines).
I would like to have a bridge combining
vboxnet0
andeth0
to make it a single network (saybr0
) and have the DHCP server serve IPs through this new bridge.br0
now should take the static IP ofeth0
, 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.