Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 am looking to create a load balancing server. Essentially here is what I want to do:

I have a public IP address, lets say I have a second public IP address, lets say I have a website, www.f.com point to via an A record. I want that Ubuntu server to forward traffic like this:

  • Port 80 traffic is forwarded to on port 60,000 and port 60,001.
  • Port 443 traffic is forwaded to on port 60,010 and port 60,011.
  • Port 25 traffic is forwared to on port 60,020 and port 60,021

The port forwarding is more important then being able to load balance.

I look forward to some responses. Both server and are both running Ubuntu 12.04 server edition.

share|improve this question
This seems more like a proxy setup and less of a load balancer...you can use iptables to do forwarding for you. – sparticvs Dec 3 '12 at 4:29
Is it necessary to keep into account whether the destination port is up? If not, iptables DNAT rules should be able to do it... – Gert van den Berg Dec 3 '12 at 6:27
using LVS would make more sense here than iptables – Rui F Ribeiro Nov 16 '15 at 7:40

I would recommend Pound (http://www.apsis.ch/pound). It's lightweight, easy to configure, handles https quick and efficient, and does exactly what you want.

share|improve this answer

With a combination of iptables rules you will be able to achieve load balancing using the examples at this link

There are some pretty good examples that you will be able to follow. My experience with advanced iptables configurations is limited, but that link should point you in the right direction

share|improve this answer

If you are looking to load balance data. I might recomend you to use varnish. It is easy to install and set and easy to add nodes later

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.