Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to forward an address in Linux/Ubuntu and not just ports?

Say I have a virtual machine in my Ubuntu-comp and I want both the VM and the Hosting OS to have apache running on port 80. And then I want to access the VM through xxxxx.domain.tld and the hosting os through yyyyyy.domain.tld?

I guess you can forward this through the hosting os apache to the other one, but what if I then want to use the same with other applications. For example: SSH, FTP and so on.

share|improve this question
up vote 0 down vote accepted

To directly answer your question, no that would not be possible. You can forward all external traffic to a single internal IP, but then your virtual machine would be unreachable.

A different approach!

So your setup would be:

(internet) -> Router ( in this example) -> host (example: & guestVM (example:

If you use NAT, you can forward a port only once. How would your router know when to forward traffic on your WAN IP to internal IP or 11?

You can choose the forwarding option of the host and still be able to SSH into your virtual machine, by forwarding a different external port like 12112 to the internal IP of the virtual machine on port 22. When you want to SSH from outside you just fill in port 12112 instead of port 22.

share|improve this answer
As expected then. Thanks – neme Jan 4 '12 at 16:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.