pf + ip alias + route-to interrogation

Constant, Benjamin bconstant at
Mon Nov 28 12:52:29 GMT 2005

Hello list,

I've some questions regarding source routing with route-to option.

Here is what I try to setup:

I've two network interfaces on a box, one is dedicated to lan, the other one
is dedicated to wan.
On each of these interfaces, there are 1 IP + 1 IP alias in another subnet
(security aspect is not important here).

Here is the scheme: --        -- gw1 []
                         [em0 FreeBSD em1] -- -- gw2

I'm not performing 'NATting' on this box. All the traffic coming from is using the kernel routing table of the box and going to
gateway I'm doing source routing for every packets coming from and send them to
It using working correctly with the following /etc/pf.conf:


pass out quick on $ext_if route-to ($ext_if from to
any keep state pass in quick on $int_if route-to ($ext_if from to any keep state

# default rules in case of policy change in future update pass in all flags
S/SA keep state pass out all

I don't understand why I need to use keep state on each rule. If I remove
the keep state keyword, the first packet is using the route-to but the other
ones are using the kernel routing table. If I remove the quick keywork, it
doesn't work at all (it seems to fall in one of the last two rules depending
how the traffic hit the box). In an other mail I can read "unlike filter
rules, translation rules are first-match", what is the policy for route-to?
I think it should be the same as for a simple pass or block rule but am I
Why do I have to use a "pass in on $int_if..." for all the traffic coming
from the lan? The traffic should hit the rule pass out when it crosses the
I can't perform a ping -S lan_ip_alias ip_to_reach, why such traffic isn't
using the pass out source routing rule.
This box is running 5.4 stable and the following pf.c revision: $FreeBSD:
src/sys/contrib/pf/net/pf.c,v 2005/08/06 01:54:11 mlaier Exp which
seem to be the last commit for RELENG_5.

I'm a bit confused, can someone give me some more explanation? Thanks!


This message was also sent to pf official mailing-list to gather as much
information as possible.

Benjamin Constant
TI Automotive

The information contained in this transmission may contain privileged and
confidential information.  It is intended only for the use of the
person(s) named above. If you are not the intended recipient, you are
hereby notified that any review, dissemination, distribution or
duplication of this communication is strictly prohibited. If you are not
the intended recipient, please contact the sender by reply email and
destroy all copies of the original message. This communication is from TI

More information about the freebsd-pf mailing list