LVS-DR模型安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LVS-DR模型安装相关的知识,希望对你有一定的参考价值。

IP规划:          

   Director eth0   DIP:  192.168.2.230

            eth0:0 VIP:  192.168.2.231

        RS1:eth0:192.168.2.229

            lo:0:vip:192.168.2.231

        RS2:eth0:192.168.2.228

            lo:0:vip:192.168.2.231


1.[[email protected] /]# cd /proc/sys/net/ipv4/conf/

     [[email protected] conf]# pwd

     /proc/sys/net/ipv4/conf


2.[[email protected] conf]# sysctl -w net.ipv4.conf.eth0.arp_announce=2

   net.ipv4.conf.eth0.arp_announce = 2

  [[email protected] conf]# sysctl -w net.ipv4.conf.all.arp_announce=2

   net.ipv4.conf.all.arp_announce = 2


3.[[email protected] conf]# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore 

  [[email protected] conf]# echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore


4.配置vip:

[[email protected] conf]# ifconfig lo:0 192.168.2.231 broadcast 192.168.2.231 netmask 255.255.255.255 up

5.添加路由:[[email protected] conf]# route add -host 192.168.2.231 dev lo:0

            [[email protected] conf]# route add -host 192.168.2.231 dev eth0:0

6.yum install ipvsadm -y

   ipvsadm -C

[[email protected] conf]# ipvsadm -L -n

IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn

TCP  192.168.2.231:80 wlc

  -> 192.168.2.228:80             Route   1      0          0         

  -> 192.168.2.229:80             Route   2      0          0         

[[email protected] conf]# 

7.关闭所有防火墙和selinux,开始测试负载效果


本文出自 “山猫” 博客,谢绝转载!

以上是关于LVS-DR模型安装的主要内容,如果未能解决你的问题,请参考以下文章

LVS-DR模型详解及演示

lvs-dr模型负载均衡

LVS-DR模型配置

基于lvs-dr模型的discuz负载均衡实现

LVS-DR模型实现调度

LVS-DR模型示例讲解