As described in Chapter 2 , the kernel accesses a piece of network hardware through a software construct called an interface . Interfaces offer an abstract set of functions that are the same across all types of hardware, such as sending or receiving a datagram.
Interfaces are identified by means of names. In many other Unix-like operating systems, the network interface is implemented as a special device file in the /dev/ directory. If you type the ls -las /dev/ command, you will see what these device files look like. In the file permissions (second) column you will see that device files begin with a letter rather than the hyphen seen for normal files. This character indicates the device type. The most common device types are b , which indicates the device is a block device and handles whole blocks of data with each read and write, and c , which indicates the device is a character device and handles data one character at a time. Where you would normally see the file length in the ls output, you instead see two numbers, called the major and minor device numbers. These numbers indicate the actual device with which the device file is associated.
Each device driver registers a unique major number with the kernel. Each instance of that device registers a unique minor number for that major device. The tty interfaces, /dev/tty* , are a character mode device indicated by the "c ", and each have a major number of 4 , but /dev/tty1 has a minor number of 1 , and /dev/tty2 has a minor number of 2 . Device files are very useful for many types of devices, but can be clumsy to use when trying to find an unused device to open.
Linux interface names are defined internally in the kernel and are not device files in the /dev directory. Some typical device names are listed later in Section 3.2 ." The assignment of interfaces to devices usually depends on the order in which devices are configured. For instance, the first Ethernet card installed will become eth0 , and the next will be eth1 . SLIP interfaces are handled differently from others because they are assigned dynamically. Whenever a SLIP connection is established, an interface is assigned to the serial port.
Figure 3-1 illustrates the relationship between the hardware, device drivers, and interfaces.
Figure 3-1. The relationship between drivers, interfaces, and hardware
When booting, the kernel displays the devices it detects and the interfaces it installs. The following is an excerpt from typical boot messages:
.
. This processor honors the WP bit even when in supervisor mode./
Good.
Swansea University Computer Society NET3.035 for Linux 2.0
NET3: Unix domain sockets 0.13 for Linux NET3.035.
Swansea University Computer Society TCP/IP for NET3.034
IP Protocols: IGMP,ICMP, UDP, TCP
Swansea University Computer Society IPX 0.34 for NET3.035
IPX Portions Copyright (c) 1995 Caldera, Inc.
Serial driver version 4.13 with no serial options enabled
tty00 at 0x03f8 (irq = 4) is a 16550A
tty01 at 0x02f8 (irq = 3) is a 16550A
CSLIP: code copyright 1989 Regents of the University of California
PPP: Version 2.2.0 (dynamic channel allocation)
PPP Dynamic channel allocation code copyright 1995 Caldera, Inc.
PPP line discipline registered.
eth0: 3c509 at 0x300 tag 1, 10baseT port, address 00 a0 24 0e e4 e0,/
IRQ 10.
3c509.c:1.12 6/4/97 becker@cesdis.gsfc.nasa.gov
Linux Version 2.0.32 (root@perf) (gcc Version 2.7.2.1)
#1 Tue Oct 21 15:30:44 EST 1997
.
.
This example shows that the kernel has been compiled with TCP/IP enabled, and it includes drivers for SLIP, CSLIP, and PPP. The third line from the bottom says that a 3C509 Ethernet card was detected and installed as interface eth0 . If you have some other type of network card—perhaps a

