In this post we’ll see how to configure a load balancer on a NSX Edge Router.
In the previous post a NAT has been configured to allow access from external networks:
Now the edge router will act as a load balancer too: connection to the edge router with destination port 2222 will be balanced on both internal VM using the port 22.
Go to “Networking & Security -> NSX Edges”, double click over the edge router and go to “Load Balancer -> Application Profiles”. Add a new TCP profile:
Other options are available when choosing HTTP or HTTPS protocols. Go now to “Pools” and create a new pool with both internal VMs:
Go to “Virtual Servers” and add a TCP virtual server bound to the TCP_wo_persistence profile and to the SSH_2222_Pool:
Finally go to “Global Configuration” and enable the load balancer:
Remind that the firewall must allow connection to the load balancer IP address.
Now SSH connection from external networks to the IP address of the edge router using the port 2222 will be balanced to both VMs using a round-robin algorithm:
client$ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2222 firstname.lastname@example.org hostname ubuntu1 client$ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2222 email@example.com hostname ubuntu3