Setup A Bridge For VirtualBox
First You just need to load the “vboxnetflt” modules if it isn’t loaded yet, and adjust the networking type in the VirtualBox Guest Network Settings to Attach to “Host Interface”.
sudo modprobe vboxnetflt
And then install bridge-utils to be able to create network bridges:
sudo apt-get install bridge-utils
Before you begin, back up the current interfaces file with a copy that has the current date in its name:
sudo cp /etc/network/interfaces /etc/network/interfaces.`date +%F~%T`
You have to edit /etc/network/interfaces on the hostmachine to declare the bridge, this procedure is slightly different if your host use static or dynamic IP. If you have dynamic IP, on the host machine:
sudo vim /etc/network/interfaces
and then fill with this entry:
auto br0
iface br0 inet dhcp
bridge_ports eth0
# The loopback network interface
auto lo
iface lo inet loopback
note:
“eth0″ is the name of your interface, it can be different depending on your machine.
“br0″ is an arbitrary name for the bridge.
If you are using static IP addresses modify the interfaces like this:
sudo vim /etc/network/interfaces
and then fill this entry:
auto br0
iface br0 inet static
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports eth0
# The loopback network interface
auto lo
iface lo inet loopback
note:
Replace 192.168.0.100 with your IP, 255.255.255.0 with your netmask and 192.168.0.1 with your gateway. If you are using static IP addresses for eth0, eth1, etc; you will need to configure the br0 interface using the same settings! Otherwise your system will request an IP address via DHCP. You may add as many vbox# interfaces as you wish as long as they are also declared in /etc/vbox/interfaces; keep reading for details.
And then used this command :
sudo brctl addif br0 eth0
When you type command “brctl show” it must shown like this :
sudo brctl show
bridge name bridge id STP enabled interfaces
br0 8000.0016d4db8cb9 no eth0
pan0 8000.000000000000 no
Restart your network :
sudo /etc/init.d/networking restart
And the last see your network configuration with “ifconfig” if you see your network configuration like this:
sudo ifconfig
br0 Link encap:Ethernet HWaddr 00:16:d4:db:8c:b9
inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::216:d4ff:fedb:8cb9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14 errors:0 dropped:0 overruns:0 frame:0
TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1730 (1.7 KB) TX bytes:4568 (4.5 KB)
eth0 Link encap:Ethernet HWaddr 00:16:d4:db:8c:b9
inet6 addr: fe80::216:d4ff:fedb:8cb9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2181 (2.1 KB) TX bytes:4744 (4.7 KB)
Interrupt:17
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:80 errors:0 dropped:0 overruns:0 frame:0
TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6537 (6.5 KB) TX bytes:6537 (6.5 KB)
it mean that you did it. Now unpluged your network try to ping to your IP Virtual server from your host, it should be reply.
December 25th, 2009 at 6:54 am
I want to quote your post in my blog. It can?
And you et an account on Twitter?
December 26th, 2009 at 9:46 pm
sure you can….
October 6th, 2010 at 8:50 am
This is a nice blog, Going On.
October 6th, 2010 at 8:17 pm
In searching for sites related to web hosting and specifically comparison hosting linux plan web, your site came up.
October 29th, 2010 at 7:00 pm
You you should make changes to the webpage name title Setup A Bridge For VirtualBox | harddian.com to something more catching for your subject you make. I loved the post withal.
January 27th, 2011 at 9:08 pm
:`: I am very thankful to this topic because it really gives useful information ;::