pantz.org banner
Use FreeBSD 10 as a PF firewall
Posted on 02-02-2014 01:41:29 UTC | Updated on 02-02-2014 01:42:57 UTC
Section: /software/pf/ | Permanent Link

History

Back in 2012 I wrote an entry that said to not use FreeBSD 9.0 as a PF firewall. It was mildly controversial and I was just relaying my experience of installing FreeBSD 9.0 on release day. It was a frustrating experience that I really wanted to work out and I was sadly disappointed that it did not. I wanted to try it again in the future in hopes that the FreeBSD team could put together something that work work better for me. That time is now.

Why try again?

Reading about all of the improvements in FreeBSD 10 was very encouraging. Some of the most encouraging things that inspired me to try again was a fork of PF. The FreeBSD devs forked PF because Gleb Smirnoff wrote an amazing patch to make PF SMP-friendly. But this was not compatible with the newest PF code so hence the fork. Making PF SMP aware improves performance immensely. OpenBSD has not done this nor does it look like it is on their radar.

Since I tried it last the binary package system for FreeBSD has been rewritten. The new package system pkgng is a major improvement over the old package system. Now FreeBSD actually has a package manager that can deal with dependencies well and we can live off of binaries instead of ports (Yea!).

I have been really interested in using ZFS as a file system, and our friends over at Calomel.org have convinced me that the time is right to try it. ZFS has added TRIM support in FreeBSD 10. ZFS also has added LZ4 compression, which is an amazing new fast compression algorithm. Plus you can now install ZFS as your root drive right from the installer. I do wish they would add the ability to choose options like compression during your ZFS install, but hopefully they will add this as advanced options in the future.

Install

The install went great. I followed the great instructions from our friends over at Calomel.org and made my usb boot drive. I fetched the script from Calomel.org and changed a few things. I ran the script and a few mins later I rebooted and hit a nice big error screen.

The error was "ahcich1: Timeout on slot 30". This error was referring to the first channel on my SATA port where my hard drive lives. I could not figure out why it was having this issue until I checked my BIOS. My drives were set to IDE instead of AHCI. For some reason FreeBSD installed fine using IDE as the setting, but on first boot it fell flat on its face. AHCI is better and is what I really wanted it set to, but I never bothered checking. After changing to AHCI in the BIOS FreeBSD booted right up.

The install was done on my internal network so I had the ability to use another machine to do the install and download everything I needed to get it done. Then I tried hooking it up to my external firewall. I could not get lease from Verizon's DHCP server to save my life.

Fighting Verizon DHCP

In the install script I used you have to change your external interface to DHCP and change (spoof) its MAC address to match the MAC that Verizon has in their system. This could be the MAC of your original router or your Verizon router. That MAC was changed correctly to what I have on the OpenBSD machine the was hooked up, but I could not get a lease from the Verizon DHCP server at all.

Long story short, with Verizon you have to release the DHCP lease before you can get a new one. With FreeBSD there is no way to release a DHCP lease with the version of dhclient that comes with FreeBSD. In the Linux version of dhclient you can. I had to end up hooking up my old Verizon router and push the "Release" button on the GUI interface. After doing that and quickly powering off the router I booted right up and got a lease. Now, I also believe if I waited enough hours I could have waited for the lease to expire, but I wanted to get this done so I found a faster way.

Configuration

Installing and configuring the system was pretty easy. I worked through many of the issues I had last time. Let me give you some examples.

Before I used to use Postfix with SASL to talk to remote mail servers using TLS. I now use OpenSMTPD to do this as it is built in and they also have built in CA Certs for Gmail. That solved the annoyance of having to build Postfix from ports. As far as I can tell FreeBSD still does not build Postfix with SASL, but they do build Sendmail with SASL. Go figure.

PF still works great in FreeBSD, but they still do not build in ALTQ as a kernel module or into the kernel. This is not as big of an issue for me as it once was since turning it off I did not see any noticeable difference on my home network. For a big corp that has lots of different users this might be different. For me I can live without it for now as turning it on requires a kernel recompile and I'm trying to avoid that. OpenBSD is abandoning its work on ALTQ as they said it was a hack in the fist place and the code is showing its age with limited 32 bit registers and the like. They are working on a new queuing system called prio. I hope FreeBSD can eventually work this into their fork of PF or make one of their own. What I really want back from ALTQ is priority ACKs. I wish someone would hack in priority acks into the tcp stack as a kernel tunable. That would rock.

All PF tools I installed from packages this time and they worked great right out of the box. No fuss at all. This was a big improvement from last time as most of the PF tools were broken on release day.

Farewell OpenBSD

In the last entry I bid farewell to FreeBSD, but this time I'm waving bye bye to OpenBSD. OpenBSD we need to talk. You are falling behind. FreeBSD is eating your lunch on performance and features.

I'm not saying I won't be back OpenBSD, but I'm going to ride the FreeBSD train for now and see where it takes me. Thanks for all of the stability and security you have given me over the years. Good luck and I hope you can start addressing the issues I mentioned above.

Reddit!

Related stories


RSS Feed RSS feed logo

About


3com

3ware

alsa

alsactl

alsamixer

amd

android

apache

areca

arm

ati

auditd

awk

badblocks

bash

bind

bios

bonnie

cable

carp

cat5

cdrom

cellphone

centos

chart

chrome

chromebook

cifs

cisco

cloudera

comcast

commands

comodo

compiz-fusion

corsair

cpufreq

cpufrequtils

cpuspeed

cron

crontab

crossover

cu

cups

cvs

database

dbus

dd

dd_rescue

ddclient

debian

decimal

dhclient

dhcp

diagnostic

diskexplorer

disks

dkim

dns

dos

dovecot

drac

dsniff

dvdauthor

e-mail

echo

editor

emerald

encryption

ethernet

expect

ext3

ext4

fat32

fedora

fetchmail

fiber

filesystems

firefox

firewall

flac

flexlm

floppy

flowtools

fonts

format

freebsd

ftp

gdm

gmail

gnome

google

gpg

greasemonkey

greylisting

growisofs

grub

hacking

hadoop

harddrive

hba

hex

hfsc

html

html5

http

https

hulu

idl

ie

ilo

intel

ios

iperf

ipmi

iptables

ipv6

irix

javascript

kde

kernel

kickstart

kmail

kprinter

krecord

kubuntu

kvm

lame

ldap

linux

logfile

lp

lpq

lpr

maradns

matlab

memory

mencoder

mhdd

mkinitrd

mkisofs

moinmoin

motherboard

mouse

movemail

mplayer

multitail

mutt

myodbc

mysql

mythtv

nagios

nameserver

netflix

netflow

nginx

nic

ntfs

ntp

nvidia

odbc

openbsd

openntpd

openoffice

openssh

openssl

openvpn

opteron

parted

partimage

patch

perl

pf

pfflowd

pfsync

photorec

php

pop3

pop3s

ports

postfix

power

procmail

proftpd

proxy

pulseaudio

putty

pxe

python

qemu

r-studio

raid

recovery

redhat

router

rpc

rsync

ruby

saltstack

samba

schedule

screen

scsi

seagate

seatools

sed

sendmail

sgi

shell

siw

smtp

snort

solaris

soundcard

sox

spam

spamd

spf

spotify

sql

sqlite

squid

srs

ssh

ssh.com

ssl

su

subnet

subversion

sudo

sun

supermicro

switches

symbols

syslinux

syslog

systemd

systemrescuecd

t1

tcpip

tcpwrappers

telnet

terminal

testdisk

tftp

thttpd

thunderbird

timezone

ting

tls

tools

tr

trac

tuning

tunnel

ubuntu

unbound

vi

vpn

wget

wiki

windows

windowsxp

wireless

wpa_supplicant

x

xauth

xfree86

xfs

xinearama

xmms

youtube

zdump

zeromq

zic

zlib