Step 1 In the file called services
, in the directory /etc add the following line natd 6668/divert # Network Address Translation socket
Step 2
The next file that we will be vi'ing is the rc.firewall it also is in the /etc directory. The things that we need to add to the file are the following items.
/sbin/ipfw -f flush /sbin/ipfw add divert natd all from any to any via ed0 /sbin/ipfw add pass all from any to any
(* Where the ed0 is, put whatever device your network card is)
Step 3 You will also need to modify the file rc.conf
it to is in the /etc directory. Make this change, there is already a line that says firewall_enable=NO Change it to say the below instead
firewall_enable=YES
Step 4 You need to modify your Kernel, to build a custom kernel, the following lines will be commented out, you need to remove the # in front of the line, to make these commands work.
options IPFIREWALL options IPDIVERT
Once you have done this, you need to recompile your kernel, if you don't know now to do this, see the Unix help page, on how to compile the Kernel.
Step 5 Vi rc.conf it is in the /etc directory. Makes the following change sysctl -w net.inet.ip.forwarding=1
Step 6
Once you have all the above items done, you may go forward. Otherwise, if you have not done all of the above, the NATD wont work. You can type the following lines to turn NATD on.
natd -l -s -n tun0 -redirect_port tcp 10.0.0.4:2121 2121 ipfw add 1000 divert 6668 ip from any to any via tun0 ipfw add 1002 divert 6668 ip from 10.0.0.4/24 to any via tun0
If you wish to have NATD load during boot-up, then all the items in step 6 to your rc.local file, located in the /etc directory.
|