LVS Server Load balancer configuration script

Source: Internet
Author: User

#####

#/Bin/bash

# Set director for Dr

VIP = 192.168.115.200

Dip = 192.168.115.10

Rip1 = 192.168.115.20

Rip2 = 192.168.115.30

./Etc/init. d/functions

Case "$1" in


Start)

Echo "1">/proc/sys/NET/IPv4/ip_forward

/Sbin/ifconfig eth0: 0 192.168.115.200 broadcast 192.168.115.200 netmask 255.255.255.0 up

/Sbin/route-host 192.168.115.200 Dev eth0: 0


/Sbin/iptables-F

/Sbin/ipvsadm-C


/Sbin/ipvsadm-a-t 192.168.115.200-s rr

/Sbin/ipvsadm-a-t 192.168.115.200-r 192.168.115.20-G

/Sbin/ipvsadm-a-t 192.168.115.200-r 192.168.115.30-G


Touch/var/lock/subsys/ipvsadm. Lock

Echo "s is running OK"


;;


Stop)


Echo "0">/proc/sys/NET/IPv4/ip_forward

/Sbin/ipvsadm-C

/Sbin/ifconfig eth0: 0 down

Rm-fr/var/lock/subsys/ipvsadm. Lock

Echo "s is stopping OK"


;;

Status)

If [-E/var/lock/subsys/ipvsadm. Lock]; then

Echo "s is running"

Else

Echo "s is stopped"

Fi


;;


*)

Echo "sage: $0 {START | stop }"


Esac


This article is from the "frequently used documentation" blog, please be sure to keep this source http://yujianglei.blog.51cto.com/7215578/1561586

LVS Server Load balancer configuration script

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.