Carp on FreeBSD 10.1, kernel: ifa_add_loopback_route: insertion failed: 17

Hi

I'm setting up carp on FreeBSD 10.1
Code:
FreeBSD stunnel_carp2 10.1-RELEASE-p26 FreeBSD 10.1-RELEASE-p26
CARP is work
Code:
Jan 18 12:57:35 stunnel_carp1 devd: Executing '/etc/rc.d/dhclient quietstart em0'
Jan 18 13:02:48 stunnel_carp1 kernel: carp: VHID 1@em0: BACKUP -> MASTER (master down)
but in /var/log/messages give error
Code:
Jan 18 13:02:48 stunnel_carp1 kernel: ifa_add_loopback_route: insertion failed: 17

Not found in google resolve this error, maybe somebody already solved it?

my config files
master rc.conf:
Code:
ifconfig_em0="inet 10.10.0.71 netmask 255.255.255.0"
ifconfig_em0_alias0="inet alias 10.10.0.73 netmask 255.255.255.0 vhid 1 advskew 0 pass testpass"
backup rc.conf:
Code:
ifconfig_em0="inet 10.10.0.72 netmask 255.255.255.0"
ifconfig_em0_alias0="inet alias 10.10.0.73 netmask 255.255.255.0 vhid 1 advskew 100 pass testpass"
sysctl.conf:
Code:
net.inet.ip.forwarding=1
net.inet.carp.allow=1
net.inet.carp.preempt=1
net.inet.carp.log=2
 
sysctl.conf:
Code:
net.inet.ip.forwarding=1
Don't set this in sysctl.conf. Use this in /etc/rc.conf:
Code:
gateway_enable="YES"
No need to set this, it's the default:
Code:
net.inet.carp.allow=1

Only useful if you have more than one carp(4) interface on the same machine:
Code:
net.inet.carp.preempt=1
 
Hi , SirDice

So, i'm use only one carp interface, but without
Code:
net.inet.carp.preempt=1
master server does not automatically return in the erver master mode, after its on. Only if manually disabled the interface to the backup server.
Error persists

Code:
Jan 18 13:56:21 stunnel_carp1 kernel: carp: VHID 1@em0: BACKUP -> MASTER (master down)
Jan 18 13:57:50 stunnel_carp1 kernel: carp: demoted by 240 to 240 (interface down)
Jan 18 13:57:50 stunnel_carp1 kernel: em0: link state changed to DOWN
Jan 18 13:58:06 stunnel_carp1 kernel: carp: VHID 1@em0: INIT -> BACKUP
Jan 18 13:58:06 stunnel_carp1 kernel: carp: demoted by -240 to 0 (interface up)
Jan 18 13:58:06 stunnel_carp1 kernel: em0: link state changed to UP
Jan 18 13:58:06 stunnel_carp1 devd: Executing '/etc/rc.d/dhclient quietstart em0'
Jan 18 13:58:59 stunnel_carp1 kernel: carp: VHID 1@em0: BACKUP -> MASTER (master down)
Jan 18 13:58:59 stunnel_carp1 kernel: ifa_add_loopback_route: insertion failed: 17

Code:
Jan 18 13:56:19 stunnel_carp2 kernel: em0: link state changed to DOWN
Jan 18 13:56:32 stunnel_carp2 kernel: carp: VHID 1@em0: INIT -> BACKUP
Jan 18 13:56:32 stunnel_carp2 kernel: carp: demoted by -240 to 0 (interface up)
Jan 18 13:56:32 stunnel_carp2 kernel: em0: link state changed to UP
Jan 18 13:56:32 stunnel_carp2 devd: Executing '/etc/rc.d/dhclient quietstart em0'
Jan 18 13:57:53 stunnel_carp2 kernel: carp: VHID 1@em0: BACKUP -> MASTER (master down)
Jan 18 13:57:53 stunnel_carp2 kernel: ifa_add_loopback_route: insertion failed: 17
Jan 18 13:58:57 stunnel_carp2 kernel: carp: demoted by 240 to 240 (interface down)
Jan 18 13:58:57 stunnel_carp2 kernel: em0: link state changed to DOWN
Jan 18 13:59:09 stunnel_carp2 kernel: carp: VHID 1@em0: INIT -> BACKUP
Jan 18 13:59:09 stunnel_carp2 kernel: carp: demoted by -240 to 0 (interface up)
Jan 18 13:59:09 stunnel_carp2 kernel: em0: link state changed to UP
Jan 18 13:59:09 stunnel_carp2 devd: Executing '/etc/rc.d/dhclient quietstart em0'
 
Why is it trying to run dhclient(8) when the interface comes up? You have static addresses so there's no need for it and may be the cause of the error.
 
This
Code:
Jan 18 13:56:32 stunnel_carp2 devd: Executing '/etc/rc.d/dhclient quietstart em0'
from configuration file /etc/devd.conf
Code:
# Try to start dhclient on Ethernet-like interfaces when the link comes
# up.  Only devices that are configured to support DHCP will actually
# run it.  No link down rule exists because dhclient automatically exits
# when the link goes down.
iI disable scanning interface when he picked up
Code:
#notify 0 {
#<----->match "system"<><------>"IFNET";
#<----->match "type"<--><------>"LINK_UP";
#<----->media-type<----><------>"ethernet";
#<----->action "/etc/rc.d/dhclient quietstart $subsystem";
#};
it did not help
Code:
Jan 18 16:29:07 stunnel_carp1 kernel: em0: link state changed to DOWN
Jan 18 16:29:32 stunnel_carp1 kernel: carp: VHID 1@em0: INIT -> BACKUP
Jan 18 16:29:32 stunnel_carp1 kernel: carp: demoted by -240 to 0 (interface up)
Jan 18 16:29:32 stunnel_carp1 kernel: em0: link state changed to UP
Jan 18 16:29:33 stunnel_carp1 kernel: carp: VHID 1@em0: BACKUP -> MASTER (preempting a slower master)
Jan 18 16:29:33 stunnel_carp1 kernel: ifa_add_loopback_route: insertion failed: 17
 
Last edited by a moderator:
This doesn't look like a bug to me - this looks like expected behavior. You haven't posted the output of netstat -rn but I'm sure there's an existing 127.0.0.1 route in there. Because of the way dhclient works, it gets in the way of other things. Thus when carp() calls ifa_add_loopback_route() on a dhclient controlled interface it will and should return error. In this case, the error is harmless - but the configuration is definitely wrong. carp() and dhclient should not be run on the same interface.
 
While working on a FreeBSD 9.3 server for a client I noticed the same behavior. For some reason dhclient(8) gets called when the carp(4) interface comes up. There's no reason why it should do that, we have static addresses on everything and do not use DHCP. Apparently setting net.inet.carp.preempt causes this, you don't get the messages if you turn preempt off.
 
Back
Top