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

I'd like to provide services from several internal machines, via an internal DNS to external clients.

This is from a home based single external IP address, on a consumer level router, I'm expecting to have to provide the internal routing from a machine inside the network.

At the moment I have the machines resolving for other internal clients, providing they have the internal DNS in their list of name servers.

However, if I try to resolve these names / use the services from external clients, they just resolve to the gateway / DNS box, I need the internal machines to resolve instead.

Port forwarding doesn't help, because I have multiple boxes providing similar services (ssh, http/https, mail, etc.)

This diagram may help explain the setup, and what I'd like to do... (or what it's called ;) )

Any help would be much appreciated.

Finally, do I just need to do this with a reverse proxy?


share|improve this question

The pproblem is not DNS, the problem is IPs.

If you want external access, you want externally-accessible IPs. For one machine, port forwarding does the trick. For multiple machines, you can forward for example port 22 on one machine to port 22 on thhe router, and port 22 of the another machhine to say, port 122 on the router. You will ssh to

If expiciltly specifing port is not an option, for http/https protocols, reverse proxy will do, for mail single machine should be enough. For ssh and most other protocols, your only way is to have multiple public IPs

share|improve this answer

So, I've decided to add my own answer, as the answers given didn't really answer the question explicitly.

Using Nginx I setup a reverse proxy that resolves names against the internal DNS. This covers web services (you can add more listen ports e.g. to reach web admin, or mail services. (I only have one mail server, which is fairly typical, so it's just port forwarded, and doesn't need the proxy)

server {
    listen       80;

    access_log   /var/log/nginx/proxy.access.log;

    location / {            
        resolver; # Local DNS resolution
        proxy_pass        http://$host$uri; # wildcard 
        proxy_redirect    off;
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real-IP       $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;

To handle ssh I decided I could just use port forwarding, however it's possible to configure sshd to do a reverse proxy via a tunnel, this answer has some details:

share|improve this answer

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.