I'm trying to get ucarp working on 2 Centos 6 servers running Apache.
I've configured both /etc/sysconfig/carp/vip-001.conf and /etc/sysconfig/network-scripts/eth0 and eth0:0 as such on serv1:
vip-001.conf :
# Virtual IP configuration file for UCARP
# The number (from 001 to 255) in the name of the file is the identifier
# $Id$
ID=001
# Set the same password on all mamchines sharing the same virtual IP
PASSWORD="MYPASSWD"
# You are required to have an IPADDR= line in the configuration file for
# this interface (so no DHCP allowed)
BIND_INTERFACE="eth0"
# Do *NOT* use a main interface for the virtual IP, use an ethX:Y alias
# with the corresponding /etc/sysconfig/network-scripts/ifcfg-ethX:Y file
# already configured and ith ONBOOT=no
VIP_INTERFACE="eth0:0"
# If you have extra options to add, see "ucarp --help" output
# (the lower the "-k <val>" the higher priority and "-P" to become master ASAP)
OPTIONS="-k 128 -P"
eth0 :
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:15:5D:09:16:0E"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="9cffb321-f06b-49ce-a075-72baecaa0395"
IPADDR=192.168.9.185
NETMASK=255.255.240.0
BROADCAST=192.168.15.255
NETWORK=192.168.0.0
GATEWAY=192.168.15.254
eth0:0 :
DEVICE=eth0:0
BOOTPROTO=none
ONBOOT=no
IPADDR=192.168.9.190
NETMASK=255.255.240.0
USERCTL=yes
IPV6INIT=no
Serv2 is basicaly the same with the little modifications dues to its IP.
But i can't manage to launch ucarp (ucarp start), and i keep on getting the error :
[ERROR] You must supply a valid virtual host id
Anyone has any idea of how to fix this ?
Thanks in advance !
EDIT 1 : Okay, after some tests, it seems ucarp doesn't use the vip-001.conf file I configured. When I try to launch it by configuring using the command line : ucarp start –vhid=1 It asks for a password (which i guess i can set using the –password option). So… Where do I set which files it uses ? I went through /etc/init.d/carp but it's seems just fine, and I haven't modified it so…
EDIT 2 : I Keep on getting "no IPADDR found in interface file ifcfg-eth0:" errors while trying to launch ucarp via sh -x /etc/init.d/carp start. I can't figure out how to fix it…
Best Answer
I found the problem.
Pay attention to the line 55 in the init script:
This is trying to get the IP address from the
ifconfig eth0
output. In the English language, it works fine becauseifconfig eth0
returns something like:therefore:
But in your language (French?),
ifconfig eth0
returns:Notice that it is "inet adr" instead of "inet addr", so the
ifconfig eth0 | sed -n 's/.*inet addr:\([^ ]*\) .*/\1/p' | head -n 1
returns nothing. This is reason why you getno IPADDR found in interface file ifcfg-eth0:
when starting UCARP.The fix is open the init script and change the line 55 to:
(just delete a "d" character)
or the simpler way is get the value of
$IPADDR
from the/etc/sysconfig/network-scripts/ifcfg-eth0
: