Page 1 of 1

Headless remote webserver - Bridged networking prob.

Posted: 12. Jun 2009, 11:49
by domthehat
I have a headless remote CentOS 5.2 (AMD64) webserver on which I have installed ./VirtualBox-2.2.4-47978-Linux_amd64.run with the aim of having a second separate (virtual) webserver on its own IP address. The server is remote so I'm doing everything from the command line.

I have created a VM running Debian 5.0.1 (32 bit). Using default NAT networking the Debian VM can communicate with the world.

On the host OS I have two IP addresses, let's say 12.34.56.78 and 12.34.56.79 as eth0 and eth0:1. I want to bind the second IP address to the VM.

In order to run Apache on the VM I believe I need to change to bridged networking. If I try this:
VBoxManage modifyvm "Debian501" --nic1 bridged --bridgeadapter1 eth0:1
then I get an error message when I try to start the VM: "Failed to open/create the
internal network 'HostInterfaceNetworking-eth0:1' (VERR_INTNET_FLT_IF_NOT_FOUND)."

With this:
VBoxManage modifyvm "Debian501" --nic1 bridged --bridgeadapter1 eth0
the VM boots, but there is no sign of any networking on the VM. "ifconfig eth0" on the VM doesn't have an IP address.
On the guest, /etc/network/interfaces contains "iface eth0 inet dhcp". I've also tried a static IP using the values obtained when I was running it as a NATed machine. In any case I don't see how this would work - I want to bind the host's eth0:1 to my VM, not the main interface. But all the guides say "select the interface you want and it just works".

"lsmod" on the host shows "vboxnetflt" as installed.

I have read the manual, the FAQ, and many many pages and I can't see how to get this working. Most posts refer to old versions of VB where you had to configure TAPs and so on, and more recent posts tend to refer to the GUI, not the command line.

Re: Headless remote webserver - Bridged networking prob.

Posted: 12. Jun 2009, 22:43
by TechnoPractical
I would be interested to see the working solution on this problem as well. I am running an Ubuntu 9.04 Server (headless) host with FreeBSD guest - having similar issues.

Re: Headless remote webserver - Bridged networking prob.

Posted: 13. Jun 2009, 18:29
by domthehat
At about the same time I finally received enlightenment (from a Linux mailing list) as to *how* this bridged thing works, I'd already schedule a reboot of the server to make a BIOS change, so it is possible that a physical reboot fixed the problem - because I'm pretty sure that I'd already tried the configuration that now works.

Somebody else reports "restarting" as a fix:
http://forums.virtualbox.org/viewtopic.php?f=7&t=18632

The important things to remember are
1. Bridged mode isn't complicated - it simply sticks your virtual machine on the same network(s) as your physical machine.
2. You do *not* make any changes to the host OS; no aliased interfaces, no extra IP addresses, nothing.
3. The guest OS sets or gets its IP in the usual way - so if you don't want to or cannot use DHCP, you assign a static IP address in the normal way for that OS.
4. That's it.
5. Ignore all that stuff about TAPs and TUNs written for previous versions of VirtualBox.

This is *all* you have to do on the Host
VBoxManage controlvm "vmname" poweroff
VBoxManage modifyvm "vmname" --nic1 bridged --bridgeadapter1 eth0
VBoxHeadless --startvm "vmname"
(assuming that you've got it working as a NAT'd VM).

The newly assigned or obtained IP address / interface will appear in the "ifconfig" output of the guest OS, but not the host OS.

If in doubt - reboot. I know it's anathema to Unix people but if you've been messing around with the networking on the host OS it may be that starting from a clean sheet is what's needed. As I say, I was pretty sure that I'd already tried it with eth0:1 disabled and a static IP specified in the guest OS.

If you're having problems, check the output of dmesg (or BSD equivalent) on the guest for kernel messages about the virtual network card.

Check that your guest OS supports the virtual card you're using.

More Keywords: remote headless VirtualBox 2.2 2.2.4 bridge mode networking

Re: Headless remote webserver - Bridged networking prob.

Posted: 14. Jun 2009, 02:03
by domthehat
PS Good luck!

Re: Headless remote webserver - Bridged networking prob.

Posted: 15. Jun 2009, 13:36
by latoubes
Thanks for the tip...

I was really frustated with the tap and the tun stuff....

I use VBox 2.2.4 and simply with the configuration set of the Bridge Mode and a the tip "close&open" gui interface of virtualbox is enough.

Thanks again...

Re: Headless remote webserver - Bridged networking prob.

Posted: 16. Jun 2009, 05:31
by TechnoPractical
Could you post your config on eth0? I'm not getting anything from the guest. I can RDP to VirtualBox from my XP machine (using the address of the host); however the guest can't ping anything in NAT or Bridged mode. Linux doesn't seem to be allowing the guest to communicate. Once again, I'm using Ubuntu server 9.04 host and FreeBSD guest on VirtualBox 2.2.4.

Here is my interface config:
interfaces.JPG
interfaces.JPG (40.46 KiB) Viewed 8525 times
Does 'promiscuous' mode have anything to do with this (potentially)?

Re: Headless remote webserver - Bridged networking prob.

Posted: 16. Jun 2009, 05:57
by TechnoPractical
Here's the ifconfig from FreeBSD:
interfaces2.JPG
interfaces2.JPG (58.06 KiB) Viewed 8623 times
The "media: ethernet none" line I find somewhat disturbing.

Re: Headless remote webserver - Bridged networking prob.

Posted: 16. Jun 2009, 18:26
by domthehat
I assume you're trying to set a static IP on the BSD VM. No, I don't like the "Ethernet none" line. Some discussion here:
http://forums.virtualbox.org/viewtopic. ... 73&start=0

If I were you I would boot the VM off an Ubuntu LiveCD in NAT mode to confirm that the VM can connect to the internet like that.
Then try in bridged mode - I guess a LiveCD will allow you to specify a static IP in the absence of a DHCP server.
Then go back to trying BSD.

promiscuous mode

Posted: 17. Jun 2009, 13:44
by domthehat
Looking at /var/log/messages on my host OS I notice that eth0 goes into and out of promiscuous mode when I start or stop a VM. Which makes sense - it needs to "sniff" traffic intended for the guest.