Redirect *:port to ip:port on the same machine?
Andrew P.
infofarmer at gmail.com
Thu May 12 10:50:35 PDT 2005
On 5/12/05, Carlos Alloatti <calloatti at gmail.com> wrote:
> On 5/11/05, Andrew P. <infofarmer at gmail.com> 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!
>
> 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 ?
>
> > 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?
>
> ----------------------------------------------------------------------------
> ----
> #!/bin/sh
>
> outip="my ip address which will be redirected"
> server="ip address redirect to"
>
> # 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
>
> #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
>
> </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
Yeah, thanks, I think that's just what I need!
Best wishes,
Andrew P.
More information about the freebsd-questions
mailing list