# Memcached + Carp + PF



## Jaax (Feb 24, 2012)

Hello,

I installed a memcached server which work*s* fine. I also configured a CARP interface with an other server, work*s* fine too.

Now, *I* would like to bind the memcached server on this interface but when *I* launch a connection test on it, the connection was closed.

The goal is to populate the second memcached server by duplicating packets with PF.


```
$ ifconfig carp0
carp0: flags=49<UP,LOOPBACK,RUNNING> metric 0 mtu 1500
	inet 192.168.100.2 netmask 0xffff0000 
	carp: MASTER vhid 2 advbase 3 advskew 0

$ sockstat -4 -l | grep ':11211'
nobody   memcached  1839  17 tcp4   *:11211               *:*
```


```
$ telnet 192.168.100.2 11211
Trying 192.168.100.2...
Connected to 192.168.100.2.
Escape character is '^]'.
Connection closed by foreign host.
```


```
$ cat /etc/pf.conf 
pass quick proto carp
pass in log on re0 dup-to (re0 192.168.100.1) inet proto tcp from 192.168.0.10 to carp0 port 11211
pass out log on re0 dup-to (re0 192.168.100.1) inet proto tcp from carp0 port 11211 to 192.168.0.10
```

If *I* disable PF, everything works fine.

Thanks a lot.


----------

