linuxnewbie.org.gif
Tuesday, 12-Dec-2000 10:38:17 EST
Newbized Help Files articles discussion board bookshelf sensei's log advertising info
Routing NHF--by Skippy

The first thing one needs to do is configure the network interface cards (NICs) for use.

There are several ways to do this. You could do it all by hand. But RedHat 5.2 includes a very nice utility called linuxconf. This is a hierarchical menu system of configuration options.
First, choose NETWORKING. Under here are several options. We want BASIC HOST INFORMATION.

Here, you can select a host name (which must be a fully qualified domain name). You can also select which ethernet adaptors to enable. Since we plan on using our Linx box as a router, it's safe to assume we'll need two adaptors.

NOTE: I originally tried to use two 3Com 3C509 cards, but ran into several problems. So I switched one with a LinkSys, and everything worked. Your mileage with two cards of the same type may differ.

NOTE: You may need to do some preparations on the cards before installing them (or before installing Linux). I would recommend running the included DOS utilities to manually configure your NICs IO address and IRQ. I chose IRQ 10, IO address 300 for my first card; and IRQ 5, IO address 210 for my second card.

Now in linuxconf, we select the first interface, and check the ENABLED box. Then you specify the configuration mode: Manual, DHCP, or BOOTP. My first adapter is connected to my internal network, and so it is manually configured with the following information filled into the following fields:

IP Address: 90.90.90.1
Netmask: 255.255.255.0
Net Device: eth0
Kernel Module: ne
IO Port: 0x300
IRQ: 10


You can really use _any_ IP scheme you want; although most folks will tell you to use 192.168.XXX.XXX. Netmask is your TCP/IP subnet mask; mine is a Class C network address (so is 192.168.XXX.XXX, by the way).

The Net Device is the interface name that Linux will use to communicate with this device. They are generally named "eth0" for the first one, "eth1" for the second one, etc etc. Kernel Module is the module that you will load that provides you kernel with information about this device. I'm using the NE2000 module. It's a generic ethernet module, and ought to work with a great many NICs. If your NIC is not listed in the available modules (/lib/module/preferred/net), try this one.

IO port and IRQ are the hardware information for your card.

Now we repeat the same process for the second card. Check the ENABLED box, and specify the particulars. My second NIC is connected to my cable modem, and it gets its configuration through DHCP. So I check the DHCP box in linuxconf for this interface. The only other information I need to supply to linuxconf for this interface is the Net device (eth1), the Kernel Module (3c509; since it's a 3Com 3c509 card, which has a supported module), and the IRQ (5).

If you had other NICs for any reason, you can configure them by following the same steps.

Now we need to tell Linux how it will communicate with the world. Select ACCEPT from the BASIC HOST CONFIGURATION screen, and scroll down to the next item: NAME SERVER SPECIFICATION (DNS). Check DNS USAGE, telling Linux that it needs DNS (Domain Name System - the process by which internet names are translated into internet IP addresses). You need to specify at least one nameserver. So far as I know, _any_ legal nameserver will work. Your ISP should have two. Mine are 204.210.252.252 and 204.210.252.250.

Select ACCEPT. Select Quit, and linuxconf will prompt you to activate the changes. Say yes.

Well, we're almost set, except that we need to make sure that Red Hat knows how to get IP addresses using DHCP. This is done with the DHCPCD (DHCP Client Daemon). On my Red Hat CD, it's an RPM in /mnt/cdrom/RedHat/RPMS/dhcpcd-0.70-2.i386.rpm. So cd to that directory and type
rpm --install dhcpcd-0.70-2.i386.rpm and it's in.

Since I come from the Windows frame of mind, at this point I would reboot my system.
reboot now or shutdown -Fr now.

When your system comes back online, you should see the networking information being displayed during the boot process. Here's what mine looks like:

sysctl: ip forwarding off
Swansea University Computer Society IPX 0.34 for NET3.035
IPX Portions Copyright (c) 1995 Caldera, Inc.
Appletalk 0.17 for Linux NET3.035
ne.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)
NE2000 ethercard probe at 0x300: 00 02 67 00 47 83 eth0:
NE2000 found at 0x300, using IRQ 10.
eth1: 3c509 at 0x210 tag 1, 10baseT port,
address 00 20 af 39 0f ac, IRQ 5.
3c509.c:1.16 2/3/98 becker@cesdis.gsfc.nasa.gov
eth1: Setting Rx mode to 1 addresses
.

Everything looks set. Log in as root, and try to ping something.
ping www.linuxnewbie.org You should get some responses if everything went right.

Now it's time to configure the routing function. This is done with an extremely powerful tool called ipautofw (IP Auto Forward). If you didn't install it already, just go to /mnt/cdrom/RedHat/RPMS and type
rpm --install ipfwadm-2.3.0-6.i386.rpm You now have ipautofw installed in /usr/bin.

ipautofw uses rules to tell your system what kind of traffic is allowed in what direction. It's quite complex in it's entirety, but we only need a couple of items:
echo "1"> /proc/sys/net/ipv4/ip_forward
ipfwadm -F -p deny
ipfwadm -F -a m -S90.90.90.0/24 -D0.0.0.0/0


Edit /etc/rc.d/rc.local and put these three lines in it. Now every time you boot, IP forwarding will start, and your machine is now a router!

Just configure your clients to use the internal interface on your Linux box as their default gateway, and supply them with DNS name servers (probably the same two you used for your Linux machine!) Enjoy!!
[-NHF Control Panel-]
The Linux Channel at internet.com
Linux Planet
Linux Today
Linux Central
Linuxnewbie.org
PHPBuilder
Just Linux
Linux Programming
Linux Start
BSD Today
Apache Today
Enterprise Linux Today
BSD Central
All Linux Devices
SITE DESCRIPTIONS
[-What's New-]
Order a Linuxnewbie T-Shirt
Easy Webcam NHF
Directory Navigation NHF
Installing Snort 1.6.3 on SuSE 6.x-7.x
Customizing vim
The SysVinit NHF
Installing ALSA for the VT82C686 integrated sound
USB Creative Video Blaster II for Linux
Configuring the Intellimouse Explorer in XFree86 V4+
The beginnings of a distro NHF
Getting Past Carnivore?
Getting and Installing PGP
Getting your ATI Rage 128 Working
How to create a multiple partition system
Using Fdisk
Introduction to Programming in C/C++ with Vim
Adding a Hard drive in Linux -- In five steps
Installing ALSA for the Yamaha DS-XG Sound Card
Getting your Diamond Rio Mp3 Player to work with Linux
Bash Programming Cheat Sheet
Installing NVIDIA Drivers for Mandrake
Setting up Portsentry
Hard Drive Speed Tweak for Linux
Sensei's Log
Chat room
Join: Linuxnewbie.org SETI Black Belts!
Send in your news
Click the image to add Linuxnewbie.org to your MyNetscape Page
[-LNO Newsletter-]

[-Archive-]
The beginnings of a distro NHF
Connecting to the Internet using KPPP
Getting your SBLive to work
Unreal Tournament NHF
LWE Day 2 Pictures
LWE Day 1 Pictures
The LNO FAQ!
WoW (Words of Wisdom)
Other sites news
What is Linux?
What is Linux? part deux (ups & downs)
Search newsgroups
The List
ALS Report
Feedback Form
jobs.linuxtoday.com.gif
Match: Format: Sort by:
Search:
[-Quick Links-]

Copyright 2000 internet.com Corp. All Rights Reserved. Legal Notices Privacy Policy

internet.com.gif