From owner-freebsd-questions@FreeBSD.ORG Sat Nov 18 23:12:34 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 197F316A417 for ; Sat, 18 Nov 2006 23:12:34 +0000 (UTC) (envelope-from nilton.volpato@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.185]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D53443D67 for ; Sat, 18 Nov 2006 23:12:27 +0000 (GMT) (envelope-from nilton.volpato@gmail.com) Received: by nf-out-0910.google.com with SMTP id x37so1472472nfc for ; Sat, 18 Nov 2006 15:12:32 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=k3PA5PFl5xAFSVYJMpy7UFlmWBJsXxvmkRuB2Cv9zZLLbeRSMIiJzEsLtjO4O8CJZqYVdphapCl2BV0s3pF9enBkIFibDv9XzVHQze9Kde+YxWeuqvB7RJfOw0XE8FJiirSg8DDlCRv8Zy9ostciPPhbrm3kf5QztyRYoSbDwxY= Received: by 10.78.204.20 with SMTP id b20mr3641155hug.1163891551674; Sat, 18 Nov 2006 15:12:31 -0800 (PST) Received: by 10.78.126.15 with HTTP; Sat, 18 Nov 2006 15:12:30 -0800 (PST) Message-ID: <27fef5640611181512p335c0900la2125c7110156dac@mail.gmail.com> Date: Sat, 18 Nov 2006 21:12:30 -0200 From: "Nilton Volpato" To: freebsd-questions@freebsd.org In-Reply-To: <27fef5640611171328r2973167dm2b58e1dc2e393bb7@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <27fef5640611171328r2973167dm2b58e1dc2e393bb7@mail.gmail.com> Subject: port redirection with natd and ipfw 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: Sat, 18 Nov 2006 23:12:34 -0000 Hi, I'm using a computer with FreeBSD as a gateway and NAT for a private LAN. Let's say the gateway has external.com as external address, and 192.168.0.1 as internal address, so that the LAN is 192.168.0.0/24. I'm doing a number of port redirects in the gateway, for svn, http, https, ssh, etc using natd. However, these port redirects do not work from inside the LAN. For instance, if I point my browser to http://external.com and I'm in the LAN, then it will not work. I can't use the internal address of the web server because none of the links will work on the web page. In summary, I want that my port redirections work also when I try to connect to the gateway's external address from inside the LAN. I'm using a minimal ipfw configuration to try to solve this. This is the default configuration. 00050 divert 8668 ip4 from any to any via vr0 00100 allow ip from any to any via lo0 00200 deny ip from any to 127.0.0.0/8 00300 deny ip from 127.0.0.0/8 to any 65000 allow ip from any to any 65535 deny ip from any to any I tried to add: 00060 divert 8668 ip4 from 192.168.0.0/24 to external.com expecting that it would send the packets from LAN to natd, which would apply the port redirections. But it did not work. How can I solve this? Thanks, -- Nilton