0

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...

PaKempf
  • 63
  • 1
  • 10

2 Answers2

0

In vip-001.conf etc. you don't set ID in the file, it comes from the filename. Delete that line starting with ID.

Serv2 should also have a slightly different k value in the .conf file to set the priority.

JamesRyan
  • 8,138
  • 2
  • 24
  • 36
  • I've deleted the ID=001 line but it still doesn't start, same error. (K value sonr serv2 is modified too). Also, the error comes with "Using [eth0] as a network interface". Shouldn't it be [Eth0:0] ? – PaKempf May 06 '13 at 07:17
  • I've added some info in the original post. – PaKempf May 06 '13 at 07:45
0

I found the problem.

Pay attention to the line 55 in the init script:

BIND_ADDRESS="`ifconfig ${BIND_INTERFACE} | sed -n 's/.*inet addr:\([^ ]*\) .*/\1/p' | head -n 1`"

This is trying to get the IP address from the ifconfig eth0 output. In the English language, it works fine because ifconfig eth0 returns something like:

eth0      Link encap:Ethernet  HWaddr C6:9B:8E:AF:A7:69  
          inet addr:192.168.6.192  Bcast:192.168.6.255  Mask:255.255.255.0
          inet6 addr: fe80::c49b:8eff:feaf:a769/64 Scope:Link

therefore:

# ifconfig eth0 | sed -n 's/.*inet addr:\([^ ]*\) .*/\1/p' | head -n 1
192.168.6.192

But in your language (French?), ifconfig eth0 returns:

eth0      Link encap:Ethernet  HWaddr 00:15:5D:09:16:0E
          inet adr:192.168.9.185  Bcast:192.168.15.255  Masque:255.255.240.0
          adr inet6: fe80::215:5dff:fe09:160e/64 Scope:Lien

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 get no IPADDR found in interface file ifcfg-eth0: when starting UCARP.

The fix is open the init script and change the line 55 to:

BIND_ADDRESS="`ifconfig ${BIND_INTERFACE} | sed -n 's/.*inet adr:\([^ ]*\) .*/\1/p' | head -n 1`"

(just delete a "d" character)

or the simpler way is get the value of $IPADDR from the /etc/sysconfig/network-scripts/ifcfg-eth0:

BIND_ADDRESS=${IPADDR}
quanta
  • 50,327
  • 19
  • 152
  • 213