安装ucarp(支持IP的动态替换)

libpcap (http://www.tcpdump.org/) must be installed on your system, with
development files (headers).

http://download.pureftpd.org/pub/ucarp/README

ucarp的下载页说得很明白,要先安装libpcap包,好吧,先安装它吧。

下载libpcap的最新版,也可以在我的资源中找到。

假设你的版本是:libpcap-1.2.1.tar.gz

tar -zxf libpcap-1.2.1.tar.gz

cd libpcap-1.2.1

./configure

如安装过程中有如下提示:

configure: error: Your operating system's lex is insufficient to compile
 libpcap.  flex is a lex replacement that has many advantages, including
 being able to compile libpcap.  For more information, see
 http://www.gnu.org/software/flex/flex.html .
就是说flex不完全,好吧,我们再根据提示去下载flex

http://sourceforge.net/projects/flex/?source=dlp

我下载的版本是:flex-2.5.37.tar.bz2

如果你linux没安装bz2的解圧程序,那先安装

http://bzip.org/downloads.html

我下载的版本是:

tar -zxf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
sudo make install
安装完成之后,解压 flex-2.5.37.tar.bz2

 tar -jxvf flex-2.5.37.tar.bz2

cd flex-2.5.37

./configure

出现如下错误

checking for m4 that supports -P... configure: error: could not find m4 that supports -P

去 http://ftp.gnu.org/gnu/m4/下载m4的安装包

注意要下载最新版。

安装好m4之后,安装flex成功

再安装libpcap

还缺少bison包,再下载bison

http://ftp.gnu.org/gnu/bison/
所有的这些都安装好,libpcap总算安装好。

下载ucarp包

http://download.pureftpd.org/pub/ucarp/

我的版本是1.5.2

安装,应该没什么问题了。
执行

/usr/local/sbin/ucarp
提示错误:

/usr/local/sbin/ucarp: error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file or directory

经过验证,发现libpcap.so.1在/usr/local/lib下

执行以下命令

sudo cp /usr/local/lib/libpcap.so.1 /usr/lib

再执行ucarp

搞定

ucarp 1.5.2 - Mar 20 2013

--interface=<if> (-i <if>): bind interface <if>
--srcip=<ip> (-s <ip>): source (real) IP address of that host
--vhid=<id> (-v <id>): virtual IP identifier (1-255)
--pass=<pass> (-p <pass>): password
--passfile=<file> (-o <file>): read password from file
--preempt (-P): becomes a master as soon as possible
--neutral (-n): don't run downscript at start if backup
--addr=<ip> (-a <ip>): virtual shared IP address
--help (-h): summary of command-line options
--advbase=<seconds> (-b <seconds>): advertisement frequency
--advskew=<skew> (-k <skew>): advertisement skew (0-255)
--upscript=<file> (-u <file>): run <file> to become a master
--downscript=<file> (-d <file>): run <file> to become a backup
--deadratio=<ratio> (-r <ratio>): ratio to consider a host as dead
--shutdown (-z): call shutdown script at exit
--daemonize (-B): run in background
--ignoreifstate (-S): ignore interface state (down, no carrier)
--nomcast (-M): use broadcast (instead of multicast) advertisements
--facility=<facility> (-f): set syslog facility (default=daemon)
--xparam=<value> (-x): extra parameter to send to up/down scripts

Sample usage:

Manage the 10.1.1.252 shared virtual address on interface eth0, with
1 as a virtual address idenfitier, mypassword as a password, and
10.1.1.1 as a real permanent address for this host.
Call /etc/vip-up.sh when the host becomes a master, and
/etc/vip-down.sh when the virtual IP address has to be disabled.

ucarp --interface=eth0 --srcip=10.1.1.1 --vhid=1 --pass=mypassword \
      --addr=10.1.1.252 \
      --upscript=/etc/vip-up.sh --downscript=/etc/vip-down.sh


Please report bugs to bugs at ucarp dot org.






你可能感兴趣的:(ucarp)