LVSfullnat安装
阿里巴巴开源LVS fullnat (内核要求2.6.32)
成都创新互联公司服务项目包括余干网站建设、余干网站制作、余干网页制作以及余干网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,余干网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到余干省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
1、下载 fullnat LVS源码
wget https://github.com/alibaba/LVS/tree/lvs_v2 #版本2,建议使用这个版本
wget https://github.com/alibaba/LVS/archive/master.zip
unzip aster.zip; #解压下载的源码,主要有以下文件目录,其中 kernel目录是内核源码,tools里有ipvsadm 、keepalived、quagga(可以使用Quagga将linux机器打造成一台功能完备的路由器)、rpm
AUTHORS CHANGES docs kernel README.md tools
2、内核编译&安装
cd /usr/local/src/LVS-lvs_v2/kernel
请先安装好 perl perl-devel popt popt-devel libnl libnl-devel libssl libssl-devel openssl openssl-devel popt-static yum -y install ncurses ncurses-devel
去 掉 udev,udev的编译要求比较严格,容易在启动时报udev: missing sysfs features; please update the kernel or disable the kernel's CONFIG_SYSFS_DEPRECATED option;出现这个错问题也不大
vi .config
CONFIG_SYSFS_DEPRECATED=n
CONFIG_SYSFS_DEPRECATED_V2=n
mkdir -p /usr/src/kernels/2.6.32
make O=/usr/src/kernels/2.6.32 menuconfig; #选择模块需要编译的,exit退出,选择 YES保存
make mrproper
make O=/usr/src/kernels/2.6.32
make O=/usr/src/kernels/2.6.32 modules_install install
make时遇错
/bin/sh: perl: command not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
解决:yum -y perl perl-devel
make install遇错
WARNING: Couldn't open directory /lib/modules/2.6.32: No such file or directory
解决:ln -s /lib/modules/`uname -r` /lib/modules/2.6.32
问题:make install时报
sh /usr/local/src/LVS-lvs_v2/kernel/arch/x86/boot/install.sh 2.6.32 arch/x86/boot/bzImage \
System.map "/boot"
ERROR: modinfo: could not find module sd_mod
ERROR: modinfo: could not find module crc_t10dif
解答:这是因为现在运行的kernel有这些模块,而新编译的内核没有这些模块。如果不需要可直接忽视,如果需要编译到新的内核中,请修改 .config的相关参数为=m
使用新编译的内核vi /boot/grub/grub.conf 修改
default=0
reboot 重启系统,uname -r查看到的版本应该是2.6.32
3、安装keepalived
要求先安装好 openssl openssl-devel popt-static
cd /usr/local/src/master/tools/keepalived/
./configure --prefix=/usr/local/keepalived --with-kernel-dir=/usr/local/src/LVS-lvs_v2/kernel;
make;
最终结果:
Keepalived configuration
------------------------
Keepalived version : 1.2.2
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 Debug flags : No
make install;
默认路径: /usr/local
配置文件: /usr/local/etc/keepalived/keepalived.conf
自动启动脚本模板: /usr/local/etc/rc.d/init.d/keepalived
复制安装目录下的 /usr/local/keepalived/etc/rc.d/init.d/keepalived 复制到 /etc/init.d/
把/etc/init.d/keepalived 文件中
. /etc/sysconfig/keepalived 改为
. /usr/local/keepalived/etc/sysconfig/keepalived
keepalived启动时报 Starting keepalived: /bin/bash: keepalived: command not found
解决方法: ln -s prefix/sbin/keepalived /usr/sbin/
4、安装ipvsadm
依赖 libnl libnl-devel libssl-devel libssl
cd /usr/local/src/LVS-lvs_v2/tools/ipvsadm/
make;
make install;
make遇错
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o ../keepalived/keepalived/libipvs-2.6/libipvs.a -lpopt -lnl
/usr/bin/ld: cannot find -lnl
collect2: ld returned 1 exit status
make: *** [ipvsadm] Error 1
解决:yum -y install libnl libnl-devel libssl-devel libssl
5、安装quagga
cd /usr/local/src/LVS-lvs_v2/tools/quagga
./configure --prefix=/usr/local/quagga
make;
make install;
接下来的配置请参照 LVS操作手册
查看IPVS详情
查看 /proc/net目录下的
ip_vs ip_vs_app ip_vs_conn ip_vs_conn_sync ip_vs_ext_stats ip_vs_stats
网页标题:LVSfullnat安装
网页地址:http://azwzsj.com/article/jcpjic.html