Centos LVS Dr server load balancer configuration description

Source: Internet
Author: User
Tags centos

Environment:

LVS/Dr server: 200.168.10.1
Real rip: 200.168.10.2
Real rip: 200.168.10.3

VIP: 200.168.10.10

LVS server configuration:

Disable iptables and selinux to prevent failure due to firewall and other reasons.

Install ipvsadm

Yum-y install ipvsadm *

Run the following script:

#! /Bin/bash
# Ipvs. sh

# Bind 200.168.10.10 to the eth0: 0 interface. The subnet mask is 4 255 so that 200.168.10.10 only has this ip address in this network segment and does not conflict with other ip addresses.
/Sbin/ifconfig eth0: 0 200.168.10.10 broadcast 200.168.10.10 netmask bandwidth limit 255 up
# Add 200.168.10.10 to the route table. It is best to add the route table to avoid having no ip addresses in the route table.
/Sbin/ifconfig route add-host 200.168.10.10 dev eth0: 0

# Clear existing records of ipvs
/Sbin/ipvsadm-C
# Add the virtual service rr representation algorithm (average allocation)
/Sbin/ipvsadm-At 200.168.10.10: 80-s rr
#-G indicates Dr mode,-I indicates ip-tun, and-m indicates NAT mode
/Sbin/ipvsadm-at 200.168.10.10: 80-r 200.168.10.2: 80-g
/Sbin/ipvsadm-at 200.168.10.10: 80-r 200.168.10.3: 80-g
/Sbin/ipvsadm-L-n

Linux real server configuration:

/Sbin/ifconfig lo: 0 200.168.10.10 broadcast 200.168.10.10 netmask bandwidth limit 255 up
/Sbin/ifconfig route add-host 200.168.10.10 dev lo: 0

Echo 1>/proc/sys/net/ipv4/conf/lo/arp_ignore
Echo 2>/proc/sys/net/ipv4/conf/lo/arp_annoounce
Echo 1>/proc/sys/net/ipv4/conf/all/arp_ignore
Echo 2>/proc/sys/net/ipv4/conf/all/arp_annoounce

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.