Linux LVS Dr Configuration

Source: Internet
Author: User


Three servers, (1) Do the routing, (2) (3) Do Realserver

IP: 192.168.196.121 (1)

192.168.196.122 (2)

192.168.196.123 (3)

To install the Ipvsadm software on the (1) Load banlance machine

Can be found in the cluster directory, source code compiled installation is very troublesome, frequent errors, here do not speak.

To execute after

Service Ipvsadm Save (if you do not start the Save)

Service Ipvsadm Start

IP forwarding is turned on in the routing machine echo 1 >/proc/sys/net/ipv4/ip_forward

Set this IP as a load balanced ip-s RR for polling load balancing

Ipvsadm-a-T 192.168.196.120:80-s RR

Add load Balancer cluster members,-G route Mode-W weight value (can be changed here as required, and other options can be Ipvsadm--help)

Ipvsadm-a-T 192.168.196.120:80-r 192.168.196.122-g-W 1
Ipvsadm-a-T 192.168.196.120:80-r 192.168.196.123-g-W 1

Configure a Load Balancer virtual IP address

Ifconfig eth0:0 192.168.196.120 broadcast 192.168.196.255 netmask 255.255.255.0 up


Realserver Configuration (2) (3) machine

We need to fill two servers with a lo:1 of such a network card. To ensure that the packet is back to our gateway when it is back in the package. That's the only way we have the DR model.

Ifconfig lo:1 192.168.196.120/32

echo 1 >/proc/sys/net/ipv4/conf/eth0/arp_ignore//arp ignore default to 0 give to 1 direct receive broadcast own

Echo 2 >/proc/sys/net/ipv4/conf/eth0/arp_announce//packets with send and receive lo:1 default to 0

Start httpd for testing

Write the index.html file in the/var/www/html/directory first

In order to ensure the test results, index.html content should be different.

Service httpd start//start Apache Services


Enter 192.168.196.120 on the browser

Refresh several times to show index.html content on different realserver


You can also view routing information on the load banlance machine at this time
Ipvsadm-ln--stats


PS: In order to ensure the restart after the effective, you need to add a network card step separately configured.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Linux LVS Dr Configuration

Related Article

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.