## 46.13. Gatewaying from a Personal LAN over a Modem

Often you have only dialup access but would like your home network to be able to access the Internet. A simple way to do this is to configure one Unix machine as a gateway (Section 46.11), with one side of the gateway your LAN and the other side the modem connection. If you then set up the modem connection to dial on demand, you have a simple way to share your connection between all of the machines on the LAN.

All that's required is that you set up your PPP connection (Section 44.11), turn on PPP's NAT (Section 46.11) handling and then turn on gatewaying (Section 46.11). Make sure that all your LAN machines point to the gateway as their default gateway (handing out addresses via DHCP (Section 46.10) is an easy way to ensure this). Any attempt to access the Internet by any machine on the LAN will then cause your gateway to dial up your ISP, if the modem isn't currently connected.

Note that I said that you had to turn on NAT handling. A dialup almost always means that your dialup machine will be getting a dynamic address, and the only way to have multiple machines behind a dynamic address is NAT. Because this is so common, some PPP clients have NAT built in; no configuration is required and no separate natd needs to be run. NAT simply has to be enabled, generally with the -nat option. (Linux's pppd does not support NAT by itself. Read the masquerading HOWTO at http://www.linuxdoc.org/HOWTO/IP-Masquerade-HOWTO/ for more information on how to deal with NAT on Linux.)

-- DJPH

Copyright © 2003 O'Reilly & Associates. All rights reserved.