From owner-freebsd-questions@FreeBSD.ORG Thu May 12 17:50:35 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 24A1516A4CE for ; Thu, 12 May 2005 17:50:35 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id AEB0343D7E for ; Thu, 12 May 2005 17:50:34 +0000 (GMT) (envelope-from infofarmer@gmail.com) Received: by wproxy.gmail.com with SMTP id 69so568465wri for ; Thu, 12 May 2005 10:50:34 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eG17Z5pFXJxT5CQgX/qhybWVIrm5i/KqNnBTLr+P6hrHX1h8DNFHYHr+El0zF7mgWCDggfVg0rfHWpXoRUvO567rPNw77uzVKKEn45TuXvay83j8SR1FmmiPbEtiWQG9Gh/jFz+lQs4ArZk1Emvooeppbg2SQkWCy8POL5YqhPo= Received: by 10.54.125.20 with SMTP id x20mr1092035wrc; Thu, 12 May 2005 10:50:34 -0700 (PDT) Received: by 10.54.62.5 with HTTP; Thu, 12 May 2005 10:50:34 -0700 (PDT) Message-ID: Date: Thu, 12 May 2005 21:50:34 +0400 From: "Andrew P." To: Carlos Alloatti In-Reply-To: <1b6c15ea05051209563c7af4b0@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1b6c15ea05051209563c7af4b0@mail.gmail.com> cc: questions@freebsd.org Subject: Re: Redirect *:port to ip:port on the same machine? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "Andrew P." List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 17:50:35 -0000 On 5/12/05, Carlos Alloatti wrote: > On 5/11/05, Andrew P. wrote: > > Hello! > > > > I have a program that binds to ip:port. What are > > my options, if I want it to listen on all interfaces > > (*:port)? Let's say reconfiguring the program > > and/or running one instance per interface is > > not possible. I've got ipfw as a firewall. > > > > Thanks! >=20 > How about using a port forwarder or port mapper. >=20 > I think you could use ipfw and natd for it, with a divert rule, found thi= s: >=20 > > > If I want to have a port mapping on the same interface, can I do that ? >=20 > > 127.0.0.1: 8890 -> 127.0.0.: 25 ? > > If I want to do so, what is natd command ? > > natd -redirect_port 127.0.0.1:8890 25? >=20 > ------------------------------=AD------------------------------=AD-------= --------- > ---- > #!/bin/sh >=20 > outip=3D"my ip address which will be redirected" > server=3D"ip address redirect to" >=20 > # for request redirect > ipfw add 1000 divert 8888 tcp from any to ${outip} 8890 via cx0 > ipfw add 2000 divert 8888 ip from ${server} to any via cx0 >=20 > #run natd > natd -p 8888 -n cx0 -redirect_port tcp ${server}:25 8890 > ipfw add 2500 allow tcp from any to ${server} 25 via any >=20 > >=20 > but how about this: >=20 > http://www.taronga.com/plugdaemon/ > http://www.freebsd.org/cgi/url.cgi?ports/net/jumpgate/pkg-descr >=20 > the port mapper will bind to *:port2 and forward to ip:port1 Yeah, thanks, I think that's just what I need! Best wishes, Andrew P.