Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.


  Search this Thread
Old 09-16-2011, 12:18 PM   #1
LQ Newbie
Registered: Aug 2011
Posts: 12

Rep: Reputation: Disabled
qemu vs VirtualBox user/hoset-only networking and port forwarding

I have a Linux server (SSH and Samba) running in VM with static address (
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= -redir tcp:22: -redir tcp: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 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.

Last edited by dashesy; 09-16-2011 at 12:22 PM. Reason: added P.S.
Old 09-18-2011, 12:24 AM   #2
LQ Newbie
Registered: Oct 2009
Distribution: debian ubuntu solaris FreeBSD
Posts: 26

Rep: Reputation: 4
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.

Most of the simple scenarios can be full filled with bridging the interfaces to the physical network on the host.
1 members found this post helpful.
Old 09-19-2011, 10:32 AM   #3
LQ Newbie
Registered: Aug 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
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 ( 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
Old 09-19-2011, 11:59 AM   #4
LQ Guru
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003

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.


Old 09-19-2011, 08:12 PM   #5
Senior Member
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,315

Rep: Reputation: 98
You would need to bridge the network adapter in the VM instead of host only. That or NAT and port forward the port(s)
Old 09-20-2011, 10:10 AM   #6
LQ Newbie
Registered: Aug 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
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.


port forwarding, qemu, virtual box

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shorewall: port forwarding problem, port is closed even after forwarding Synt4x_3rr0r Linux - Networking 2 12-13-2009 04:36 PM
LXer: Tech Tip: Port Forwarding in Virtualbox with VBoxManage LXer Syndicated Linux News 0 09-10-2009 11:20 PM
Limting openssh port forwarding per user onaias Linux - Security 4 01-10-2004 05:56 AM > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 12:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration