Questions about network bridged mode

Discussions related to using VirtualBox on Linux hosts.
Locked
fdelente
Posts: 19
Joined: 24. Apr 2009, 09:19
Primary OS: Linux other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux Debian

Questions about network bridged mode

Post by fdelente »

Hello.

I'm trying to understand the bridged mode of VirtualBox. So far I think it works that way:
* I declare that my net card in the guest will use interface wlan0 of my host; so eth0 in the guest is linked to wlan0 on the host, that is every packet that is sent to/received from eth0 on the guest goes through/comes from wlan0 on the host, right?
* If my guest has a fixed IP (192.168.25.5), then I must in the host redirect all traffic to/from 192.168.25.5 to wlan0, right?

I tried it and I can't ping the guest. I tried to set up the kernel routing table so that traffic to/from 192.168.25.* goes to wlan, but it doesn't work:

Code: Select all

# route add 192.168.25.0 wlan0
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.25.0    *               255.255.255.255 UH    0      0        0 wlan0
so 192.168.25.0 is recognized as a machine IP, not a network IP... Giving

Code: Select all

# route add -net 192.168.25.0 netmask 255.255.255.0 wlan0
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0
192.168.25.0    *               255.255.255.0   U     0      0        0 wlan0
works but the virtual machine on 192.168.25.5 doesn't answer to ping.

Thanks for any help.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Questions about network bridged mode

Post by Perryg »

The host is using (what ever) to connect to the Internet.
You setup the guest in Vbox to use bridged mode and it uses a virtual adapter to connect to the adapter on the host (shows up in the VBox network setup).
You only need to tell the guest to use the Virtual adapter (more than likely eth0) in your case.
The guest will see this as a wired interface and then communicate with the host and the Internet.
You do not try to connect directly to the host adapter from within the guest itself.
fdelente
Posts: 19
Joined: 24. Apr 2009, 09:19
Primary OS: Linux other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux Debian

Re: Questions about network bridged mode

Post by fdelente »

Perryg wrote:The host is using (what ever) to connect to the Internet.
My host is using wlan0 (WIFI connection to an access-point).
You setup the guest in Vbox to use bridged mode
Done that.
and it uses a virtual adapter to connect to the adapter on the host (shows up in the VBox network setup).
When I choose Bridged mode for the guest, I have two choices: eth0 and wlan0, as I have both an ethernet card and a WIFI card in my physical machine. I chose wlan0 because it's the interface the host uses to connect to the internet.
You only need to tell the guest to use the Virtual adapter (more than likely eth0) in your case.
I tell the guest which interface the host uses to connect to the internet, right?
The guest will see this as a wired interface and then communicate with the host and the Internet.
You do not try to connect directly to the host adapter from within the guest itself.
I can't configure anything on the guest, it's a closed box that I can only boot and connect to through a web interface. I cannot change its IP whatsoever, and cannot change the interface it uses for networking. It uses eth0 because I enabled only Card#1 for the guest in VirtualBox.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Questions about network bridged mode

Post by Perryg »

OK so you can not configure anything on the guest because it is a closed system. What are the requirements of the closed system? DHCP? NAT? Bridged? Does it have a static address that it must use?
fdelente
Posts: 19
Joined: 24. Apr 2009, 09:19
Primary OS: Linux other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux Debian

Re: Questions about network bridged mode

Post by fdelente »

Perryg wrote:OK so you can not configure anything on the guest because it is a closed system. What are the requirements of the closed system? DHCP? NAT? Bridged? Does it have a static address that it must use?
It has a static address, 192.168.25.5, that cannot be changed. An apache server is running on it, and the only way I can contact it is through a web browser: http://192.168.25.5.

I succeeded in doing that using the host-only mode; however, the people that set up the server also need access to it. When I contact the server through the browser, I can go to a redirection page that asks me for a port number, and that port opens a tunnel from the guest server to the central server of the people that created my guest server (don't ask me why, I don't know more). So for example, giving port number 5678 for the tunnel redirection, going to http://centralserver:5678 redirects to my guest server, so this guest is available on the internet.
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

Re: Questions about network bridged mode

Post by Sasquatch »

Didn't you start a topic about this earlier last week? This scenario sounds all too familiar.
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.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Questions about network bridged mode

Post by Perryg »

Yes he did and marked as resolved on the 25th under a different topic.
Since this is a software issue complicated by the vendor and is not really a VirtualBox issue You need to contact them and get their guidance. This falls totally outside of VBox scope.

Locking topic.
Locked