WAN load balance with PF

Hooma Fazaeli hoomanfazaeli at gmail.com
Tue Nov 20 21:53:19 UTC 2012


On 11/20/2012 03:31 ب.ظ, Daniel Hartmeier wrote:
> On Tue, Nov 20, 2012 at 02:26:15PM +0330, Hooma Fazaeli wrote:
>
>>>    # assuming default route through $wan_if1
>>>    nat on $wan_if1 from $lan_if1:network to any -> { $wan_if1 $wan_if2 }
>>>    round-robin
>>>    pass out on $wan_if1 route-to ($wan_if2 $wan_ip2) from $wan_if2 to any
>>>
>>> Daniel
>> But there is no wan_if2 actually. The box has only two interfaces: one
>> connected to LAN and
>> the other connected to L2 switch (to which modems are connected).
> Same thing, just
>
> pass out on $wan_if1 route-to ($wan_if1 $wan_ip2) from $wan_if2 to any
>
> Daniel
Thanks Daniel

I was thinking that route-to does not work with OUT rules (I should have 
read it somewhere)
and so never considered the possibility of routing after NAT.

And just for the record, I include the final ruleset here:

lan_if = "em0"
wan_if = "em1" # default route interface
wan_gw1 = "...." # ADSL modem 1 IP address
wan_gw2 = "...." # ADSL modem 2 IP address
wan_if_ip1 = "..." # default route destination
wan_if_ip2 = "...." # IP address assigned to $wan_if to reach $wan_gw2

nat on $wan_if from $lan_if to any -> {$wan_if} round-robin
pass out on $wan_if route-to ($wan_if $wan_gw2) from $wan_if_ip2 to any






More information about the freebsd-pf mailing list