Redirection with natd flags

I am trying to set[ ]up a basic NAT server. I want all traffic coming from the outside world to the NAT server to be redirected to another machine, where I have a libcap service running to parse this traffic.

I tried -redirect_port and -redirect_address in the natd_flags part in rc.conf but nothing works. Any thoughts?
 
The correct syntax of /etc/natd.conf is:

Code:
redirect_port tcp ip:port port

Example:

Code:
redirect_port tcp 10.157.22.20:3310 3310

Without the leading dash ( - )

There is no need to use natd_flags.
 
There are many ways to redirect all traffic (NAT).

1. Using natd daemon:

In /etc/rc.conf:
Code:
gateway_enable="YES"
natd_enable="YES"
natd_interface="xx0" # The NIC connected do the internet

2. Using PF (the way I use)

In /etc/rc.conf:
Code:
gateway_enable="YES"
pf_enable="YES"

In /etc/pf.conf:
Code:
ext_if="xx0" # The NIC connected to the internet
lan={ 10.157.22.0/24 } # Your internal network
nat on $ext_if from  $lan to any -> ($ext_if)

Also it can be done with IPFW, check handbook.
 
Back
Top