View Full Version : port based traffic redirection
loko
November 20th, 2008, 13:28
Hello,
Can you help me with the following situation:
I have two internet service providers and I am trying to redirect all internal traffic who has destination port 80 or 443 to ISP1 and all the rest to ISP2.
Thanks in advance!
gelraen
November 20th, 2008, 14:45
with IPFW you can do something like
ipfw add fwd $ISP1 ip from $internal_net to any 80 out
ipfw add fwd $ISP1 ip from $internal_net to any 443 out
Check ipfw(8) and handbook for more details
DutchDaemon
November 20th, 2008, 14:47
I'm assuming you're doing this on a router running BSD? I think pf with the route-to option should be able to do what you require.
Warning: totally untested pseudocode syntax ahead
pass in on $int_if route-to ($ext_if1 $ext_gw1) inet proto tcp from $lan_net to any port { 80, 443 } flags S/SA modulate state
pass in on $int_if route-to ($ext_if2 $ext_gw2) inet proto tcp from $lan_net to any port { !80, !443 } flags S/SA modulate state
pass in on $int_if route-to ($ext_if2 $ext_gw2) inet proto { udp, icmp } from $lan_net to any keep state
You need pass out rules as well, etc.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.