Quick+easy port redirect

Robert Jesacher jessy at sicha.net
Sat Mar 29 13:09:21 PDT 2008


On 29.03.2008, at 01:25, Tuc at T-B-O-H.NET wrote:
> Hi,
>
> 	Is there a quick/easy (cookbook?) way to do port
> redirects. Basically I want that anything that leaves
> a specific interface to any ip on port 80 go to
> 192.168.0.1 port 87.
>
> 	I'm using ipfw for some other things so it has to
> work and play well with that.
>
> 			Thanks, Tuc


In case you want to try transparent proxying you need to look into  
firewalling.
I can only tell you how this would work with OpebBSD's PF since I use it
myself and quite like it. :-)

Have a look at pf.conf(5), but it should work like this (in /etc/ 
pf.conf):
+++++++++++++
int_if = "em0"

rdr on $int_if proto tcp from $int_if:network port { 80 } ->  
192.168.0.1 port 87
+++++++++++++
In this example you need to specify your network interface as int_if  
(in my case it is em0)

If this doesn't suit your situation, you probably need to give us more  
information: The
kind of network setup you use (eg internal -> firewall -> external)  
and what needs to connect
to and from where. do you have a firewall solution in place (PF,  
ipfilter, ipfw)? And what do
you need to achieve?

br & good luck,
Robert


More information about the freebsd-questions mailing list