VirtualBox
Dom Latter
dom at latter.org
Fri Jun 12 17:26:35 CEST 2009
Ian Spray wrote:
> The biggest choice is do you want it NATed behind the IP of the host
> that you're running Virtualbox on, or directly on the LAN as if another
> physical machine had been plugged in.
>
> What sort of network issues do you have ?
NATed worked fine, but I want to run web and mail servers on it, so
I think I need "bridged". Directly on the LAN, as it were.
NAT'ed is okay for "client" machines but in order to forward port
80 and the like to the hsot OS, you need to be running as root,
and I don't want to do that.
Here's a post I made to the vb forums:
==== start ======================================================
I have a headless remote CentOS 5.3 (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.
==== end ======================================================
NB that previous versions of VB required all sorts of malarkey, which
is now automagically taken care of by a "net filter".
What I don't get is what IP address the host OS is supposed to end up
with, and where it gets it from.
Any pointers?
There is a possible fallback, using NAT. Get the hardware router that
the physical server is behind to forward port 80 requests to, say port
1080, and then on the host machine forward port 1080 to port 80
on the guest OS (or indeed change apache's default ports, but I'd
rather change as little as possible).
More information about the CLUG
mailing list