Configuring the Network Interface Cards

These notes apply to Windows 98 and Red Hat Linux version 6. In other versions of these operating systems the procedure will probably be similar, but a few details may vary.

Initial Card Configuration

When you fit the card, you have to specify various settings. Depending on the card, this may be completely automated or semi-automated.

Every interface card on your PC uses an IRQ number and an I/O address range. Each card has to use a different pair of these values. During the configuration you need to tell the card which values to use. Most cards will either figure out their own values or show you a list of spare ones and let you choose.

With an ethernet card, you may also have to set the interface type and the speed. The interface type is one of the sockets on the card. It could be BNC (a circular socket), AUI (D-shaped) or RJ45 (square). You want RJ45.

Some cards only run at one speed, 10base-T (10 Mbps). Some can also run at 100base-T (100 Mbps). Most dual-speed cards are auto-sensing: they attempt to figure out the maximum speed that the device at the other end of the wire can handle, and use that, but they don't always get it right. Set the card to use auto-sensing or set the speed to suit the device you are connecting to.

When used with Windows, the more expensive ethernet cards are self-configuring. Some of the cheap ones are too. Put the card in and switch the PC on. The PC boots, detects the new card and installs the device driver (next section).

If you are running Linux on your PC or if the Windows autoconfiguration doesn't work, you will have to configure the card manually, using the software that comes with it. This will be on a floppy disk, maybe with some installation instructions.

The configuration software runs under DOS. From Windows you have to reboot into DOS (a DOS window is not sufficient). If the PC is running Linux, shut it down and boot it off a DOS floppy such as a Windows 98 recovery disk. Make a note of the IRQ and I/O address values that get set.

If you have a very old ethernet card, you may need to tell it what IRQ and I/O values to use. This is a bit messy. Cards are cheap, so it's easier to buy another. If you have to use one of these cards, reboot back into Windows and look at the existing configuration. This involves stepping through various menus.

To stop this note getting even longer, I am going to use a short notation to describe Windows menus. When I say something like "select my computer/control panel/network", I mean go to the "My Computer" icon on the screen and double click on it. This opens a panel with another set of icons including "control panel". Double click on that, which open another frame with more icons. Double click on "network".

To find which IRQ numbers are already in use, go to my computer/control panel/system/device manager/network adaptors and right-click on the entry system . Choose the properties tab. It will show you a list of devices and what IRQ number each is using. Choose a number 0-15 which isn't in that list.

The only way I know to find an unused I/O address range is to examine the entry for each of the other devices and make a list. Go back to the network adaptors menu, select each of the devices in turn, display its properties and look at the resources tab.

Once you have done all that, reboot into DOS or Linux and complete the configuration, as described next.

Configuring Windows to use the Interface Card

Once you have put the card into the PC, the next time you start Windows it detects the new card and installs the device driver. This may be on your Windows distribution CD. If not, it will be on a floppy disk supplied with the card. The driver will select suitable settings. Then the system will then load some other stuff off the Windows distribution CD. As I explained earlier, if you don't have a Windows distribution CD, you will get stuck at this point.

If the card is not self-configuring, you may have to supply the IRQ and I/O values that you set.

The next step is to set the card's ethernet address. You do this according to your circumstances. For example, let's say that we are setting up a gateway with a telephone modem, the gateway software we are using expects its ethernet interface to use the static address 192.168.0.1 and it offers a DHCP service to the other PCs on the LAN. In that case, set the ethernet card in the gateway to use that static address and set the ethernet cards in the other PCs to use dynamic addresses.

If your gateway does not support DHCP, configure the other PCs to use static addresses as specified in the gateway's manual. It will probably use 192.168.0.1 for itself and work with the address range 192.168.0.x (subnet mask 255.255.255.0). If so set the other PCs to use addresses 192.168.0.2, 192.168.0.3 and so on.

A more complicated case is a gateway which connects to an ethernet cable modem This will have two ethernet interface cards, one to connect to the modem and one to connect to the LAN. The Internet Service Provider specifies how to set up the interface that connects to the cable mode and the gateway software specifies how to set up the interface to the LAN. The cable modem side might use a dynamic address while the LAN side might use a static.

Static Addresses

Set your PC to use a static address as follows:

  1. Select start/settings/control panel/networking and select the configuration tab. You will see a list of entries including one that says "TCP/IP -> Dial-Up Adaptor" and another "TCP/IP -> {the name of your ethernet card}". Select the second and click on properties. Tick "Specify an IP address" and put your chosen IP address in the box. Set the subnet mask to 255.255.255.0. Press the "OK" button.
  2. Reboot.
  3. Select start/settings/control panel/networking, select the entry for your ethernet card and press the properties button. In the "WINS Configuration" tab, you should now find that "disable WINS Resolution" is ticked. If not, tick it. "use DHCP for WINS resolution" should be greyed-out.
  4. In the DNS Configuration tab, tick disable DNS.
  5. In the WINS Configuration tab, tick disable WINS resolution
  6. In the "NetBIOS" tab, tick "I want to enable NetBIOS over TCP/IP". (NetBIOS is part of the Windows operating system. It needs a protocol to do networking operations. It can use NetBEUI or TCP/IP. Here we are telling it to use TCP/IP.
  7. Click the OK button, but don't let it reboot yet.
  8. Select start/settings/control panel/networking and select the entry for the card. Press the add button. Select the service entry and press add. Select "file and printer sharing for microsoft networks" Press the OK button.
  9. Now a new entry appears in the configuration tab of the network panel with the same name file and printer sharing for microsoft networks. Select it and click on "properties". Select "browse master" on the left. The possible settings will appear on the right. Select "automatic" and press the ok button.
  10. You should now be back in the Network menu. Click the OK button. The PC will ask to reboot. Do so.
  11. When the PC boots, it will display a window called "Enter Network Password". This may be new to you. If you have not set up any user names and passwords, just press the OK button to continue (or just hit enter on the keyboard).
  12. Open my computer/control panel/network. Now it has some extra tabs. Choose the "identification" tab. Set a name for the computer. (Choose a different name for each computer.) Specify a workgroup. Put all the computers in the same workgroup for now. The default workgroup "WORKGROUP" will do.
  13. Press "OK".

Once you have set up the network card, you will see the extra screen inviting you to log in when the PC boots up. This is so that you can make your PCs secure by setting up user names and passwords. However, anybody bypass this on Windows 98 by hitting the ESC key when the login menu appears. They get logged in anonymously. If you want to impose proper security within your LAN, don't use Windows 98

To share disks and printers across the network, you need to turn on the "file and printer sharing" service as shown above. At least one of the PCs needs to act as a browse master. (This is nothing to do with web browsers.) Once you have a PC acting as the browse master, you can use the network neighbourhood icon on any PC on the network. It lists the PCs which are offering access to disks and printers. We have set up all the PCs as browse masters. In that case, the ones which are running will choose amongst themselves which will do the job. If they choose a slow one, then network browsing will be slow for everybody. You can force one computer to be the browse master. In that case, the rest can only share resources while that PC is running.

The possible settings for the browse master are "automatic", "disable" and "enable". I'm not sure exactly what they do. At a guess, "disable" stops the PC from being the browse master. In that case, I'm not sure what "enable" does that "automatic" doesn't. (Force it to be the master, in which case you can only set one of them like that?) Once you have your network running, you can experiment.

(The first time I set up the browse master, I saw that "browse master" was the default setting, and carried on, but it didn't work. It seems to be necessary to put the menu up and click on OK before the PC will try to act as the master.)

To test the network, share out a printer from one PC to another. First, enable sharing on the computer with the printer: Open start/settings/control panel/network , select the "configuration" tab and press the "file and print sharing" button. Tick the box that shares the printers, untick the one that shares files. Click OK. Don't reboot yet. Open my computer/printers, right click on the printer, choose properties, choose the "sharing" tab within that and tick "share as". A suggested printer name will appear. Change it if you wish. Click OK.

Reboot.

On a different PC, open the network neighbourhood icon and double click on the name of the PC that has the printer. You should see its shared resources, in this case, its printer. Open my computer/printers and click "add printer". It will guide you through what to do and then print a test page.

Now you can access the printer from any application. Start a word processor, open its file/print menu, go to the name box and select the printer you want.

You can share disks as well as printers. Theoretically your disk can then be accessed from any computer on the internet. One of the jobs of your gateway is to stop this.

By default, a PC will attempt to connect to the internet using its own telephone modem ("dial-up networking"). This may be how you connect your gateway, but the other PCs should be configured to connect via the LAN. Select start/settings/control panel/internet and select the connection tab. Tick connect to the Internet using the local area network.

If the gateway PC connects to an ethernet cable modem, make the same setting there. For other broadband connections, see the supplier's instructions.

Once you have set up the network connections on your gateway PC, load up your chosen gateway software and configure it according to the instructions. If you connect to the internet via a telephone modem, the gateway will dial out whenever it or one of the other PCs wants to use the network ("dial on demand"). If you use a cable modem or ADSL, the connection is "always on", ie whenever the equipment is on you are connected to the internet.

Once everything is set up, use ping to test that the internet connection is working:

	 ping www.microsoft.com

This will send test packets across the internet to Microsoft's web server and show the replies. If it works, then you have a working Internet connection.

If that test works on the gateway, but not on the other PCs, try sending pings from a PC to the gateway over the LAN:

	 ping 192.168.0.1

If that works, then your LAN is working, your Internet connection is working (because pings work properly on the gateway), but the gateway is not passing traffic between the two. Read the gateway's manual again and figure out what you have done wrong.

Dynamic Addresses

Follow a similar procedure to use a dynamic IP address.

In step 1, when you select your ethernet card in my computer/control panel/network, in the IP Address tab, tick obtain an IP address automatically.

In step 4 in the Advanced tab tick Use DHCP for address resolution.

When you next reboot, the PC will obtain an IP address from the DHCP server (at the ISP if you are doing this on the gateway, the gateway itself if you are setting up one of the other PCs.) That address is granted on a lease of a few hours. At the end of the lease, the PC automatically requests a new lease. Usually it gets the same address, but it's not guaranteed.

Go to start/run and type winipcfg in the command box. This starts up a new window. It has entries for both the dial-up connection and the ethernet connection. (Even if you don't have a modem fitted to this PC, you may still have a Dial-up Networking entry, which is entirely useless.) Select the ethernet connection. This will show the PC's IP address, the subnet mask and the lease time. If you press the release and the renew button, the PC will give up its lease and request a new one.

If your gateway PC connects to the internet via a broadband device, you can use winipcfg in the same way.

Test your connection using ping as explained above.

Configuring Linux to Use the Interface card

You can use Linux to build a gateway, but as I explain in the section Choosing a gateway, it's much easier to use one of the ready built packages. They come with full instructions, so I don't need to say any more here. This section describes how to connect a general-purpose Linux system to a gateway.

If you have already installed Linux, pre-configure the cards as explained earlier (IRQ, address range etc) and then follow the instructions below.

If you fit the cards and then install Linux, the installer should attempt to detect and autoconfigure any network cards. It may well fail. If so, continue the installation and configure the cards manually once the system is running.

If the PC you are going to install Linux on currently has Windows on it, then install and test the network cards under Windows before you overwrite it with Linux. That way, you will have got the initial configuration sorted out you will know that the cards are working. If they don't then work under Linux, you will know that you have got the next bit wrong.

To configure the cards in a running Linux system you need to understand some Linux concepts and use a few Linux commands. The user guide and the computer-based training software in our starter pack should explain enough.

You configure everything in Linux by setting up files. These are just plain text file which you can create using an editor like vi. Only the root user can create the files you need.

If your Linux PC is going to be workstation, you can give it a dynamic address. If it's going to be a server, it needs a static address. A server is a computer that runs services for others, for example a web server for a small business. It needs a static address so that its clients can find it over the network.

If you want to set up a Linux web server on your home network for testing web pages and you want to connect to it from a Windows PC, it needs a static address.

Even if your gateway offers a DHCP service, the other PCs can use static addresses as long as there are no clashes. For example, my gateway uses the address range 192.168.0.x and supplies DHCP addresses starting with the lowest available: 192.168.0.2 and so on. I only have a few PCs on my network, so I assign static addresses to my servers starting at 192.168.0.128.

Using a Static IP Address Under Linux

You need to choose a domain name and assign a hostname for each computer in the network.

If you are setting up a LAN for a small business and you want to run servers that can be seen from outside the company (a web server or whatever), you have to buy an unused domain name - mycompany.com, mycompany.co.uk or whatever. You can then assign a hostname to each of your public servers: www.mycompany.com, mail.mycompany.com and so on. These names all have to registered on public name servers. You Internet Service Provider will take care of that.

If you are building network at home, you can use any domain name you like, because your gateway isolates your network. Computers outside know nothing about it, and don't need to. Avoid using a "real" domain name. If you use ibm.com, then you won't be able to connect to the real thing. There is no official .sys domain, so you can use that to form your doamin name. In my network at home, I use the domain local.sys. my test web server is www.local.sys and so on.

In this example, the local network uses addresses in the range 192.168.0.0 to 192.168.0.255 with subnet mask 255.255.255.0. The device with address 192.168.0.1 acts both as the gateway and the name server. Our PC is going to use the address 192.168.0.128.

To configure the ethernet card you need to create three files:

    /etc/modules.conf
    /etc/sysconfig/network-scripts/ifcfg-eth0
    /etc/sysconfig/network

/etc/modules.conf specifies a few details about your network cards. Most of the cheap adaptor cards are NE2000 clones, in which case the file should look something like this:

    alias  eth0  ne
    options  ne  io=0x240

The entries are in lower case. Case matters in these files, as it does in most Linux control files.

The name of the device driver for the card is "ne". The "io=" part specifies the I/O address for the adaptor card. You chose that earlier. With an NE2000 card you have to specify the I/O address, but not the IRQ. With a 3COM Etherlink, you don't have to specify either, in fact you must not, because if you do, it won't work. The ethernet Howto document explains the settings for each card.

If the Howto doesn’t say how to configure your card, check the online version on www.linuxdoc.org, which may be more up-to-date. (Beware: if your card is only mentioned in the online version of the Howto, you may need the current version of Linux.)

If you had two ethernet cards, the file would look something like this:

    alias  eth0  ne
    alias  eth1  ne
    options  ne  io=0x240,0x280

Your ethernet card is called eth0. If you more than one, the others are eth1 and so on.

You need a configuration file for each interface card. The file ifcfg-eth0 should look like this:

    DEVICE=eth0
    IPADDR=192.168.0.128
    NETMASK=255.255.255.0
    ONBOOT=yes
    BOOTPROTO=none

The file /etc/sysconfig/network should look like this:

    NETWORKING="yes"
    FORWARD_IPV4="no"
    GATEWAYDEV="eth0"
    GATEWAY=192.168.0.1
    DOMAINNAME=local.sys
    HOSTNAME=pc1.local.sys

That tells the linux system what to do when it wants to send a packet of data to a computer outside your LAN - it sends it to the gateway, which sends it on. The last two lines specify the host name and domain name for your Linux PC.

If you don't add those last two directives, the names are localhost.localdomain and localdomain by default.

Your gateway acts as a local name server. If your PC needs to access www.microsoft.com, it needs to know the equivalent IP address, the name server does that, usually by asking other name servers around the internet.

Create a file /etc/resolv.conf something like this:

    nameserver 192.168.0.1

The file contains the IP addresses of your name server and it tells the name resolution software on the PC to go there to get names translated.

You need to create a file called /etc/hosts on each Linux PC on the network. This gets the PC started knowing a few names and equivalent IP addresses. The hosts file on pc1 just has to contain:

    127.0.0.1  	  localhost    localhost.local.sys
    192.168.0.1	  ns0          ns0.local.sys
    192.168.0.128 pc1          pc1.local.sys

This gives a name to the PC and one to the gateway. (names servers are traditionally called ns0, ns1 etc).

The address 127.0.0.1 is the special loopback address. It relates to the loopback interface lo. Traffic sent to that interface is just fed back out again and received by this computer without bothering the network. The name localhost is therefore an alias for "this computer". Various bits of networking software are written to use that name.

If you give the gateway a name in the hosts file, you can use it in /etc/resolv.conf:

    nameserver ns0.local.sys

Doing it the first way is belt and braces - if something is wrong with the host file, you know the IP address of your name server, so you can still reach it.

Once you have got the control files ready, start the networking software:

    /etc/rc.d/init.d/network  start

You should get a stream of information on the console. Watch for something that says that the interfaces lo (the loopback interface) and eth0 (the ethernet card) are working OK. If you get any errors, look carefully at the files you created. Fix as necessary and restart the networking software:

    /etc/rc.d/init.d/network  restart

Keep doing this until you have fixed all the errors.

Once it's working, the hostname command and dnsdomainname commands should display the values you chose. If you have two computers pc1 and pc2, you should be able to ping one from the other:

    ping pc2

If this fails, but you can ping using an IP address:

    ping 192.168.0.2
then your networking software is working and the problem is translating names. Look hard at your hosts and resolv.conf files.

As you add more Linux computers to your network, put a complete list into the /etc/hosts file on each one, for example:

    127.0.0.1		  localhost    localhost.local.sys
    192.168.0.1		  ns0          ns0.local.sys
    192.168.0.128	  pc1          pc1.local.sys
    192.168.0.129	  pc2          pc2.local.sys

Each line specifies an IP address and a list of names, separated by tabs, usually at least the short name and the full name (with the domain) of the machine. You can give a machine several names, just continue the list:

	192.168.0.128  pc1  printserver   pc1.local.sys  printserver.local.sys

You need a copy of this file on every Linux PC in your network. Everytime you make a change, you have to copy your new hosts file onto all the other PCs, which is a nuisance.

If you can't get your gateway to act as a name server, then you need to find out the address of your ISP's name server and put that into /etc/resolv.conf. That will translate real names for you. Your /etc/hosts files show how to translate your local made-up names.

You can set up one of your Linux PCs to act as a name server for the others and translate the made-up names. Then you don't need to keep updating lots of separate /etc/hosts files.

Dynamic IP addresses Under Linux

This is as in the previous section, except that the control files are a little different.

/etc/sysconfig/network/scripts/ifcfg-eth0 should look like this:

    DEVICE=eth0
    ONBOOT=yes
    BOOTPROTO=dhcp

This causes the system search for a DHCP server on the network and to get its IP address, netmask, hostname, domain name and gateway information from that. For the system to work this way, you must have access to a DHCP server, eg the gateway software on your Windows PC.

Your file /etc/sysconfig/network should look like this:

    NETWORKING="yes"
    FORWARD_IPV4="no"
    GATEWAYDEV="eth0"
That is, as before but with some lines removed. The removed settings are unnecessary (and probably dangerous), because the DHCP server is expected to supply them.

The file modules.conf is the same as in the previous section.

Once you have got those three control files ready, start the networking software:

    /etc/rc.d/init.d/network  start

Once the networking software is working, you should find that the file /etc/resolv.conf has been set up for you. It should look something like this:

    domain
    nameserver 192.168.0.1

Test that you can reach external sites using ping:

	 ping www.linux.org

If that works, then your network should be fully functional.