Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jun 2006 23:16:33 -0500
From:      Dennis Olvany <dennisolvany@gmail.com>
To:        regi@via-rs.net
Cc:        questions@FreeBSD.org
Subject:   Re: FreeBSD firewall, nat, kernel
Message-ID:  <448F8DA1.4080605@gmail.com>
In-Reply-To: <28713720.541071150205688169.JavaMail.tomcat@peto>
References:  <28713720.541071150205688169.JavaMail.tomcat@peto>

next in thread | previous in thread | raw e-mail | index | archive | help
 From a fresh install, a working nat should only require a few commands. 
Kernel compilation is not necessary.

kldload ipfw
kldload ipdivert
sysctl net.inet.ip.forwarding=1
dhclient xl0
natd -dynamic -n xl0
ipfw add divert natd ip from any to any via xl0
ipfw add allow ip from any to any
ifconfig rl0 192.168.100.253/24

To make the config permanent, you just need to use the rc equivalents of 
those commands.

/etc/rc.conf

firewall_enable="yes"
firewall_type="/etc/ipfw.rules"
gateway_enable="yes"
ifconfig_xl0="dhcp"
ifconfig_rl0="192.168.100.253/24"
natd_enable="yes"
natd_interface="xl0"

/etc/ipfw.rules

add divert natd ip from any to any via xl0
add allow ip from any to any



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?448F8DA1.4080605>