Redundant services based on DNS polling with VRRP under FreeBSD
Realizing DNS Robin Round, redundant services, based on traditional DNS Robin Round, Web Load Balance solution, there is a significant shortcoming, that is, one of the servers are dead (service is over, or power off The hard fault such as the hard disk is a hard fault.), The web service that is turning to the server will be a dead point, all the Web Request on the server will return the service unpacked results.
With VRRP (Virtual Router Redundancy Protocol, virtual route redundant protocol) can avoid this problem.
Suppose you have 3 dual-NIC WebServer, and its internal / external network IP is: 1) 192.168.0.1/202.1.1.1 2) 192.168.0.2/202.1.1.2 3) 192.168.0.3/202.1.1.3
Robin Round is made in DNS, ie www.company.com points 202.1.1.1, 202.1.1.2, 202.1.1.3, using domain name query tools to get the following results: # Host www.com www.company.com HAS AddRESS 202.1.1.1 www.company.com Has Address 202.1.1.2 www.company.com Has Address 202.1.1.3
At this time, add the VRRP function will not have a dead point. For example, the second Server Down, the first Server or the third Server (which Server takeover service can be defined by the configuration file) will be tied to the IP alias of 202.1.1.2 in its own network card, take over the second machine Services make Web Server do not have access to death.
FreeVRRPD Features: * Daemon Compatible RFC 2338 * Implementing Virtual Address * Support Multi-VRID * Tell the health status of the primary server with the BPF package from the server * to change the IP and route from the server within 3 seconds after the primary server DOWN. * Clear ARP Cache in all hosts (this is very important for yourself). * You can choose one service between different from the server. * The host can be set to the master or from the slave. * If the primary server UP, after restoring the normal operation, automatically downgrade from the server * can prevent address conflicts * multi-thread VRRP daemon * Support clear text password * Mask support virtual address
Install FreeVRRPD in the three machines (freebsd 4.6 Freevrrpd version is 0.8.4, home: home: home: home: home: http://www.bsdshell.net/), suppose your installation environment is FreeBSD 4.6, if it is a veteran version, please Note that your core must have support for BPF devices.
# cd / usr / ports / net / freevrrpd / # make all install distclean
Cp /usr/local/etc/freevrrpd.conf.sample /usr/local/etc/freevrrpd.conf and make appropriate modifications to FreeVRRPD.conf, run /usr/local/etc/rc.d/freevrrpd.sh start .
Reference: RFC2338 http://www.bsdshell.net/
############ !! warning !! You must copy /usr/local/etc/vrpd.conf.sample to ## /usr/local/etc/vrrpd.conf and configure / usr / Local / etc / vrrpd.conf ## before running vrrpd. to run vrrpd type / usr / local / sbin / vrrpd ########### ---- lonely planet ---- Waiting ... [Vrid] serverid = 1Interface = lnc0priority = 255addr = 192.168.1.20 [vrid] serverid = 2 interface = lnc0Priority = 254Addr = 192.168.0.21
[Vrid] serverid = 1Interface = lnc0Priority = 254Addr = 192.168.1.20 [vrid] serverid = 2 interface = lnc0priority = 255ADDR = 192.168.0.21
2) Configure FreeVRRPd Until this point, both machines have been equal. Now, you need to choose which FWLB is going to be your primary. On this machine, Copy /usr/local/etc/freevrrpd.conf.sample to / usr / Local / etc / freevrpd.conf. Edit The File, And Configure It Along The Following Lines:
# public-facing vrid [vrid] serverid = 1 interface = fxp0 priority = 255 addr = 198.123.111.1/32 password = vrid1 vridsDep = 2
# Backend Vrid [VRID] ServerId = 2 Interface = fxp1 priority = 255 addr = 10.0.0.1/32 password = vrid2 vridsDep = 1
How To Configure Failover Scenario with freevrrpd (478 Total Words in this text) (Viewed: 6762 Times)
Setting Up Failover System with FreeVRRPDIF You Have More Than One Server for One Service, You'll Want To Use IT, Right? You'll Need To Use?
One Possible Way Is With FreeVRRPD Software. It Uses Virtual IP, Which Can Be Assigned to Many Different NICS.
So, for example, one server has IP 192.168.0.10 and it runs heavly loaded httpd server. When it crashes, service is down. If you were using freevrrpd daemon, second server would takeover the IP (192.168.0.10), and service would be up & running on second server.The basic idea is, to have two servers for one service. Every server is master (priority 255) for one virtual IP and slavefor second virtual IP (priority 250) .In our case, Server1 is master for 192.168.0.10 and in the same time slave for 192.168.0.11.If Server1 goes down, Server2 (slave server for IP 192.168.0.10) notice that and takes over that IP Now Server2 has two aliaseson one interface Result:.. customers see's No Service Downtime, As Takeover Time IS At Max 3 Seconds.
IF Server2 (Master For 192.168.0.11) Goes Down, Server 1 See's That and Takeover The IP.
In EVERY CASE, Service Stays Up and That's Our Goal.
0. Starting Upupdate Ports (Only Net Section IS NEEDED), TOP Make Sure, You'Ve Got The Latest Version (0.8.4 in Time of Writing).
CD to / usr / ports / net / freevrrpd and read pkg-descr .hen done, install the port with make install clean as root.
When installed, you'll find freevrrpd.conf.sample in / usr / local / etc /. Rename it to freevrrpd.conf. This is well documented conf file, so you should not have any problems. But, anyway, here's my CONFIG FILE:
Server1 (Master For IP: 192.168.0.10)
[Vrid] serverid = 2 interface = fxp0 priority = 255 addr = 192.168.0.10 [vrid] serverid = 1 interface = fxp0 priority = 250 addr = 192.168.0.11 Server2 (Master For IP: 192.168.0.11)
[VRID] serverid = 2 interface = fxp0 priority = 250 addr = 192.168.0.10 [VRID] serverid = 1 interface = fxp0 priority = 255 addr = 192.168.0.11Here I ignore password tag, but you can use it, if you like.
The last thing is to setup DNS Servers, To Point To Both Virtual AddResss:
Notes? WWW in A 192.168.0.10? WWW in A 192.168.0.11
1. Explanation [VRID] defines VIrtual ID section. Every section must begin with this. Serverid = 2 says, we're dealing with second VRID. Interface = fxp0 states, we'll be using virtual IP on this interface as alias priority = 255 Means, this Machine Is The Master for this Vrid (this Virtual IP, Stated Below) addr = 192.168.0.10 is The Virtual IP, for Which this Machine is Master.
While this is a nice thing to have, one must be verry carefull not to set serverid's or priority's wrong. Take extra care or ARP tables will go crazy! Another thing, If you planing using 3, 4, 5 or even more servers per service Make Sure You have enough / dev / bpf devices, Because Every Vrid takes one.you can make the used / dev / makedeev BPF10, for 10 / dev / bpf devices.