ShareInternet - Share Internet Interface with local Interface V2.1

ShareInternet is an application to help in running Puppy as a router. It is designed to be versatile, in that it is agnostic about, but not insensitive to, the types of interfaces that are used. It is meant to be an icon on the desktop that, once you have activated the appropriate interfaces, you click on it and through traffic can flow. A later click on the same icon and through traffic will stop.

When it's icon is clicked, it starts the firewall, suitably configured to protect the Internet interface, but leave the local interfaces alone, (pseudo interfaces generated by wireless drivers, are included in the local interface list so the firewall will leave them alone). The firewall also provides a NAT service so that there are no up-stream routing difficulties. Then it starts dnsmasq suitably configured to provide a dhcp service on the local interface (dnsmasq in included in the .pet).

Once ShareInternet is installed, if onDesktop is installed, an icon will appear on the desktop when onDesktop is run. Otherwise, "/root/my-roxapps/shareInternet" can to be dragged to the desktop to provide an icon. Of course it is also possible to use the icon in "/root/my-roxapps" directly.

To have ShareInternet started automatically at boot time, copy "/usr/local/shareInternet/shareInternet.Startup" to "/root/Startup".
Alternatively append the line in "/usr/local/shareInternet/shareInternet.rc.local" to "/etc/rc.d/rc.local".
Using "/root/Startup" provides more time for all interfaces to activate. Using "rc.local" provides less time for all interfaces to activate.
If you are not sure, use "/root/Startup".

ShareInternet can work with any combination of ethernet, wifi, or ppp interfaces. Interfaces are not configured into ShareInternet, it works with whatever interfaces are active.
So, all the interfaces you intend to use must be "UP", before ShareInternet is started. This can cause problems when ShareInternet is started automatically at boot time. Some wifi interfaces apparently take a long time to activate. In this case it's probably a good idea to start it as late as possible, i.e. from within "/root/Startup". And if this is still too early, configure a "BOOT_DELAY".

When ShareInternet is run, it configures the interface that connects to the network that contains the default gateway, as the Internet interface. All other interfaces are considered to be local interfaces.

ShareInternet config files:

The file "/root/.shareInternet/share.conf" defines various directories and settings, used by ShareInternet.
#BOOT_DELAY="10"; If set, defines the seconds to delay before actually starting ShareInternet at boot time. The delay can be used to make sure that all interfaces have enough time to be UP, before ShareInternet is actually started. Only used if ShareInternet is run using either the "startWithX" or "startNoX" scripts. The default is unset.

The file "/root/.shareInternet/dnsmasq.conf" defines some settings that change the way dnsmasq does dhcp.
DHCP_START="100" defines the starting host part for lease IP addresses.
DHCP_END="200" defines the ending host part for lease IP addresses.
DHCP_TIME="60000" defines the timeout of the lease in seconds.
So, if the IP address of the down stream interface is 192.168.111.1, then the above settings mean that dnsmasq will handout IP addresses starting with 192.168.111.100 and ending with 192.168.111.200.

The file "/root/.shareInternet/iptaplesExtraRules" is executed after "/etc/rc.d/rc.firewall". It is expected that this file will contain commands to add rules to the firewall using the "iptables" utility. The default file contains only comments.

Recommendations for configuring your interfaces:

The Internet interface needs three things; an IP that is valid on the network it connects to, the IP address of the gateway/router on that network, and the IP address of at least 1 DNS server appropriate for that network.
Both ppp and dhcp automatically provide all this for you.

The local interfaces need only an IP address that is in a different network than every other interface.
This should be a static configuration, with no gateway or DNS defined. On any local network Puppy is the gateway.

Changes in v2.0:

Now automatic, just activate at least two interfaces, and start it. It works out everything by itself.

If upgrading to v2.0:
It is recommended that you make a fresh start by deleting the directory "/root/.shareInternet" before running V2.0

Important Note:

ShareInternet uses it's own version of "/etc/rc.d/rc.firewall".
The change is that "INTERNAL_INTERFACES" and "DYNAMIC_INTERFACES" are defined in "/etc/rc.d/FWINTERFACES" instead of being hard coded within "rc.firewall".
This enables ShareInternet to dynamically configure these by overwriting "FWINTERFACES".
Unfortunately this means that running Puppy's firewall wizard after ShareInternet is installed will stop ShareInternet from working.