# Using CARP with fxp0



## jdfergason (Jan 17, 2012)

I am trying to setup carp on 2 machines.  I can configure the IP address as an alias for both machines and ping, etc. works.

Here's the configuration:


```
Machine1: Interface fxp0
          CARP interface: carp0
          CARP configuration line: vhid 1 pass test 209.126.230.54/27
```


```
Machine2: Interface re0
          CARP interface: carp0
          CARP configuration line: vhid 1 advskew 100 pass test 209.126.230.54/27
```
The machines come up ok and the configuration looks fine.  When I do /sbin/ifconfig carp0 I get the following for each machine:


```
Machine1: carp0: flags=49<UP,LOOPBACK,RUNNING> metric 0 mtu 1500
          inet 209.126.230.54 netmask 0xffffffe0
          carp: MASTER vhid 1 advbase 1 advskew 0
```


```
Machine2: carp0: flags=8<UP,LOOPBACK,RUNNING> metric 0 mtu 1500
          inet 209.126.230.54 netmask 0xffffffe0
          carp: BACKUP vhid 1 advbase 1 advskew 100
```
Failover appears to work, when I do /sbin/ifconfig carp0 down on Machine1, Machine2 becomes MASTER and Machine1 goes to INIT state.  However, if Machine1 is in master state I cannot ping the IP address from any machine but Machine1.  As stated earlier if the ip was configured as an alias on Machine1 it worked OK so I don't think it's a routing issue.

Any pointers as to what I am doing wrong?


----------



## shitson (Jan 17, 2012)

Could you please post a complete ifconfig


----------



## jdfergason (Jan 17, 2012)

Machine 1:


```
%501 12:07 AM [~] /sbin/ifconfig
fxp0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=2009<RXCSUM,VLAN_MTU,WOL_MAGIC>
	ether 00:19:d1:6f:5d:e0
	inet 71.6.167.179 netmask 0xffffffc0 broadcast 71.6.167.191
	inet 209.126.230.34 netmask 0xffffffe0 broadcast 209.126.230.63
	media: Ethernet autoselect (100baseTX <full-duplex>)
	status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000 
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
carp0: flags=49<UP,LOOPBACK,RUNNING> metric 0 mtu 1500
	inet 209.126.230.54 netmask 0xffffffe0 
	carp: MASTER vhid 1 advbase 1 advskew 0
```
Machine 2:


```
[jdf@tozer /]$ /sbin/ifconfig
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
	ether 00:1c:c0:43:34:a6
	inet 71.6.167.180 netmask 0xffffffc0 broadcast 71.6.167.191
	inet 209.126.230.38 netmask 0xffffffe0 broadcast 209.126.230.63
	media: Ethernet autoselect (100baseTX <full-duplex>)
	status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000 
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
carp0: flags=49<UP,LOOPBACK,RUNNING> metric 0 mtu 1500
	inet 209.126.230.54 netmask 0xffffffe0 
	carp: BACKUP vhid 1 advbase 1 advskew 100
```


----------



## SirDice (Jan 17, 2012)

jdfergason said:
			
		

> Failover appears to work, when I do /sbin/ifconfig carp0 down on Machine1, Machine2 becomes MASTER and Machine1 goes to INIT state.  However, if Machine1 is in master state I cannot ping the IP address from any machine but Machine1.  As stated earlier if the ip was configured as an alias on Machine1 it worked OK so I don't think it's a routing issue.


Have a look at your switch configuration. I'm guessing the switch doesn't like the IP address moving around from one port to another.


----------



## pbd (Jan 17, 2012)

Run (on Machine2)


```
[I]Machine2#[/I] tcpdump -ni re0 icmp and host 209.126.230.54
```
 to verify, that ping actually arrives to the machine. As SirDice mentioned, some switches doesn't like moving IP addresses (CISCO switches with _port  security_ enabled).

Also shouldn't CARP interfaces have always /32 network mask?


----------



## DutchDaemon (Jan 17, 2012)

Note that post #3 was held for moderation until now, so be sure to look at that one; jdfergason, don't forget to format your posts.


----------



## jdfergason (Jan 17, 2012)

Tried running *tcpdump* on machine 2 while machine 1 was master; I then tried ping from machine2 to 209.126.230.54.  Here's the result:


```
tcpdump -ni re0 icmp and host 209.126.230.54
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on re0, link-type EN10MB (Ethernet), capture size 96 bytes
09:38:27.969927 IP 209.126.230.38 > 209.126.230.54: ICMP echo request, id 18954, seq 0, length 64
09:38:28.961584 IP 209.126.230.38 > 209.126.230.54: ICMP echo request, id 18954, seq 1, length 64
09:38:29.953633 IP 209.126.230.38 > 209.126.230.54: ICMP echo request, id 18954, seq 2, length 64
09:38:30.946190 IP 209.126.230.38 > 209.126.230.54: ICMP echo request, id 18954, seq 3, length 64
09:38:31.938737 IP 209.126.230.38 > 209.126.230.54: ICMP echo request, id 18954, seq 4, length 64
^C
5 packets captured
3259 packets received by filter
0 packets dropped by kernel
```

Regarding the problem being the switch, why would I be able to successfully configure the IP as an alias on either machine if the switch didn't like it changing ports?


----------



## shitson (Jan 18, 2012)

Just as a little test, could you please ping from both carp nodes to the test node your pingining from... i.e 

Have both of the carp nodes pinging the 3rd computer your testing from, then from a third system ping the carp virtual address, then unplug your current master. Both of the carp nodes pinging should keep the switch up to date in terms of arp cache.

Please post results


----------

