How to use pfSense for load balancing for your web services

Source: Internet
Author: User
Tags pfsense
How to use pfSense for load balancing for your web services

Note: pfSense has two types of load balancing: one is to set multiple WAN for dual-line load balancing, and the other is to do inbound-loadbalancer for web servers in the LAN.

This article shows how to use pfSense 2.0 to configure load balancer for multiple web servers ). It is assumed that you already have a pfSense server and more than two apache servers in your network environment, and have a certain knowledge of pfSense.

1.Prerequisites

A installed pfSense 2.0 machine (if it is your peripheral firewall, it is recommended to install it on a physical machine)

At least 2 apache servers (virtual machines)

Ensure that code files are synchronized between apache servers (rsync, cororsync, or other files can be updated between web servers)

2.Configure pfSense

PfSense can use the server load balancer function to share the specific request pressure among multiple servers, which is very helpful for servers with multiple applications, because you can distribute the load pressure to other nodes instead of killing one node.

2.1 Monitor

We officially started. Click Services> Load Balancers and select the Monitor label.

Click the + plus sign on the right to add a record. enter the monitor Name and Description (in this example, we use ApacheClusterMon for both the Name and Description) and set the Type to HTTP, host address: Set an unused IP address (we will create a virtual IP address on this IP address later. this virtual IP address will be allocated to the failover node. note: you can also set it to a wan ip.) Save the default 200 OK value for HTTP Code, and then click Save to Save the modification and Apply Changes for the modification to take effect.

Pool 2.2

Create a server pool. Click the + button of the Pools Tag to add a pool.

I specify ApacheSrvPool as the service pool name, set Mode to Load Balance, and Port 80 (. This port is the listening port of your backend server. of course you can set other ports for other applications, not necessarily web ). Set the ApacheClusterMon created in the previous step for this pool, Add all your web server IP addresses to this pool in sequence, Add to pool, save and apply.

2.3 Virtual Server

In the last step, select the Virtual Servers tab and click + to add a record. Enter the name ApacheClusterVirtualServer, description, and IP address. the IP address is the same as the unused IP address in step 1. port 80. all connections sent to this WANIP: port will be forwarded to the server pool. Select the Virtual Server Poll created in the previous step. Submit and apply.

Done! Do not forget to add firewall rules for the virtual server IP address and pool.

Receive free Brothers IT education original linux O & M engineers video/detailed linux tutorial, details consulting official website Customer Service: http://www.lampbrother.net/linux/

Learn PHP, Linux, HTML5, UI, Android and other video tutorials (courseware + Notes + video )! Contact Q2430675018


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.