ipfw nat on FreeBSD 7

In the kernel configuration add:

options IPFIREWALL # firewall
options IPFIREWALL_VERBOSE # enable logging to syslogd (8)
options IPFIREWALL_DEFAULT_TO_ACCEPT # allow everything by default
options IPDIVERT
options IPFIREWALL_FORWARD
options DUMMYNET
options IPFIREWALL_NAT # ipfw kernel nat support
options LIBALIAS

in /etc/make.conf:

CFLAGS + =-DIPFIREWALL_NAT 

Then rebuild your system:

cd /usr/src/; make builworld & & make kernel KERNCONF = YourKern & & make installworld reboot

In the configuration file ipfw:

NatIP = "111.111.111.111"
ipfw nat 123 config ip $ (NatIP) log
ipfw add nat 123 10 ip from 192.168.0.0/16 to any
ipfw add nat 123 20 ip from any to $ (NatIP)

Enjoy the kernel nat

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.