One, VRRP (virtual Router Redundancy protocol)
The Virtual Routing Redundancy Protocol (Vsan Router Redundancy Protocol, abbreviated VRRP) is a routing protocol proposed by the IETF to address the single-point failure of a static gateway configured in a local area network, and a formal RFC2338 protocol standard was introduced in 1998. VRRP is widely used in edge networks, and it is designed to support the failure of IP data traffic in specific scenarios to cause confusion, allow the host to use a single router, and maintain connectivity between routers in the event that the actual first-hop router fails to use it in a timely manner.
Second, keepalived
Keepalived is an advanced application based on the VRRP protocol that handles highly available software for the network layer, transport layer, and application layer switching mechanism.
The role of keepalived is to detect the state of the Web server, if a Web server freezes, or a work failure occurs, keepalived detects and rejects the failed Web server from the system. When the Web server is working properly, Keepalived automatically joins the Web server to the server farm, all of which are done automatically, without the need for manual intervention, and the only thing that needs to be done manually is to repair the failed Web server.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/80/3F/wKiom1c8CY6A72YDABPGPNExXlQ318.png "title=" 1.png " alt= "Wkiom1c8cy6a72ydabpgpnexxlq318.png" style= "float:none;width:300px;/>650" this.width=650; "src=" http:// S5.51cto.com/wyfs02/m02/80/3c/wkiol1c8co3cmqm0abl0cq3hlre707.png "title=" 2.png "alt=" Wkiol1c8co3cmqm0abl0cq3hlre707.png "style=" white-space:normal;float:right;width:300px; "/>
Third, installation keepalived
[Email protected] ~]# yum-y install keepalived
In our network environment, keepalived exists in the intranet IP as shown in:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/42/wKioL1c8QP_DIOrOAABkQ9TB8uI477.png "title=" Qq20160518-0.png "alt=" Wkiol1c8qp_dioroaabkq9tb8ui477.png "/>
To configure the intranet IP, operate as follows: (no need to ignore this step)
[Email protected] ~]# cd/etc/sysconfig/network-scripts[[email protected] network-scripts]# vi./ifcfg-eth0device= Eth0hwaddr=00:2b:00:2e:00:d0type=ethernetuuid=ffffffff-ffff-ffff-ffff-ffffffffffffonboot=yesnm_controlled= Yesbootproto=staticipaddr=192.168.9.12netmask=255.255.255.0gateway=192.168.9.254[[email protected] network-scripts]#/etc/init.d/network Restart
To edit a keepalived configuration file:
[[email protected] ~]# vi /etc/keepalived/keepalived.confvrrp_instance vi_1 { state MASTER interface eth0 Virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type pass auth_pass 1111 } virtual_ipaddress { 192.168.9.3 }}virtual_server 192.168.9.3 80 { delay_loop 6 lb_algo rr lb_kind nat nat_mask 255.255.255.0 persistence_timeout 50 protocol Tcp real_server 192.168.9.12 80 { weight 1 http_get { url { path / status_code 200 } connect_timeout 3 } } real_server 192.168.9.13 80 { weight 1 HTTP_GET { url { path / status_code 200 } connect_timeout 3 } }}
.13 configuration Similar on server, omitted here, just set status to backup
Iv. Start keepalived
[Email protected] ~]#/etc/rc.d/init.d/keepalived startstarting keepalived: [OK]
You will see the boot information for keepalived, and the relevant parameters are stop and restart
At this point through ifconfig is not to see the VIP information, with the following command to see whether the VIP is bound:
[[Email protected] ~]# IP addr Show eth0
At the same time, you can also view the health of the daemon thread and view it through the following commands:
[Email protected] ~]# tail-20/var/log/messages
Five, network mapping
When the keepalived run up, found that the curl intranet ip:192.168.9.3 is feasible, but the external network ip:200.32.152.121 inaccessible, showing this site can ' t is reached. By communicating with the server-hosted network team, the simplified network topology diagram below shows that 192.168.9.x is an intranet segment at the switch level, and the current segment needs to be visible at the firewall level, and the extranet ip:200.32.152.121 bound to our VIP on the firewall : On the 192.168.9.3.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/80/3F/wKiom1c8CY6A72YDABPGPNExXlQ318.png "title=" 1.png " alt= "Wkiom1c8cy6a72ydabpgpnexxlq318.png" style= "float:none;"/>
Related information:
Virtual Router Redundancy Protocol _ Baidu Encyclopedia
Keepalived_ Baidu Encyclopedia
Keepalived Official Guide
LVS Configuration on CentOS
This article is from "Leo's Technical Diary" blog, please be sure to keep this source http://shskey.blog.51cto.com/8310114/1774720
CentOS Installation keepalived