Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Mar 2008 20:43:31 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        "Tuc at T-B-O-H.NET" <ml@t-b-o-h.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Quick+easy port redirect
Message-ID:  <20080330014331.GF28690@dan.emsphone.com>
In-Reply-To: <200803290025.m2T0PYZc070500@himinbjorg.tucs-beachin-obx-house.com>
References:  <200803290025.m2T0PYZc070500@himinbjorg.tucs-beachin-obx-house.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 192.168.0.1 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 192.168.0.1 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 127.0.0.1:87 (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@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080330014331.GF28690>