Layer 4 load balancing NAT mode

NAT stands for Network Address Translation.

In the NAT mode, the load-balancer will route traffic between user and server by changing destination IP address of the packets.

TCP connection overview

TCP connection is established between the client and the server.
The loadbalancer just ensures a client is always forwarded to the same server.
layer4_nat_tcp_connection

Data flow

As shown below, the clients get connected to the service VIP.
The load balancer chooses a server in the pool then forwards packets to it by changing destination IP address.
layer4_nat_data_flow

Pros and cons

Pros

  • fast load balancing
  • easy to deploy

Cons

  • infrastructure intrusive: need to change the default gateway of the servers
  • The server default gateway must use the load balancer, in order to do reverse NAT operation.
  • output bandwith is limitated by loadbalancer output capacity

When use this architecture?

  • where response time matters
  • where no intelligence is required
  • when output capacity of the load-balancer won’t be a bottleneck in a near future
  • when nothing but the default gateway of the servers can be changed

Links

Advertisements

About Baptiste Assmann

Aloha Product Manager HAProxy consultant
This entry was posted in Aloha, architecture, layer4 and tagged , , . Bookmark the permalink.

9 Responses to Layer 4 load balancing NAT mode

  1. StevenLeRoux says:

    Setting up the SNAT and an L3 interface in the same L2 than servers will avoid you to reconfigure any default gateway so that’s even easier to deploy.

  2. Pingback: layer 4 load balancing Direct Server Return mode | Exceliance – Aloha Load Balancer

  3. free ipad 2 says:

    Great review! You actually covered some interesting things in this post. I came across it by using Yahoo and I’ve got to admit that I already subscribed to the RSS feed, will be following you on my iphone 🙂

  4. William says:

    Do you think this would handle an application that requires multiple connections (not just a single connection) between the client & server? I am looking for a load balancer that will handle this situation

    • Hi William,

      Of course it will work.
      In that case, I guess all the connection from a single user must go to the same server, so use a balancing algorithm based on source IP address (an alternative solution exists if all your services rely on TCP).
      You can download an evaluation Aloha VM on our website: http://exceliance.fr/en/trial-versions-0 and try it in a POC.
      We’ll be keen to help you configure your appliance for your POC.

      Regards

  5. William says:

    Thanks Baptiste, you are correct about the single user communicating to the same server requirement plus all communication is TCP. I should add that this is a real-time communication and we know that reserve proxy load balancing breaks the communication. I do have a support ticket open (about another matter) so perhaps that would be the best way to continue this discussion? I have the virtual appliance installed already but not set-up yet.

  6. Pingback: layer 4 load balancing Direct Server Return mode | HAProxy Technologies – Aloha Load Balancer

Leave a Reply to StevenLeRoux Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s