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 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.
- 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.
- lo loopback network interface
- eth0 ethernet network interface
- sl2 SLIP/CSLIP network interface
- ppp0 PPP network interface
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.
- Linking the NI to some device driver.
- Configuring the NI parameters.
iflink /dev/wd0 eth0
tries to make device
wd0 the physical device for the first ethernet NI
ifconfig sl0 188.8.131.52 pointopoint 184.108.40.206 netmask 255.255.255.0
assignes the first SLIP/CSLIP NI the IP address 220.127.116.11, netmask 255.255.255.0 and configures the interface as point-to-point with peer address 18.104.22.168. 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
The most important options are:
- -host, -net
a.b.c.d as host (network) address
-netmask required for
gw w.x.y.z indirect routing via a gateway
route del a.b.c.d
Removes an entry for
a.b.c.d from the table.
Table of Contents