18.5. Sharing a Dial-Up Internet Account
Problem
You have a small number of users who need to share a single dial-up Internet account. Maybe it's all you can afford, or it's all that's available, or maybe your needs are so minimal you don't need broadband. It could even be a fiendishly clever method for discouraging users from web surfing. You might have a mix of platforms on the client side—Linux, Mac, Windows. Your LAN is already set up and functioning. You want to use an old PC as your Internet gateway.
Solution
Use an old PC to act as your Internet gateway. Configure a dial-up account on this machine, then configure IP masquerading to direct all those Internet packets to all the hosts on your LAN.
You'll need the following:
A modem on the dial-up server
A program like WvDial, KPPP, or Gnome-PPP to configure dial-up networking on the server
First, connect the modem to the phone line, and set up your dial-up account. Do not connect the gateway box to the LAN yet. Get your dial-up account or accounts set up and working.
Then, run these iptables rules from the command line:
# modprobe iptable_nat
# iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# echo "1" > /proc/sys/net/ipv4/ip_forwardNow, when the gateway machine is connected to the LAN, all users can share the connection. This provides no security whatsoever, and no persistence between reboots, so you need to add these rules to a proper iptables firewall script. Please see Chapter 3 to learn how to build a firewall.
Discussion
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access