Tech Tip: Share an Internet connection with multiple computers in Linux
Takeaway: Here's how to 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.
SponsoredWhite Papers, Webcasts, and Downloads
- Microsoft SQL Server and Dell EqualLogic PS Series Solution Brief Dell EqualLogic
- Economist Intelligence Unit whitepaper: "Enterprise Knowledge Workers: Understanding Risks and Opportunities" SAP
- Does fragmentation affect SANs, NAS, and RAID? Diskeeper
- Defrag Myth Busters - What You Should Know Diskeeper
- The Road Ahead for Business Process Management SAP
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET

