Server Fault is a question and answer site for system and network administrators. 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 have one domain name with MX Record all pointing to a single public IP. However, I have different servers which all should use the same domain on different public IPs. Since all of the traffic to my domain comes on a single IP, I want to forward some of it (based on port) to the other IPs. My services include email server, SIP server, apache, etc. I am using Ubuntu 10 server edition on all machines.

I guess I will need to set up some kind of proxy/firewall to do this. I also think that I will need to keep the originating IPs of the clients which access those services, so the router will need to rewrite the IP addresses in both directions so that my clients all use the same IP and all is transparant to them.

What kind of setup can you recommend me for this thing? Do I need a proxy server/firewall like iptables or there is another way.

All best, Angel

share|improve this question
Can you explain why do you need to have everything going trough the same IP address ? the purpose of MX and SRV records are precisely to let you move email and SIP to different machines... – b0fh Aug 1 '10 at 1:31

Why don't you simply add additional host entries to your domain, like, etc, each pointing to the relevant server? It's a better solution than with some redirection, IMHO.

share|improve this answer
Yes, I can do that, but time is pressing. Updating this domain would take several days and I want to get this thing running faster. – akafazov Aug 1 '10 at 1:32
Updating the domain - by adding new A records for example - shouldn't take any time at all – Daniel Lawson Aug 1 '10 at 2:02

redir. That will do what you want. However SvenW is right. You should just update dns as well.

share|improve this answer
Thank you for your reply. However I want to redirect UDP as well. IPTABLES cames in mind, I have never used it. Can it do the job? – akafazov Aug 1 '10 at 2:15
Yep, iptables can certainly do that. – Nathan Powell Aug 1 '10 at 11:18

If your outward facing server is Linux you should be running an iptables firewall on it. Shorewall is the one I use. It comes with example configurations for various situations. Its documentation covers forwarding from the firewall to appropriate servers. It also covers redirecting muliple IP addresses from the firewall to servers behind it. See the documentation at

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.