Bridge network interface on VirtualBox

When I want to streaming TV by SlingBox on Windows XP by VirtualBox under Ubuntu 7.04, I found the “Host Interface” produced error. That’s mean I could not streaming TV? No, there is a method to solve this problem.

Step 0 :
If you have not install VirtualBox on your Ubuntu 7.04, follow this guide -
How to install VirtualBox on Ubuntu 7.04

Step 1 :
Install the required packages -

sudo apt-get install uml-utilities bridge-utils

Step 2 :
Create TAP interface -

sudo tunctl -t tap1 -u samiux

** where “samiux” is the username of your Ubuntu (here is my name)

Step 3 :
Create a br0 bridge -

sudo brctl addbr br0

Step 4 :
Make your real network interface be promiscuous -

sudo ifconfig eth0 0.0.0.0 promisc

Step 5 :
Link your real network interface to bridge br0 -

sudo brctl addif br0 eth0

Step 6 :
Assign an IP to the br0. If you are using DHCP -

sudo dhclient br0

Or, if you assign an IP yourself -

sudo ifconfig br0 192.168.1.102

* the IP may be different from yours.

Step 7 :
Link TAP to bridge br0 -

sudo brctl addif br0 tap1

Step 8 :
Activate TAP interface -

sudo ifconfig tap1 up

Step 9 :
Change the permission of /dev/net/tun -

sudo chmod 0666 /dev/net/tun

Step 10 :
At the VirtualBox startup panel, choose “Host Interface” and add “tap1″ to “Interface Name”.

Step 11 :
At the guest (after boot up the guest OS), change the IP of the guest OS to the same subnet of your host.

IP 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.1
DNS #1 208.67.222.222
DNS #2 208.67.220.220

Step 12 :
Now, you can execute the SlingBox player to watch your TV programmes on your guest OS (Windows XP) under Ubuntu 7.04 by VirtualBox.

When you reboot your guest OS, you need to repeat the Step 2 to 9 to play the SlingBox Player. Or, you can create a executable script to make your job easy.

Enjoy!

Updated on 2008-JUL-30 :

I wrote an updated method to bridge VirtualBox 1.6.2 on Ubuntu 8.04.1 at here.

About these ads

10 Responses

  1. Excellent tutorial I was struggling to get a similar windows only application to run in Virtualbox, it is called PC Server for the Kenwood Fineline receiver VRS N8100. This works beatimus.

    Thanks

    Chuck

  2. Your steps above went a long way towards making VirtualBox do networking for me. I did get VB to connect to the network.

    However, I am running VB on a machine (192.168.0.3) which connects to my server (192.168.0.2) and when I go through the steps, I lose connectivity to any other machine on the 192.168.0.xx network) I can still talk to .2 from .3 because there is a default gw set in the routing table, but all other machines on the LAN are not reachable. Everything looks good as far as the network goes but as soon as I brctl addif br0 eth0, I lose connectivity on eth0.

    Any suggestions? Thanks.

  3. Hi bsm999,

    Did you issue the command at Step 4?

    Samiux

  4. Yes I did… I used 192.168.0.3 for an address in the command… but I just tried it again with 0.0.0.0 and now I can get to my LAN ok but not the outside world because the default gw has gone away.

    Currently route -n shows:
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 br0

    And ifconfig shows:
    br0 Link encap:Ethernet HWaddr 00:0C:F1:AF:0F:E7
    inet addr:192.168.0.41 Bcast:192.168.0.255 Mask:255.255.255.0
    inet6 addr: fe80::20c:f1ff:feaf:fe7/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:361 errors:0 dropped:0 overruns:0 frame:0
    TX packets:87 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:84088 (82.1 KB) TX bytes:7939 (7.7 KB)

    eth0 Link encap:Ethernet HWaddr 00:0C:F1:AF:0F:E7
    inet6 addr: fe80::20c:f1ff:feaf:fe7/64 Scope:Link
    UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
    RX packets:833752 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1089721 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:100
    RX bytes:372058974 (354.8 MB) TX bytes:1168842279 (1.0 GB)
    Base address:0x8c00 Memory:fe9e0000-fea00000

    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:443 errors:0 dropped:0 overruns:0 frame:0
    TX packets:443 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:40032 (39.0 KB) TX bytes:40032 (39.0 KB)

    tap1 Link encap:Ethernet HWaddr 00:FF:13:82:5E:A9
    inet6 addr: fe80::2ff:13ff:fe82:5ea9/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:8968 errors:0 dropped:0 overruns:0 frame:0
    TX packets:13404 errors:0 dropped:333 overruns:0 carrier:0
    collisions:0 txqueuelen:500
    RX bytes:1158529 (1.1 MB) TX bytes:12258093 (11.6 MB)

    Ahhh…. but if I add a def gw to my server using br0, everything seems fine both with VB and with my LAN machines. So the thing I did wrong was to use 192.168.0.3 in step 4 but I was still missing a def gw using br0.

    Here are the commands I now issue:
    # Step 2 :
    tunctl -t tap1 -u bmarsh
    #Step 3 :
    brctl addbr br0
    #Step 4 :
    ifconfig eth0 0.0.0.0 promisc
    #Step 5 :
    brctl addif br0 eth0
    #Step 6 :
    ifconfig br0 192.168.0.41
    #Step 7 :
    brctl addif br0 tap1
    #Step 8 :
    ifconfig tap1 up
    #Step 9 :
    chmod 0666 /dev/net/tun

    With the VB machine being at 0.40

  5. […] Automatically configure bridge interfaces on VirtualBox bridging on Linux hosts over the VirtualBox Bridge network interface on VirtualBox Networking bridge for Virtualbox Windows XP in Fedora 7 Bridged Networking with VirtualBox on Linux […]

  6. […] Bridge network interface on VirtualBox « Samiux’s Blog When I want to streaming TV by SlingBox on Windows XP by VirtualBox under Ubuntu 7.04, I found the “Host Interface” produced error. That’s mean I could not streaming TV? No, there is a method to solve this problem. (tags: linux ubuntu networking virtualization virtualbox bridge howto article blog tips) […]

  7. Fantastic guide; only one I found that worked!!
    Q. Does this make the bridge permanent?
    Q. How to view the configurations, what files?

  8. […] be able to make sure it works on the network (if you see my meaning) anyway I found a good guide here which with a bit of extra fiddling got me working (I needed to add the route command to make sure […]

  9. […] virtualbox for real networking is to install a tap interface and bridge it to your main interface http://samiux.wordpress.com/2007/07/…on-virtualbox/ It looks an awful lot harder to do than it actually is. — Moog "The G is for the gnarled […]

  10. Hi

    I have done bridge networking on Virtualbox recently too.

    My setup:

    Host: XP
    Guest : Ubuntu

    Please see my blog for more details

    http://fooksheng.blogspot.com/2009/06/using-bridge-networking-on-virtualbox.html

    http://fooksheng.blogspot.com/2009/06/bridge-network-in-virtualbox-with-tap.html

    chan fook sheng

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: