Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to setup 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 lipcap 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?

share|improve this question
add comment

1 Answer

Userspace natd needs ipfw enabled. IPFW catch packets and redirect them to the natd that translate addresses. But nowaday you can use kernel nat embedded into ipfw.

Let's enable IPFW engine

# /etc/rc.conf
. . . . .
gateway_enable="YES"
firewall_enable="YES"
firewall_nat_enable="YES"
firewall_script="/etc/rc.ipfw"
. . . . .

And let's configure kernel redirection:

# /etc/rc.ipfw
. . . . .
oip="1.2.3.4"   # Outer IP looking to the internet
tip="10.0.0.100 # Target host
ipfw nat 1 config redirect_addr ${tip} ${oip}
. . . . . 

That's all.

share|improve this answer
    
Thanks a lot. I tried this rule, and added several other after it to allow traditional traffic. It doesn’t work as I expected. Several things that I am not sure about. 1- should this rule show up when i use 'ipfw list' because it doesnt for me? 2- The NAT machine acts as a gateway so I want it to be able to DNS and what not without redirection. Any thoughts? –  nawar Dec 26 '13 at 8:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.