Serial Line Networking in LINUX


LINUX as UNIX-like operating system offers similar (in fact the same) networking concepts and protocols as general UNIX - that means networking in LINUX is based on TCP/IP model. TCP/IP doesn't rely on any particular hardware communication technology, which makes it possible to use TCP/IP over different LAN technologies (e.g. Ethernet, Arcnet, TokenRing, FDDI...), public data networks and even serial and parallel lines. This property of TCP/IP is extremaly important especially for interconnecting incompatible LANs to wide metropolitan or international networks (e.g. INTERNET) and the possibility of using serial lines then allows "far" computers to be connected to these WANs quite easilly (and cheaply :-) via modem or fixed serial lines.

Network Interface Configuration:

Since there are two at the first look copletely independant things - TCP/IP stuff itself and some underlaying communication technology - there is a joining point between them - Network Interface - which has to be configured for every communication port (ethernet card,FDDI card, modem port ...) before we can start using TCP/IP over that port.

The term Network Interface is used for marking both the interface itself and the whole low-level stuff including HW-specific things.

The whole low-level communication stuff in LINUX consists basicly of two things:
Device driver
Driver of your network card or serial port or something else.
Examples: /dev/ttyS0, /dev//pwd0 ...

Kernel-resident Network Interface (NI)
Kernel object used by TCP/IP as the Network Interface.
Examples:
Device driver configuration depends on type of device you use and it is beyond the scope of this document. It's possible to find the neccessary informations in Ethernet-howto or Serial-howto eventually.

Network Interface configuration includes two major steps:

Linking NI to a device means joining "logical" kernel interface with some "physical" device driver, while configuring parameters touches only the NI itself and the thing is we have to assign IP address and other parameters to it.

Linking can be performed either explicitly by iflink command, or implicitly during NI configuration by ifconfig command.

iflink /dev/wd0 eth0

tries to make device wd0 the physical device for the first ethernet NI eth0.

ifconfig sl0 194.50.17.133 pointopoint 193.17.2.1 netmask 255.255.255.0

assignes the first SLIP/CSLIP NI the IP address 194.50.17.133, netmask 255.255.255.0 and configures the interface as point-to-point with peer address 193.18.2.1. If the interface is not linked yet, ifconfig first tries to link it with some device driver.
This ifconfig syntax is O.K. for serial lines, but to set up for example ethernet NI it's neccessary to use also other options of ifconfig than those presented in the example. Details can be found in man page.

Managing kernel routing tables:

The kernel routing table contains informations important for the kernel's decision where (to what Network Interface) and how (directly or via a gateway) to send IP pakets outgoing from local machine. route is the main command for managing the table.

route add [options] a.b.c.d dev

Adds an entry for a.b.c.d destination to the routing table saying, that pakets to a.b.c.d are to be sent through
Network Interface dev.

The most important options are:

-host, -net
use a.b.c.d as host (network) address
-netmask
required for -net option
gw w.x.y.z
indirect routing via a gateway w.x.y.z
route del a.b.c.d

Removes an entry for a.b.c.d from the table.


Table of Contents