Comments
bruce.armstrong wrote: Somebody just said it better than I did, and with more chops to say it: Open Letter to Mark Zuckerberg, Sheryl Sandberg & Facebook Mobile
Cloud Expo on Google News

SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
Configuring a quick-and-dirty router and proxy
For security, you'll need a firewall

Q: Maybe you can help. I want to set up my Mandrake 7.2 machine as a router and proxy with a 3Com 56K Message Modem (serial) as dialup-on-demand and a 3Com 3c509 Ethernet card.

A: Setting up a router and proxy is a huge subject, but I will give you the basics and some pointers to get you started. There are a couple of technical terms that you have to be familiar with. The first is "IP-Masquerading." If you refer to the IP-Masq-HOWTO located at the Linux Documentation Project Website (see Resources), it will tell you in Section 1.1: Introduction to IP Masquerading (or IP Masq for short) that:

IP Masq is a form of Network Address Translation, or NAT, that allows internally connected computers that do not have one or more registered Internet IP addresses to have the ability to communicate to the Internet via your Linux box's single Internet IP address. It is possible to connect your internal machines to the Linux host with LAN technologies like Ethernet, Token Ring, FDDI, as well as other kinds of connections such as dialup PPP or SLIP links. This document uses Ethernet for the primary example since it is the most common scenario.

In other words, you may use a single network interface to provide general Internet access to a private network. IP MASQ, then, is the baby brother of NAT.

NAT is different, though. It allows you to map external addresses or ports to internal addresses or ports. For example: I have a machine that is on a private network, but I want to allow the Internet direct access to the machine. You can use NAT to allocate a real IP address (say, 64.81.28.144) to your machine that is really located locally on 192.168.1.5. If you did this, anyone who connected to 64.81.28.144 would actually connect to the machine on 192.168.1.5. This can be very useful if you map specific ports.

Here are the basic steps that you will need to create an IP Masq gateway. I warn you, though, that these steps are basic and will do the job, but you will need to secure the firewall machine. I am not going to talk about how to make the PPP connection. If you are unsure about how to do this, take a look at the PPP-HOWTO (see Resources). I suggest using kppp or LinuxConf to set up the machine. Nor am I going to talk about setting up a basic network. If you are looking for information on that, you can refer to the Linux Networking HOWTO (see Resources).

Setting up IP Masq

IP Masq is very simple to set up. There are many ways to do it, so I'll show you the way I do it on the machines I manage. First, you'll want to open your rc.local file. It is located in /etc/rc.d/. At the bottom of the file, insert the following lines:

# Begin IP-MASQ settings

#

#

#

echo 1 > /proc/sys/net/ipv4/ip_forward

echo "Setting the default policy to deny"

/sbin/ipchains -P forward DENY

echo "Masquerading for private network"

/sbin/ipchains -A forward -s 192.168.1.0/24 -j MASQ

#

#

#

# End IP-MASQ settings

The lines you just typed in will execute every time the machine reboots. The first line turns on the ip_forward function within the Linux kernel. You can also set this within the /etc/sysctl.conf file. The third line tells ipchains that the default firewall policy is DENY. In other words, everything for the forward policy is denied by default. The fifth line turns on a forward policy for the source class C network of 192.168.1.0, and allows the forwarded packets to masquerade.

The next thing you need to do is start the routed daemon. You can do this by executing the following command: service routed start. You will also want to verify that you have enabled the routed service to start at run level 3. You can do this by typing the command: chkconfig --list routed. If you need more information on runlevels or chkconfig, take a look at previous Ask the Geek articles on the subject (see Resources).

Again, I want to emphasize that the above masquerading setup is not secure. I repeat, the above masquerading set up is not secure. It is only the absolute minimum required to get masquerading to work. For a basic secure firewall tool, take a look at Guarddog. Guarddog is a reasonably complete point-and-click X application that enables and disables ports and services within Linux's firewall capabilities. (See Resources for more on Linux Firewalls.)

Guarddog also allows you to manage some commonly used ports such as ICQ, Real Audio, or Napster.

When you use IP Masq there will be some functionality that won't work correctly for machines that are not directly connected to the Internet. Software such as Real Audio streaming and FTP will not work without loading an appropriate masquerading kernel module.

Below are some common modules that can be loaded with the kernel:

  • FTP: ip_masq_ftp.o
  • Real Audio: ip_masq_raudio.o
  • VDO Live: ip_masq_vdolive.o
  • CU See Me: ip_masq_cuseeme.o
  • IRC: ip_masq_irc.o
  • Quake: ip_masq_quake.o

The Linux kernel modules are loaded and managed in a number of ways, including from the /etc/conf.modules and /etc/modules files, through kerneld, or simply through insmod statements on each module in your rc.local.

In closing, I would like to make an addendum to the last edition of Ask the Geek. I made a blanket statement that Linux does not like PCI Modems. This is still generally true, but US Robotics has since contacted me and provided a list of PCI modems that work with Linux, along with configuration instructions. These instructions come directly from Robert_Mikul@usr.com at US Robotics.

US Robotics PCI modems that work with Linux:

  • 00560900
  • 00561000
  • 00561001
  • 03CP5610
  • 3CP5610A
  • 03CP5613

You must have kernel version 2.2.14 or higher and follow this procedure:

After Linux starts, log in as the root user. At a console, type: cat /proc/pci

Scroll down until you find the data for the serial controller. Mine looks like:

Bus  0, device  15, function  0:

Serial controller: Unknown vendor Unknown device (rev 1).

Vendor id=12b9. Device id=1008.

Medium devsel. IRQ 10.

I/O at 0xfff0 [0xfff1].

Make a note of the values for IRQ and I/O port. In my case they were 10 and 0xfff0, respectively.

Then type: setserial /dev/ttyS1 irq 10 port 0xfff0 autoconfig where irq and port are the values of the information you found from viewing the /proc/pci file. Then create a symbolic link between /dev/modem and /dev/ttyS1 with the ln command: ln /dev/ttyS1 /dev/modem

Then type: minicom

If you do not have minicom you can try cu or seyon, as well.

At this point, you will need to use the setserial command each time you reboot your machine. To make it automatic, enter the setserial command at the end or your rc.local file so that it is executed automatically each time you reboot.

To do this, in the terminal window type: cd /etc/rc.d/ then hit enter.

Now open rc.local with your favorite text editor. Scroll down to the bottom of the file using the arrow keys and type in:

# US Robotics PCI Controller Based Modem Initializing Setup

setserial /dev/ttyS1 irq 10 port 0xfff0 autoconfig

Again, the irq and port are what you got from your cat /proc/pci listing.

You can now save the file and exit. The setserial program will run on each reboot.

About Joshua Drake
Joshua Drake is the co-founder of Command Prompt, Inc., a PostgreSQL and Linux custom development company. He is also the current author of the Linux Networking HOWTO, Linux PPP HOWTO, and Linux Consultants HOWTO. His most demanding project at this time is a new PostgreSQL book for O'Reilly, 'Practical PostgreSQL'

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Latest Cloud Developer Stories
HP said Wednesday that it would lay off 8% of workforce, 27,000 people, by October or 2014. It figures the move will save it $3 billion-$3.5 billion and expects to re- invest the money in cloud, security and Big Data.
With Cloud Expo 2012 New York (10th Cloud Expo) now under three weeks away, what better time to introduce you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and...
What do the CTOs of the CIA and the U.S. Dept. of Justice and the CIO of the National Reconnaissance Office have in common with the CEOs of Eucalyptus, GoGrid, ActiveState, Appcara, OpSource and Nortonworks, the CTOs of Rackspace, SoftLayer, SOA Software and AppZero, the Founder ...
Grid Dynamics, an eCommerce technology solutions company, and GridGain Systems, makers of an open source in-memory platform for Big Data processing, on Wednesday announced the expansion of their partnership which began in 2008. Grid Dynamics provides personalization and big data...
ServerCentral, Chicago’s leading provider of colocation, cloud, network connectivity, and managed services, announced on Tuesday that its high performance cloud will debut on June 11 at the 10th International Cloud Expo, held June 11-14 at the Javits Center in New York City. “Se...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE

Breaking Cloud Computing News
Acceleware® Ltd. ("Acceleware" or the "Company") (TSX VENTURE:AXE), a leading developer of high perf...