Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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 (1.2.2.3 in this example) -> host (example: 192.168.1.10) & guestVM (example: 192.168.1.11)

If you use NAT, you can forward a port only once. How would your router know when to forward traffic on your WAN IP 1.2.2.3:80 to internal IP 192.168.1.10 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
add comment

Your Answer

 
discard

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.