Early versions of Linux used a so-called monolithic kernel. At that time, Linux distributions typically included several kernels, offering support for a variety of devices that might be needed to boot and install a Linux system. Devices not needed to boot and install a system—so-called special devices—had second-class status. To access special devices, users had to compile customized kernels that included support for those devices. When adding a device to a system, users often had to compile a new kernel, which was something of an inconvenience.
More recent versions of Linux feature a modular kernel, which allows drivers to be dynamically loaded on command. This makes it much easier than before to configure your Linux system to support Ethernet cards and other special devices. Red Hat Linux is generally able to configure your primary Ethernet card automatically, by probing for it during installation of Linux.
However, the autoprobe doesn’t always succeed. Moreover, if you have more than one Ethernet card, the installation program sets up only the first card it finds. To set up additional cards, you need to know a bit about Linux’s loadable modules.
To dynamically load a modular driver, issue the following command:
modprobe
driver
where driver
specifies the module to be
loaded. As an example, the command:
modprobe ne2k-pci
loads the modular driver for the PCI-based NE2000 Ethernet card.
To find out what network adapters are supported by Red Hat Linux or to find out what driver to use with a particular adapter, see the Red Hat Linux Hardware Compatibility List, http://hardware.redhat.com.
When a driver is loaded, it generally probes to locate the supported device. In case an autoprobe fails, most drivers let you specify the I/O port and IRQ by using a command like the following:
modprobe ne2k=pci io=0x280 irq=11
Some cards support additional options; these are documented in the
file
/usr/src/linux/Documentation/networking/net-modules.txt
.
The Linux kernel automatically
loads modules specified in the module configuration file,
/etc/.modules.conf
. So, once you’ve
determined the proper module and options required by your Ethernet
card, you can add a line or two to the module configuration file so
that your card will be made ready to operate each time you boot your
system.
The alias directive associates a logical module
name with an actual module. Logical module names specify types of
devices; for example, eth0
specifies the first
Ethernet card in a system, and eth1
specifies the
second Ethernet card in a system. Suppose your system includes two
Ethernet cards: a non-PCI-based NE2000 and an SMC EtherPower, which
is based on DEC’s TULIP chip. You could use the following
directives to automatically load these modules at boot time:
alias eth0 ne
alias eth1 tulip
If a driver requires options, you can specify them by using an options directive, which has the following form:
options
driver argument=value
[,value
,...]argument=value
[,value
,...] ...
For example, you might specify the I/O port and IRQ used by the NE2000 card like this:
options ne io=0x280 irq=12
Most ISA modules accept parameters like io=0x340
and irq=12
on the insmod
command line. You should supply these parameters to avoid
probing for the card. Unlike PCI and EISA devices, ISA devices
sometimes cannot be safely autoprobed.
The lsmod command, which takes no arguments, lists
the loaded modular drivers. To unload a modular driver, specify the
driver as the argument of the modprobe command and specify the -r argument. For example, to remove the
ne
driver, issue the command:
modprobe -r ne
To unload every unused module—that is, every module not associated with an operational device—invoke the rmmod command and specify the -a argument:
rmmod -a
You can’t remove a module that’s in use; therefore, you
must shut down the device before removing it. To shut down an
Ethernet device, you can use neat
. Or you can
issue the following command:
ifconfig eth
n
down
where eth
n
specifies
the logical device (for example, eth0
or
eth1
).