Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 May 2005 13:56:19 -0300
From:      Carlos Alloatti <calloatti@gmail.com>
To:        "Andrew P." <infofarmer@gmail.com>
Cc:        questions@freebsd.org
Subject:   Re: Redirect *:port to ip:port on the same machine?
Message-ID:  <1b6c15ea05051209563c7af4b0@mail.gmail.com>
In-Reply-To: <cb520642050511144530ed8da9@mail.gmail.com>
References:  <cb520642050511144530ed8da9@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5/11/05, Andrew P. <infofarmer@gmail.com> wrote:
> Hello!
>=20
> 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.
>=20
> Thanks!

How about using a port forwarder or port mapper.

I think you could use ipfw and natd for it, with a divert rule, found this:

<quote>
> 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 ?=20
> If I want to do so, what is natd command ?=20
> natd -redirect_port 127.0.0.1:8890 25?=20



------------------------------=AD------------------------------=AD---------=
-------=20
----=20
#!/bin/sh=20

outip=3D"my ip address which will be redirected"=20
server=3D"ip address redirect to"=20


# for request redirect=20
ipfw add 1000 divert 8888 tcp from any to ${outip} 8890 via cx0=20
ipfw add 2000 divert 8888 ip from ${server} to any via cx0=20


#run natd=20
natd -p 8888 -n cx0 -redirect_port tcp ${server}:25 8890=20
ipfw add 2500 allow tcp from any to ${server} 25 via any=20

</quote>


but how about this:

http://www.taronga.com/plugdaemon/
http://www.freebsd.org/cgi/url.cgi?ports/net/jumpgate/pkg-descr

the port mapper will bind to *:port2 and forward to ip:port1


--=20
Carlos Alloatti
calloatti@gmail.com



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