ifconifg_rl0="inet 192.168.0.10 netmask 255.255.255.0"
ifconifg_xl0="inet 192.168.1.1 netmask 255.255.255.0"
defaultrouter="192.168.0.1"
nameserver 192.168.0.1
gateway_enable=YES
ipnat_enable="YES"
map tun0 192.168.0.0/16 -> 0.0.0.0/32 portmap tcp/udp 40000:65000 map tun0 192.168.0.0/16 -> 0.0.0.0/32
rdr [INCOMING INTERFACE NAME] [INCOMING IP ADDRESS/(32 FOR PUBLIC / 16 FOR PRIVATE)] port [PORT] -> [IP ADDRESS OF MACHINE YOU WANT TO FORWARD TO] port [PORT]An example, used for a webserver:
rdr tun0 70.232.254.2/32 port 80 -> 192.168.1.90 port 80
#ipnat -CTo load the new settings:
#ipnat -f /etc/ipnat.rulesTo view the current settings:
#ipnat -l
#cd /usr #fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz #tar xvfz ports.tar.gz
#cd /usr/ports/sysutils/rc_subr #make install clean
#cd /usr/ports/net/isc-dhcp3-server #make install clean
#ee /usr/local/etc/dhcpd.conf option domain-name "example.com"; option domain-name-servers 206.141.193.55; #a valid DNS server, given by your ISP option subnet-mask 255.255.255.0; default-lease-time 86400; max-lease-time 86400; ddns-update-style none; subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.150 192.168.0.200; #the range of IPs you want it to give out option routers 192.168.0.1; }
dhcpd_enable="YES"
#ee /etc/namedb/named.confuncomment where it says "forward only" and "forwarders" and place one of your ISP's DNS servers between the forwarders brackets.
named_enable="YES"
#ee /etc/ppp/ppp.conf default: set device PPPoE:xl1 #xl1 is the NIC the modem is connected to set speed sync set mru 1492 set mtu 1492 set ctsrts off enable lqr set log phase tun add default HISADDR #grabs the ISP's gateway's address and makes it your defaultrouter nat enable no att: set authname USERNAME #Replace USERNAME with your ISP login name set authkey PASSWORD #Replace PASSWORD with your ISP login password
#/usr/sbin/ppp -background att
ppp_enable="YES" #so that PPP starts ppp_nat="NO" #IPNAT does our NAT, so we don't want this ppp_profile="att" #use the 'att' profile ppp_mode="ddial" #this mode makes ppp reconnect when disconnected
#ifconfig rl0 inet 192.168.0.1 netmask 255.255.255.0 #ee /etc/rc.conf ifconifg_rl0="inet 192.168.0.1 netmask 255.255.255.0"
#nameserver 206.141.193.55