To share the internet connection we have to make sure that the TTL value is bigger then 1. In case that the TTL is 1 we will have to increase it. This article is going to describe how to increase the TTL so the other machines behind your router will be able to use internet.
Internet connection device: eth0
Internal network device: eth1
Here is a simple script that is doing it:
You can save this script in a file located for example at /etc/ and then set it to be executed everytime when the system boots.
For example in Slackware this can be done by using the command chmod +x /etc/script-name (this is to make it executable) and then putting the full path to it in /etc/rc.d/rc.local.
The other method to add it is to include it in the default script for the firewall as it is in Fedora Core: /etc/sysconfig/iptables
The code you need to put in this script is:
Once this is added you can save the file and execute the command: service iptables restart (working on Fedora Core. Most probably won’t work with other distributions and you will need to find the starting script for iptables in your distribution and execute it with the restart option.)
P.S. I’ll wait for your comments to improve the article.