|
|
|
| Setting Dial-up Internet Gateway | |
|
|
|
| In order to fulfill the demand of NAT(Network Address
Translation ) and Firewall, FREEBSD provides 2 different filtering
default packets; one IPFW for firewalling and NATD for NAT. For further
information you can , visit http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls.html
. it might help you for a better understanding of IPFW and NATD.
On the other hand, we are here not to discuss about using either NATD or IPFW, rather we are going to discuss about IPFilter to replace IPFW and NATD.We can go to the IPFILTER official site, http://coombs.anu.edu.au/ipfilter/ , download the source and we need to rebuild the kernel to install IPFILTER, It is recommended for us to read the README file before installing IPFilter due to different versions that exist: each version has its own way of installing . As an example I used IPFilter v3.4.20, I do these following steps : #tar -xzvf ipfilter-xxx.tar.gz #cd ipfilter-xxx/ #make freebsd4 #make install-bsd #FreeBSD-4/kinstall And now it's time to rebuild your kernel : #cd /usr/src/sys/i386/conf/ edit the kernel configuration file (e.g. GENERIC ). advisable for you to make a backup , copy the GENERIC to the file called KERNIPF. Open KERNIPF file with your editor and add this : options IPFILTER change the ident section : ident KERNIPF save the file and exit, afterwards : #config KERNIPF #cd ../../compile/KERNIPF #make depend #make #make install #reboot After rebooting, make sure that your IPFilter already been installed.
To know whether you have already installed your IPFilter # ipf.rules sample ----------------------------------------------------------------------------------------------------------------------------- #ipnat.rules sample Note : rl0 = ethernet interface , tun0 = external interface/ PPP tunnel ( the interface which connect to internet ), lo0 = loopback Put the ipf.rules and ipnat.rules files in /etc/ , to make the rules work each time the system rebooted , open your rc.local file and put these command : /sbin/ipf -f /etc/ipf.rules Reboot your computer . To check and make sure whether the rules are loaded , type : #ipfstat -hio #ipnat -l The IPFILTER should work well now. As a gateway for your clients we have to enable net.inet.ip.fowarding by putting gateway_enable="YES" in your rc.conf file.
G-net Pekalongan, june 2002 by esteh Back to INDEX |
|