loosing internet connection when bridging networking

Discussions related to using VirtualBox on Linux hosts.
Post Reply
htamayo
Posts: 20
Joined: 7. Aug 2008, 23:59

loosing internet connection when bridging networking

Post by htamayo »

Hi, I'm using debian etch as a Host OS and virtualbox 1.6.2. I'm trying to bridge networking between my host OS and the guest OS -several guest like puppy, ubuntustudio, etc- , so I'm following a how-to that I found and it was written using exactly the same version of virtualbox.

So, when I do the follow steps:

Code: Select all

sudo invoke-rc.d networking stop

sudo nano /etc/network/interfaces

auto lo
iface lo inet loopback

auto br0
iface br0 inet static
address       192.168.1.2
netmask       255.255.255.0
broadcast     192.168.1.255
gateway       192.168.1.1

bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

auto eth0
iface eth0 inet dhcp

sudo /etc/init.d/networking restart
In fact, I obtained my IP from the dhcp and also the bridge got the ip static that I want, but I just lost internet conecction, it seems that I'm out of the network services, if I tried to use the internet I received a message from my browser that the proxy is rejecting connection.

My network enviroment is:
-Squid for authentication and access to the internet
-Astaro for web filter
-the network is "A" class
-dhcp

My questions are:
-how can I create my bridge object --for networking between host and guest OS-- and at the same time keep my network services? such as internet

-why the br0 object creates a conflict between the internet connection?

-Do i have to use a Class A ip for br0 setting or can I use the setting that I decide to use? (address 192.168.1.2, netmask 255.255.255.0 ....)

Regards
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

First of all, the IP range 192.168.x.y is a class C network, not class A (that would be 10.x.y.z). See wikipedia for that.

Second, all traffic is routed through the bridge, as eth0 is a slave of br0. However, there is no DNS route known after br0 started. Because you use DHCP, it should be set on the bridge too and eth0 should be turned to manual.

If you want to have two way communication between the Guest and Host, you can use a Host Interface, configure both ends correctly and you're all done. Want internet on the Guest? Use NAT along side HIF. Or set the bridge with the proper settings, turn DHCP on on the Guest and voilá, two way communication with internet.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
htamayo
Posts: 20
Joined: 7. Aug 2008, 23:59

Post by htamayo »

Thanks for your answer, previous to see your post I read several howto's and I hava a better idea of I have to do, in fact, I created a bridge and attached my eth0 to it and it works, but according to that I have another question:

When I restart the networking service I could see that the br0 got a different ip from the dhcp server, then I did a ifconfig and I could see that my eth0 didn't have ip assigned, my question is:

-will the br0 give an internal ip to the eth0 and for the guest OS's? or will take different ip's from the dhcp server to give to them?

the br0 has a mac address?

-if the guest OS's have internet access, the system administrator can see that ip's? or all traffic is through the br0?

Regards
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

htamayo wrote:Thanks for your answer, previous to see your post I read several howto's and I hava a better idea of I have to do, in fact, I created a bridge and attached my eth0 to it and it works, but according to that I have another question:

When I restart the networking service I could see that the br0 got a different ip from the dhcp server, then I did a ifconfig and I could see that my eth0 didn't have ip assigned, my question is:

-will the br0 give an internal ip to the eth0 and for the guest OS's? or will take different ip's from the dhcp server to give to them?
As eth0 is a part of br0, and br0 actually uses eth0 to obtain an address in the first place, eth0 does not need an address. Every slave of the bridge is accessible by the address of the bridge. So others on the network will access the host by the address assigned to br0, using the eth0 interface. The Guest will access the Host by using the virtual interface that is a part of br0. It's just one bundle of interfaces callable by one address.
the br0 has a mac address?
Yes, this has to be. As a rule, all Network Interfaces MUST have a valid MAC address. This is for a bridge usually the same as the physical adapter, or the first slave. Not sure which one as my bridge has the MAC of my LAN adapter which is also the first slave.
-if the guest OS's have internet access, the system administrator can see that ip's? or all traffic is through the br0?
The bridge acts as a network hub for the Guest. If you would use a packet sniffer on the Host, you will see the network packets coming from and going to the Guest system.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
crotalus
Posts: 7
Joined: 1. Jul 2008, 13:04

Post by crotalus »

Hi,

I also had a similar problem trying to set up a bridge on F8 host.

I would like that my guest is visible from inside a local network,
and the bridging scheme seems to be the right course.

Using a wireless connection, everything works, as expected,
and I have a connection in the host and the guest:

#!/bin/sh

/sbin/sysctl net.ipv4.ip_forward=1
/usr/bin/VBoxTunctl -b -u a_user
/sbin/ip link set tap0 up
/sbin/ip addr add 192.168.254.4/24 dev tap0
/usr/bin/parprouted wlan0 tap0

Then, I set an static IP on the XP guest. Ideally, I would like to use dhcp for tap0 and the guest, but I do not know how.

On the other hand, using a wired connection, I
lose the host connection:

#!/bin/sh

/usr/sbin/brctl addbr br0
/sbin/ifconfig eth0 0.0.0.0
/usr/sbin/brctl addif br0 eth0
/sbin/dhclient br0
/usr/bin/VBoxTunctl -b -u a_user
/sbin/ifconfig tap0 up
/usr/sbin/brctl addif br0 tap0


The host had a fixed IP in this case, and I would like it
to keep responding to this IP.

Thanks.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Crotalus, you know that your 'wireless bridge' is not a real bridge?

Did you try the bridge solution found in the manual for your LAN connection? Please don't hijack this topic. A small additional question that is in the same situation as the TS is ok, but don't come here with a completely different situation and question. From the looks of your situation now, it's a bit different but the result, no internet, is about the same. Please keep it on that subject.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply