Projects

If you're not part of the solution, you're part of the precipitate. -- unknown

Linux and Network Address Translation

For those not familiar with sharing an Internet connection among multiple computers, I will explain my setup at home. My roommates and I own several computers and have run ethernet throughout our house. Sharing one Internet connection is a necessity.

I run a Linux box at home (named Sphynx) that serves as our gateway to the Internet. Sphynx has two ethernet cards in it: an "external" one for the connection to the Internet and an "internal" one for connection to the house's network. The external card is easy to explain--it simply plugs into our cable gateway (aka "modem"). The external card gets an IP address assigned by our ISP.

The internal card plugs into our 16-port ethernet switch. All the computers within our home can talk to each other using the switch, but for them to talk to the Internet, the internal and external ethernet cards within Sphynx need to talk to each other.

For this, we use network address translation. Basically, all the computers in our house have IP addresses I have assigned. Whenever Sphynx hears an Internet request on the internal card, Sphynx rewrites the packets to pretend it is sending the request, and does so through the external card. When an Internet reply comes back, Sphynx rewrites the packets and sends them through the internal card back to the originating computer.

To allow flexibility within our internal network, I have a DHCP daemon running that listens to DHCP requests on the internal network. If friends bring over computers to play games, they simply plug into our network and gain Internet access.

Content updated: 03 Jul 2003

Every page of this site is XHTML 1.1 validated. Portions of this website are protected by U.S. copyright law. The remaining portions are released to the Public Domain. See my copyright notice for details.