Quick+easy port redirect

Dan Nelson dnelson at allantgroup.com
Sat Mar 29 18:43:34 PDT 2008

In the last episode (Mar 28), Tuc at T-B-O-H.NET said:
> 	Is there a quick/easy (cookbook?) way to do port redirects.
> Basically I want that anything that leaves a specific interface to
> any ip on port 80 go to port 87.
> 	I'm using ipfw for some other things so it has to work and play
> well with that.

Make sure "options IPFIREWALL_FORWARD" is in your kernel config:

  ipfw add 500 forward tcp from any to any 80 
Note that this is a routing-style forward.  The source and destination
addresses are unchanged, so you will likely need another ipfw fwd rule
at the destination machine to capture the traffic and force-forward it
to (or wherever you want it to go).  If you're planning on
passing the traffic to squid, there's a big FAQ section with some
alternate methods: http://wiki.squid-cache.org/SquidFaq/InterceptionProxy

	Dan Nelson
	dnelson at allantgroup.com

More information about the freebsd-questions mailing list