From owner-freebsd-questions@FreeBSD.ORG Sun Mar 30 01:43:34 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07FFD106564A for ; Sun, 30 Mar 2008 01:43:34 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.freebsd.org (Postfix) with ESMTP id C324D8FC12 for ; Sun, 30 Mar 2008 01:43:33 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.2/8.14.2) with ESMTP id m2U1hWS9022600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 29 Mar 2008 20:43:32 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.2/8.14.2/Submit) id m2U1hVGX022599; Sat, 29 Mar 2008 20:43:31 -0500 (CDT) (envelope-from dan) Date: Sat, 29 Mar 2008 20:43:31 -0500 From: Dan Nelson To: "Tuc at T-B-O-H.NET" Message-ID: <20080330014331.GF28690@dan.emsphone.com> References: <200803290025.m2T0PYZc070500@himinbjorg.tucs-beachin-obx-house.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200803290025.m2T0PYZc070500@himinbjorg.tucs-beachin-obx-house.com> X-OS: FreeBSD 7.0-STABLE User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-questions@freebsd.org Subject: Re: Quick+easy port redirect X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Mar 2008 01:43:34 -0000 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