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

在CentOS6.5下配置安装LVS

时间:2015-09-22 16:19:12      阅读:935      评论:0      收藏:0      [点我收藏+]

标签:

先上一个图,在内网测试机上安装了一个虚拟机,已经安装好了CentOS

乖乖连wget都没有安装,先安装wget吧

sudo yum install wget

 

 

技术分享

下载LVS

wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz

技术分享

解压

tar zxvf ipvsadm-1.26.tar.gz
cd ipvsadm-1.26

 

make && make install

 

make -C libipvs
make[1]: Entering directory `/root/ipvsadm-1.26/libipvsgcc -Wall -Wunused -Wstrict-prototypes -g -fPIC -DLIBIPVS_USE_NL  -DHAVE_NET_IP_VS_H -c -o libipvs.o libipvs.c
make[1]: gcc: Command not found
make[1]: *** [libipvs.o] Error 127
make[1]: Leaving directory `/root/ipvsadm-1.26/libipvsmake: *** [libs] Error 2

 

出错了,原来是没有找到gcc 哪么安装gcc吧

yum install gcc

 

Complete! 安装成功再使用

make && make install

 

又出错了

libipvs.c:1051: error: ‘NL_OK’ undeclared (first use in this function)
libipvs.c: In function ‘ipvs_get_daemon’:
libipvs.c:1071: error: ‘NLM_F_DUMP’ undeclared (first use in this function)
libipvs.c:1072: error: too many arguments to function ‘ipvs_nl_send_message’
make[1]: *** [libipvs.o] Error 1
make[1]: Leaving directory `/root/ipvsadm-1.26/libipvsmake: *** [libs] Error 2

 看看象是lib类型库的问题,安装以后库

yum install libnl*
make
ipvsadm.c:114:18: error: popt.h: No such file or directory
ipvsadm.c: In function ‘parse_options’:
ipvsadm.c:365: error: ‘poptContext’ undeclared (first use in this function)
ipvsadm.c:365: error: (Each undeclared identifier is reported only once
ipvsadm.c:365: error: for each function it appears in.)
ipvsadm.c:365: error: expected ‘;’ before ‘context’
ipvsadm.c:367: error: array type has incomplete element type
ipvsadm.c:368: error: ‘POPT_ARG_NONE’ undeclared (first use in this function)
ipvsadm.c:383: error: ‘POPT_ARG_STRING’ undeclared (first use in this function)
ipvsadm.c:394: error: ‘POPT_ARGFLAG_OPTIONAL’ undeclared (first use in this function)
ipvsadm.c:432: error: ‘context’ undeclared (first use in this function)
ipvsadm.c:432: warning: implicit declaration of function ‘poptGetContext’
ipvsadm.c:435: warning: implicit declaration of function ‘poptGetNextOpt’
ipvsadm.c:661: warning: implicit declaration of function ‘poptBadOption’
ipvsadm.c:661: error: ‘POPT_BADOPTION_NOALIAS’ undeclared (first use in this function)
ipvsadm.c:669: warning: implicit declaration of function ‘poptStrerror’
ipvsadm.c:670: warning: implicit declaration of function ‘poptFreeContext’
ipvsadm.c:677: warning: implicit declaration of function ‘poptGetArg’
ipvsadm.c:367: warning: unused variable ‘options_table’
make: *** [ipvsadm.o] Error 1

又出现了新问题,看起来像是popt类型库的问题

yum install popt*
make && make install

安装成功!

接下来安装 Keepalived

下载

wget http://www.keepalived.org/software/keepalived-1.2.4.tar.gz
tar zxvf keepalived-1.2.4.tar.gz
cd keepalived-1.2.4
 ./configrue
!!! OpenSSL is not properly installed on your system. !!!

原来是OpenSSL没有安装,哪么安装OpenSSL吧

yum install openssl-devel

再次 ./configure 成功

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

开始安装Keepalived

make && make install

安装成功

make -C genhash install
make[1]: Entering directory `/root/keepalived-1.2.4/genhashinstall -d /usr/local/bin
install -m 755 ../bin/genhash /usr/local/bin/
install -d /usr/local/share/man/man1
install -m 644 ../doc/man/man1/genhash.1 /usr/local/share/man/man1
make[1]: Leaving directory `/root/keepalived-1.2.4/genhash

开启路由转发

vi /etc/sysctl.conf

net.ipv4.ip_forward = 0

修改成

net.ipv4.ip_forward = 1

:wq保存

刷新一下系统变量,使配置值生效

sysctl -p
net.ipv4.ip_forward = 1

看到了输出变量为1

接下来

配置Real Server

由于我们的Real Server是windows2008主机

需要增加一个虚拟网卡

技术分享

 

配置网卡地址为

192.168.1.14

子网掩码为

255.255.255.255

技术分享

asdasdasd

在CentOS6.5下配置安装LVS

标签:

原文地址:http://www.cnblogs.com/hznet/p/4828828.html

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