码迷,mamicode.com
首页 > 其他好文 > 详细

lvs fullnat+ECMP【2】安装keepalived+ipvsadm+quaage

时间:2018-10-24 19:55:57      阅读:466      评论:0      收藏:0      [点我收藏+]

标签:允许   kernel   log   没有   copyright   active   dir   home   build   

1、复制lvs-tools压缩包
cd lvs-fullnat-synproxy/
cp lvs-tools.tar.gz /home/pukong
cd /home/pukong/
tar xzf lvs-tools.tar.gz;

解压缩完之后,会有一个tools文件夹。

2、安装keepalived

cd /home/pukong/tools/keepalived;
yum -y install popt-devel openssl-devel
./configure --with-kernel-dir="/lib/modules/`uname -r`/build";

执行完上一步,出现一下信息,表示keepalived编译成功

Keepalived configuration
------------------------
Keepalived version       : 1.2.2
Compiler                 : gcc
Compiler flags           : -g -O2
Extra Lib                : -lpopt -lssl -lcrypto 
Use IPVS Framework       : Yes
IPVS sync daemon support : Yes
IPVS use libnl           : No
Use VRRP Framework       : Yes
Use Debug flags          : No

然后继续执行一下步骤

make;
make install;
mkdir /etc/keepalived -pv
cp -a bin/keepalived /sbin/
cp -a keepalived/etc/init.d/keepalived.init /etc/init.d/keepalived
cp -a keepalived/etc/keepalived/keepalived.conf /etc/keepalived
cp -a keepalived/etc/init.d/keepalived.sysconfig /etc/sysconfig/keepalived

2.1检测keepalived是否安装成功

[root@lvs-fullnat-one ~]# service keepalived status
keepalived is stopped
[root@lvs-fullnat-one ~]# service keepalived start
Starting keepalived:                                       [  OK  ]
[root@lvs-fullnat-one ~]# service keepalived status
keepalived (pid  9057) is running...
[root@lvs-fullnat-one ~]# 

3、安装ipvsadm

注:这里必须安装压缩包中的ipvsadm,因为yum源中的ipvsadm是没有fullnat模式参数的。

cd /home/pukong/tools/ipvsadm;
make;
make install;

3.1、检测ipvsadm是否安装成功

[root@lvs-fullnat-one ipvsadm]# ipvsadm -ln
IP Virtual Server version 1.2.1 (size=4194304)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  192.168.200.100:443 rr persistent 50
TCP  10.10.10.2:1358 rr persistent 50
  -> 192.168.200.200:1358         Masq    1      0          0         
TCP  10.10.10.3:1358 rr persistent 50
[root@lvs-fullnat-one ipvsadm]# ipvsadm -h
...
...
 --ipip         -i                   ipip encapsulation (tunneling)
 --fullnat      -b                   fullnat mode
 --masquerading -m                   masquerading (NAT)
...
...

出现以上回显表示成功。但有的后端在,有的后端不在回显中,是因为配置参数引起的。具体看keepalived的配置指导。

4、安装quaage(动态路由软件)

yum -y install quagga

4.1配置zebra服务

[root@lvs-fullnat-one quagga]# cat zebra.conf
hostname lvs-fullnat-one
password zebra
enable password zebra
[root@lvs-fullnat-one quagga]# service zebra start
Starting zebra:                                            [  OK  ]
[root@lvs-fullnat-one quagga]# chkconfig zebra on 
[root@lvs-fullnat-one quagga]# vtysh

Hello, this is Quagga (version 0.99.15).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

lvs-fullnat-one# conf t
lvs-fullnat-one(config)# exit
lvs-fullnat-one# wr
Building Configuration...
Configuration saved to /etc/quagga/zebra.conf
[OK]
lvs-fullnat-one# exit
[root@lvs-fullnat-one quagga]# 

4.2配置OSPF服务

[root@lvs-fullnat-one quagga]# cp ospfd.conf.sample ospfd.conf
[root@lvs-fullnat-one quagga]# service ospfd start
Starting ospfd:                                            [  OK  ]
[root@lvs-fullnat-one quagga]# chkconfig ospfd on

4.3配置日志路径

[root@lvs-fullnat-one quagga]# cat zebra.conf
log file /var/log/quagga/zebra.log
[root@lvs-fullnat-one quagga]# cat ospfd.conf
log file /var/log/quagga/ospfd.log
[root@lvs-fullnat-one quagga]# service zebra restart
Shutting down zebra:                                       [  OK  ]
Starting zebra:                                            [  OK  ]
[root@lvs-fullnat-one quagga]# service ospfd restart
Shutting down ospfd:                                       [  OK  ]
Starting ospfd:                                            [  OK  ]
[root@lvs-fullnat-one quagga]# 

5、修改内核参数 net.ipv4.ip_forward ,允许数据包转发

vi /etc/sysctl.conf --> net.ipv4.ip_forward=1 (永久开启)
sysctl -p

lvs fullnat+ECMP【2】安装keepalived+ipvsadm+quaage

标签:允许   kernel   log   没有   copyright   active   dir   home   build   

原文地址:http://blog.51cto.com/9346709/2308392

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!