Building a Linux Dial-up Server, Part 1 - Page 3

By Carla Schroder | Jun 27, 2003
Page 3 of 3   |  Back to Page 1
Print ArticleEmail Article
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn

Configuring NAT

Once your dial-up server can connect to an ISP, the next step is to enable other hosts on your LAN to share the connection. Presumably your LAN is up and running, and all the machines can ping each other. If not, well, we're going to move ahead without you. Please catch up when you can.

iptables takes care of sharing an Internet connection quite nicely. Here is a simple recipe:

# modprobe iptable_nat
# iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# echo "1" > /proc/sys/net/ipv4/ip_forward

These can be run from the command line or nicely ensconced in a script. The first line loads the NAT kernel module. The second line turns on masquerading. The third line turns on forwarding, which is commonly disabled in the kernel by default. WARNING: There is absolutely zero security in this! None! Do not use this alone! Please see Resources for links on building a firewall. "Linux IP Masquerade HOWTO" is especially useful for this.

To see which netfilter/iptables modules are installed on your system, try:

# grep netfilter /lib/modules/`uname -r`/modules.dep

Note that `uname -r` is surrounded by backticks, not apostrophes. The backtick key should be the lowercase of the tilde, next to the number 1 key on the top row. This demonstrates a lovely feature of the bash shell -- command substitution. To see what kernel modules are loaded, run good ole lsmod.

Well that's enough for today. In part 2 we'll create a dial-in server and set up dial-on-demand.

Resources

Linux PPP HOWTO
Freesco
wvdial
How to hook up PPP in Linux
Linux IP Masquerade HOWTO


» See All Articles by Columnist Carla Schroder


Comment and Contribute
(Maximum characters: 1200). You have
characters left.
Get the Latest Scoop with Enterprise Networking Planet Newsletter
Helpful Links
  • Yankee Group Mobile WAN Optimization Report

    Mobile work continues to evolve. Your organization must keep up with the demands of its mobile workforce. This report introduces the concept of mobile WAN optimization and provides three case studies including RCM, PRTM and Einstein that highlight how this emerging technology can help IT departments achieve what previously appeared to be conflicting goals. Read >

  • Network Security Resources

    More threats than ever before pose a danger to today's enterprise network. Get the latest tips and intel on the newest risks in our guide to network security resources. Read >

  • Extreme Savings: Cutting Costs with WAN Optimization

    Did you know it's possible to cut IT costs without impacting day-to-day IT operations? In fact, when you download this whitepaper from Riverbed on cost-savings through WAN optimization, you'll discover how businesses of all different sizes have realized a return on investment in just a few months through significant hard cost savings in areas such as bandwidth reduction and IT consolidation. It's called Extreme Savings and its only from Riverbed. Read >