{"id":82,"date":"2012-11-02T19:10:30","date_gmt":"2012-11-02T17:10:30","guid":{"rendered":"https:\/\/dlshad.net\/?p=82"},"modified":"2012-11-02T19:10:30","modified_gmt":"2012-11-02T17:10:30","slug":"implementing-a-load-balancingfailover-configuration","status":"publish","type":"post","link":"https:\/\/dlshad.net\/implementing-a-load-balancingfailover-configuration\/","title":{"rendered":"Implementing a load-balancing\/failover configuration"},"content":{"rendered":"

Virtus 2 is coming soon , at the last step , I was thinking about the load balancing and how I can\u00a0 manage the overload with 10 Servers that we will have.<\/p>\n

Regardless the way of passing the DPI , we will use OPENVPN as the VPN Service , so \ud83d\ude42<\/p>\n

Implementing a load-balancing for openVPN<\/strong><\/p>\n

Client<\/h3>\n

The OpenVPN client configuration can refer to multiple servers for load balancing and failover. For example:<\/p>\n

\n
remote server1.mydomain\r\nremote server2.mydomain\r\nremote server3.mydomain\r\n\r\n<\/strong><\/pre>\n<\/blockquote>\n

will direct the OpenVPN client to attempt a connection with server1, server2, and server3 in that order. If an existing connection is broken, the OpenVPN client will retry the most recently connected server, and if that fails, will move on to the next server in the list. You can also direct the OpenVPN client to randomize its server list on startup, so that the client load will be probabilistically spread across the server pool.<\/p>\n

\n
remote-random<\/strong><\/pre>\n<\/blockquote>\n

If you would also like DNS resolution failures to cause the OpenVPN client to move to the next server in the list, add the following:<\/p>\n

\n
resolv-retry 60<\/strong><\/pre>\n<\/blockquote>\n

The 60<\/strong> parameter tells the OpenVPN client to try resolving each remote<\/strong> DNS name for 60 seconds before moving on to the next server in the list.<\/p>\n

The server list can also refer to multiple OpenVPN server daemons running on the same machine, each listening for connections on a different port, for example:<\/p>\n

\n
remote smp-server1.mydomain 8000\r\nremote smp-server1.mydomain 8001\r\nremote smp-server2.mydomain 8000\r\nremote smp-server2.mydomain 8001<\/strong><\/pre>\n<\/blockquote>\n

If your servers are multi-processor machines, running multiple OpenVPN daemons on each server can be advantageous from a performance standpoint.<\/p>\n

OpenVPN also supports the remote<\/strong> directive referring to a DNS name which has multiple A<\/strong> records in the zone configuration for the domain. In this case, the OpenVPN client will randomly choose one of the A<\/strong> records every time the domain is resolved.<\/p>\n

Server<\/h3>\n

The simplest approach to a load-balanced\/failover configuration on the server is to use equivalent configuration files on each server in the cluster, except use a different virtual IP address pool for each server. For example:<\/p>\n

server1<\/strong><\/p>\n

\n
server 10.8.0.0 255.255.255.0<\/strong><\/pre>\n<\/blockquote>\n

server2<\/strong><\/p>\n

\n
server 10.8.1.0 255.255.255.0<\/strong><\/pre>\n<\/blockquote>\n

server3<\/strong><\/p>\n

\n
server 10.8.2.0 255.255.255.0\r\n\r\nThe source <\/a>\r\n<\/strong><\/pre>\n<\/blockquote>\n

 <\/p>\n

 <\/p>\n

 <\/p>\n

 <\/p>\n

\"Share<\/a>