pantz.org banner
Configs for firewall redundancy with CARP and pfsync on OpenBSD
Posted on 03-31-2007 02:30:00 UTC | Updated on 03-31-2007 02:30:00 UTC
Section: /software/carp/ | Permanent Link

I setup a test of OpenBSD's CARP and PFSYNC. It went very well. Here are my notes from it.


                         wan/internet

                          +-------+
                          | host1 |
                          +-------+
                              |
                              |ne3 10.0.0.30
              ---+------------------------+---
                 |   VirtIP=10.0.0.100    |
    10.0.0.10 ne4|                        |ne4 10.0.0.20
               +-----+       172.16.0.20+-----+
               | fw1 |ne5------------ne5| fw2 |
               +-----+172.16.0.10       +-----+
 192.168.0.10 ne3|                        |ne3 192.168.0.20
                 |  VirtIP=192.168.0.100  |
              ---+------------------------+---
                              |
                              |ne3 192.168.0.30
                          +-------+
                          | host2 |
                          +-------+

                             lan


fw1 config
---------------------------------------
/etc/hostname.ne3 ->            inet 192.168.0.10 255.255.255.0 NONE
/etc/hostname.ne4 ->            inet 10.0.0.10 255.255.255.0 NONE
/etc/hostname.ne5 ->            inet 172.16.0.10 255.255.255.0 NONE
/etc/sysctl.conf  ->            net.inet.carp.preempt=1
/etc/hostname.pfsync0 ->        up syncdev ne5
/etc/hostname.carp1 ->          inet 192.168.0.100 255.255.255.0 192.168.0.255 vhid 1 carpdev ne3 pass yogi
/etc/hostname.carp2 ->          inet 10.0.0.100 255.255.255.0 10.0.0.255 vhid 2 carpdev ne4 pass booboo

fw2 config
---------------------------------------
/etc/hostname.ne3 ->            inet 192.168.0.20 255.255.255.0 NONE
/etc/hostname.ne4 ->            inet 10.0.0.20 255.255.255.0 NONE
/etc/hostname.ne5 ->            inet 172.16.0.20 255.255.255.0 NONE
/etc/sysctl.conf  ->            net.inet.carp.preempt=1
/etc/hostname.pfsync0 ->        up syncdev ne5
/etc/hostname.carp1 ->          inet 192.168.0.100 255.255.255.0 192.168.0.255 vhid 1 carpdev ne3 advskew 128 pass yogi
/etc/hostname.carp2 ->          inet 10.0.0.100 255.255.255.0 10.0.0.255 vhid 2 carpdev ne4 advskew 128 pass booboo

Other files to edit
---------------------------------------
/etc/rc.conf ->                 pf=YES,inetd=NO
/etc/sysctl.conf ->             net.inet.ip.forwarding=1
/etc/pf.conf ->                 pass quick on lo0 all
                                scrub in
                                nat on ne4 from !(ne4) to any -> (ne4:0)
                                pass quick on ne5 proto pfsync keep state (no-sync)
                                pass on { ne3, ne4 } proto carp keep state
                                pass out on ne4 proto { tcp, udp } from ne4 to any keep state
                                pass out on ne4 proto icmp all keep state

If you do this for yourself just change th interfaces names and IP's to your needs. After putting in the above configs reboot both machines. fw1 and fw2 are the firewall/routers. They nat all connections from the lan to the wan. Fw1 is the master firewall and fw2 is the secondary. The primary routes are on the carp interfaces. These are the virutal IP's that are shared between fw1 and fw2. Use pftop on both interfaces to watch your state tables to make sure everything is working ok.

Del.icio.us! | Digg Me! | Reddit!

Related stories


RSS Feed RSS feed logo
About


3com
3ware
alsa
alsactl
alsamixer
amd
apache
areca
arm
ati
auditd
awk
badblocks
bind
bios
bonnie
cable
carp
cat5
cdrom
centos
chart
cifs
cisco
comcast
commands
comodo
compiz-fusion
corsair
cpufreq
cpufrequtils
cpuspeed
cron
crontab
crossover
cu
cups
cvs
database
dd
dd_rescue
ddclient
debian
decimal
dhclient
dhcp
diagnostic
diskexplorer
disks
dns
dos
dovecot
dsniff
dvdauthor
e-mail
editor
emerald
ethernet
ext3
fat32
fedora
fetchmail
fiber
filesystems
firefox
firewall
flexlm
floppy
flowtools
fonts
format
ftp
gdm
gnome
greylisting
growisofs
grub
harddrive
hba
hex
hfsc
html
http
idl
ie
intel
ios
ipmi
iptables
irix
javascript
kde
kernel
kmail
kprinter
krecord
kubuntu
linux
logfile
maradns
matlab
memory
mencoder
mhdd
mkinitrd
mkisofs
moinmoin
motherboard
mouse
movemail
mplayer
multitail
mutt
myodbc
mysql
mythtv
nagios
nameserver
netflow
nic
ntfs
ntp
nvidia
odbc
openbsd
openntpd
openoffice
openssh
openssl
opteron
parted
partimage
patch
perl
pf
pfflowd
pfsync
photorec
php
pop3
pop3s
ports
postfix
power
procmail
proftpd
proxy
putty
pxe
python
qemu
r-studio
raid
recovery
router
rpc
rsync
samba
schedule
scsi
seagate
seatools
sed
sendmail
sgi
shell
siw
smtp
snort
solaris
soundcard
spam
spamd
sql
sqlite
squid
ssh
ssh.com
ssl
subnet
subversion
sun
supermicro
switches
symbols
syslinux
systemrescuecd
t1
tcpip
tcpwrappers
telnet
terminal
testdisk
tftp
thttpd
thunderbird
timezone
tools
tr
trac
tuning
tunnel
vi
wget
wiki
windows
windowsxp
wireless
wpa_supplicant
x
xauth
xfree86
xfs
xinearama
xmms
zdump
zic
zlib