qemu vs VirtualBox user/hoset-only networking and port forwarding
I have a Linux server (SSH and Samba) running in VM with static address (192.168.136.222)
I need to access the server (living in guest) from my host machine (Linux or Windoze) In qemu I use user networking and redirect to the guest ip address, i.e. "-net user,net=192.168.136.0/24 -redir tcp:22:192.168.136.222:22 -redir tcp:445:192.168.136.222:445" Then I can access smb://localhost as well as ssh to localhost In VirtualBox the only way I achieved a similar task was using "host-only adapter" and assign static ip to it in the same domain as my guest (e.g. I selected 192.168.136.2). The only disadvantage is that I have to keep the adapter with that static IP address, even when no virtualbox is running. The rest was similar to qemu and worked just fine. I tried virtual box NAT, but it seems it only works from inside (guest) to host, and I could not redirect host to guest (not at least using Virtualbox port-forwarding dialogue) Now my question is this: What is the difference between qemu user networking, and "Virtualbox host-only" networking? are they the same, or qemu does a reverse NAT (in addition to NAT) to allow guest-to-host access? P.S. I did not know if this is server-related question, or not. If it is I appreciate if admins move this to the appropriate thread. |
Host only provides access from the host to the vm using an especial interface that is exposed to the host.
You can think of it as a virtual interface connected to a virtual switch where the VMs with host only interfaces are connected. You will need to configure this interface on the same network, or run a router on any of the VMs to be able to access them. Check http://www.virtualbox.org/manual/ch06.html Most of the simple scenarios can be full filled with bridging the interfaces to the physical network on the host. Regards Sebastian |
Thanks for the reply.
The problem with Host-only adapter is that (because of the static guest server address) I have to assign a static IP address to it, that may conflict with the rest of my network even when no VM/guest is running. Whereas with qemu I give the network (192.168.136.0/24) on the fly, and assign static IP address in the command-line. So basically when I close my VM the static IP address and network is gone. I am going to ask my question in the virtualization forum, as it may be more appropriate, thanks |
Hello,
I have reported this thread to be reviewed and moved, if need be. If it is moved, your other thread will be closed in favor of this thread. Cheers, Josh |
You would need to bridge the network adapter in the VM instead of host only. That or NAT and port forward the port(s)
|
Thanks, I asked the question here and the answer for me was to use "--natnet1". Because my static IP address is different from the default VirtualBox address range.
|
All times are GMT -5. The time now is 05:16 PM. |