Topic: how to config PF as router and source based routing ??

i have 4 wan links and i want to use PF as router.
i want to config source based routing using Port number and protocol

example policy

-  Port 80, 20, 21, 443  routed by interface1
-  Port 1-1023  routed by interface2
-  Port 1024-65535  routed by interface3

how do i config this policy but i don't use NAT. i want to use PF replace the old router (static routing).

route-to , dup-to , reply-to     can do my policy ?

if1 = "em1"
if2 = "em2"
if3 = "em3"
if4 = "em4"
ext_gw1 = "192.168.1.1"
ext_gw2 = "192.168.2.1"
ext_gw3 = "192.168.3.1"
ext_gw4 = "192.168.4.1"

pass out on $if1 route-to $ext_gw1 port {80 21 22 443} from any
pass out on $if2 route-to $ext_gw2 port {1 >< 1024} from any
pass out on $if3 route-to $ext_gw3 port {1025 >= } from any

for this code , i can't achieve my policy
please help me to solve my problem

many many thanks
(i apologize that my english is not too good)

Re: how to config PF as router and source based routing ??

You can do it using setfib(1) to create multiple routing tables with separate "default" gateways, and IPFW to tag packets with a FIB ID, so that the kernel routes the traffic in/out via the correct gateway.

I've posted about this a couple of times on the FreeBSD Forums.  Search for "setfib" over there for the details.