• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!


Port forwarding on FreeBSD via ipnat

Page history last edited by trunasuci 15 years, 3 months ago


it's normally happen when your server is running "behind the firewall" and using private ip network, we use port forwarding to forward "request" based on specified ports on services...

in this case, we take apache/http port 80 as an example



1- FreeBSD FW gateway + ipnat

ext ip = based on ISP, it's dynamic

internal ip =



2- NetBSD server which running web/apache/http

ip port 80/tcp



3- For IPNAT setup, refer to my previous HOW-TO NAT with ipnat on FreeBSD,


just edit /etc/ipnat.conf and add this value:


rdr tun0 0/0 port 80 -> port 80 tcp/udp




tun0 is device tunnel 0 created while ure using ppp foa dialing your DSL connection, any connection froum outside/internet to web services port 80, receive by FreeBSD gateway box, will be redirected to the NetBSD web server..


so after saving, u just need to flush and run/apply the rules..NAT with ipnat on FreeBSD



trunasuci# ipnat -FC && ipnat -f /etc/ipnat.rules

2 entries flushed from NAT table

4 entries flushed from NAT list



trunasuci# ipnat -l

List of active MAP/Redirect filters:

map xl1 ->

rdr tun0 port 80 -> port 80 tcp/udp

List of active sessions:

MAP      22    <- ->      22    [ 4741]



so now u can test it from outside/internet and see if u can reach the webserver behind the firewall..









Comments (0)

You don't have permission to comment on this page.