SHARE AN INTERNET CONNECTION WITH MULTIPLE COMPUTERS

These days, high-speed home connections to the Internet are pretty much the norm. And with the low cost of computers, multiple computers in a home office are becoming the norm as well.

With "always-on" connections, the need for a firewall becomes more of a requirement than a luxury, and there's a number of fairly inexpensive hardware appliances available that act as both firewall and router. However, your Linux desktop can fulfill this need and save you a few dollars in the process.

Linux offers the ability to act as both firewall and router for multiple computers. You can easily set this up using iptables.

A number of tools exist to help build firewall scripts using iptables. If you just want to share a connection with a very simplistic firewall, you can even be up and running in a few minutes.

Execute the following commands on your Linux box. This example assumes that eth0 is the network interface connected to the cable or DSL modem.

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# modprobe ip_conntrack_ftp
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -P INPUT DROP

Of course, this is greatly simplified; it's just the basics to get you up and running quickly. For a more comprehensive firewall solution to handle both the firewall and the sharing aspects of the setup, check out tools such as Shorewall.

Keep in mind that it doesn't matter what systems you're running on your network, be it Windows, Macs, or other Linux systems. All you need to do is tell those clients to use this Linux machine as the gateway.