From owner-freebsd-ports Mon Sep 2 2:40:22 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B85EE37B401 for ; Mon, 2 Sep 2002 02:40:05 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5650D43E42 for ; Mon, 2 Sep 2002 02:40:05 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g829e5JU093585 for ; Mon, 2 Sep 2002 02:40:05 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g829e5YP093582; Mon, 2 Sep 2002 02:40:05 -0700 (PDT) Date: Mon, 2 Sep 2002 02:40:05 -0700 (PDT) Message-Id: <200209020940.g829e5YP093582@freefall.freebsd.org> To: freebsd-ports@FreeBSD.org Cc: From: Pat Lashley Subject: Re: ports/42318: NATD redirect limitations Reply-To: Pat Lashley Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR ports/42318; it has been noted by GNATS. From: Pat Lashley To: Mark Weisman , freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: ports/42318: NATD redirect limitations Date: Mon, 02 Sep 2002 02:36:28 -0700 --==========3490849384========== Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline --On Monday, September 02, 2002 01:49:49 AM -0700 Mark Weisman=20 wrote: >> Number: 42318 >> Category: ports >> Synopsis: NATD redirect limitations > ... > Is there a way to redirect a singular incoming port to two internal IP > Addresses using NATD? I want to say the www.domain1.com and > www.domain3.com go to an internal address of 192.168.1.2 using > redirect_port tcp 192.168.1.2:http 80 > however, I'd also like to say if I get requests for www.domain2.com that > they be routed to an internal IP address of 192.168.1.3 using a second > redirect line in my rc.conf file: redirect_port tcp 192.168.1.3:http > 80 > then have each instance of Apache webserver appropriately direct the > traffic to the right folder. Is there a way to do this? >> How-To-Repeat: > Build a standard IPFW firewall, with NATD services installed, and try to > redirect a port to multiple internal addresses. >> Fix: > Potentially use Perl scripting in my config file for rc.conf, able to > stipulate the name request then direct accordingly? my (reqname); > reqname =3D {remote name requested}; > if {reqname eq "www.domain2.com"} { > document.url=3D("192.168.1.3"); > elsif {reqname ne "www.domain2.com"){ > document.url=3D("192.168.1.2"); > }; > Something like that anyways. This isn't a bug report, it's a question. Or possibly a badly phrased request for enhancement. The problem is that NATd works at the IP protocol level. It doesn't have much to go on besides the source and destination IP addresses, ports, IP protocol number, a few flags, etc. It has no way to recognize an HTTP request nor to parse it. This is a Good Thing. It keeps natd simple and fast. If you actually have more than one externally visible IP address, then you could assign one to each of your domains and redirect based on that. But if you have only one, your best bet is to have natd redirect them all to Apache on one of the servers; and use Apache's proxy capabilities to forward some of the requests to the other server. -Pat --==========3490849384========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9czEnncYNbLD8wuMRApPnAKDZWTO9VCrq3y3o96/fLYm9pXaaiQCgo6LR D0LXfVHZdSkvrgHEl+laB9s= =R6Ki -----END PGP SIGNATURE----- --==========3490849384==========-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message