10.1. General networking

10.1.1. Networking protocols

Linux supports many different networking protocols. We list only the most important: TCP/IP

The Internet was originally developed three decades ago for the United States Department of Defense (DoD), mainly for the purpose of interconnecting different-brand computers. The TCP/IP suite of protocols allowed, through its layered structure, to insulate applications from networking hardware.

Although it is based on a layered model, it is focused more on delivering interconnectivity than on rigidly adhering to functional layers. This is one of the reasons why TCP/IP has become the de facto standard internetworking protocol as opposed to OSI.

TCP/IP networking has been present in Linux since its beginnings. It has been implemented from scratch. It is one of the most robust, fast and reliable implementations and is one of the key factors of the success of Linux. In fact, a Linux system expects to be networked. TCP/IPv6

IPv6, sometimes also referred to as IPng (IP Next Generation) is an upgrade to the IPv4 protocol in order to address many issues. These issues include a shortage of available IP addresses, lack of mechanisms to handle time-sensitive traffic, lack of network layer security, and so forth.

The larger name space is accompanied by an improved addressing scheme, which has great impact on routing performance. PPP, SLIP, PLIP, PPPOE

The Linux kernel has built-in support for PPP (Point-to-Point-Protocol), SLIP (Serial Line IP) and PLIP (Parallel Line IP). PPP is the most popular way individual users access their ISP (Internet Service Provider), although (in Belgium) it is currently being replaced by PPPOE, PPP over Ethernet, the protocol used in cable modem connections. ISDN

The Linux kernel has built-in ISDN capabilities. Isdn4linux controls ISDN PC cards and can emulate a modem with the Hayes command set ("AT" commands). The possibilities range from simply using a terminal program to full connection to the Internet.

Check your system documentation. AppleTalk

Appletalk is the name of Apple's internetworking stack. It allows a peer-to-peer network model which provides basic functionality such as file and printer sharing. Each machine can simultaneously act as a client and a server, and the software and hardware necessary are included with every Apple computer.

Linux provides full Appletalk networking. Netatalk is a kernel-level implementation of the AppleTalk Protocol Suite, originally for BSD-derived systems. It includes support for routing AppleTalk, serving UNIX and AFS file systems using AppleShare and serving UNIX printers and accessing AppleTalk printers. IPX/SPX

IPX/SPX (Internet Packet Exchange/Sequenced Packet Exchange) is a proprietary protocol stack developed by Novell and based on the Xerox Network Systems (XNS) protocol. IPX/SPX became prominent during the early 1980s as an integral part of Novell, Inc.'s NetWare. NetWare became the standard network operating system (NOS) of first generation LANs. Novell complemented its NOS with a business-oriented application suite and client-side connection utilities.

Linux has a very clean IPX/SPX implementation, allowing it to be configured as an IPX router/bridge, NCP client and/or server and Novel Print client or server. It enables PPP/IPX and IPX tunneling through IP. SMB/NMB

For compatibility with MS Windows environments, the Samba suite, including support for the NMB and SMB protocols, can be installed on any UNIX-like system. The Server Message Block protocol (also called Session Message Block, NetBIOS or LanManager protocol) is used on MS Windows 3.11, NT, 95/98, 2K and XP to share disks and printers.

The basic functions of the Samba suite are: sharing Linux drives with Windows machines, accessing SMB shares from Linux machines, sharing Linux printers with Windows machines and sharing Windows printers with Linux machines.

Most Linux distributions provide a samba package, which does most of the server setup and starts up smbd, the Samba server, and nmbd, the netbios name server, at boot time by default. Example sections for use in various situations are provided.

More information can be found in the smb.conf man page or in the Samba section of the RedHat Support Resources on Printing and File Services. The Samba Project Documentation contains an easy to read installation and testing guide, which also explains how to configure your Samba server as a Primary Domain Controller. The Samba website contains more documentation, including a troubleshooting guide. Miscellaneous protocols

Linux also has support for Amateur Radio, WAN internetworking (X25, Frame Relay, ATM), but since these protocols usually require special hardware, we won't discuss them in this document.

10.1.2. General networking tools Configuration of local network interfaces

To obtain the graphical configuration tools for networking devices, routes, hosts and so on, refer to the distribution-specific documentation. The graphical tool RedHat 7.2 currently offers is called neat, which allows easy configuration of network interfaces, routes, gateways and DNS without requiring much knowledge about the actual configuration files, among others in /etc/sysconfig/network-scripts.

Configuration on the command line used to be done using the ifconfig command, but this is being deprecated and replaced with ip, which can handle different protocols easier and allows for flexible configuration. The most up to date documentation can be found in /usr/share/doc/iproute-<version>; the command has extended help features for short hints as well. Setting the IP address on a network interface, for instance, can be done like this:

[root@blob network-scripts] ip addr add dev eth0

On most Linux distributions, direct manipulation of the network configuration is not recommended. The suggested way to change the network configuration is to change the configuration files for the shell scripts used on the Linux distribution to manage the networking.

For example, on RedHat 7.2 systems, the network configuration scripts are configured with interface-specific configuration files /etc/sysconfig/network-scripts/ifcfg-<interfacename>:

[root@blob network-scripts] cat ifcfg-eth0

General activation of the network facilities is configured in /etc/sysconfig/network:

jenny@blob /etc/sysconfig> cat network

The distribution-specific scripts use ip (or ifconfig and route on older systems) to configure the kernel's networking configuration.

The ip command can also be used to display network information. Below are some examples, displaying IP address configuration, routes and neighbouring proxies:

benny@home benny> ip addr show
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet brd scope host lo
    inet6 ::1/128 scope host 
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
    link/ether 00:50:bf:7e:54:9a brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet6 fe80::250:bfff:fe7e:549a/10 scope link 

benny@home benny> ip route show dev eth0  scope link dev lo  scope link 
default via dev eth0 

benny@home benny> ip neigh dev eth0 lladdr 00:50:bf:7e:54:99 nud reachable

For displaying the network configuration, there's the common netstat command which has a lot of options and is generally useful on any UNIX system. Use the -i option to display information about network interfaces:

bob:~>netstat -i
Kernel Interface table
eth0 1500   0 58459   0      0      0  63865     0      0      0 BMRU
lo  16436   0 24060   0      0      0  24060     0      0      0 LRU

Routing information is displayed with the -nr option:

bob:~>netstat -nr
Kernel IP routing table
Destination  Gateway      Genmask       Flags MSS Window irtt Iface U      40 0         0 eth0     U      40 0         0 lo       UG     40 0         0 eth0

This is a typical client machine in an IP network. It only has one network device, eth0. The lo interface is the local loop.

Information about name resolvers and when to contact which is stored in the /etc/nsswitch.conf file, the system databases and name service switch configuration file. It usually looks something like this:

# /etc/nsswitch.conf

passwd:     files ldap
shadow:     files ldap
group:      files ldap
hosts:      files dns
bootparams: nisplus [NOTFOUND=return] files
ethers:     files
netmasks:   files
networks:   files
protocols:  files ldap
rpc:        files
services:   files ldap
netgroup:   files ldap
publickey:  nisplus
automount:  files ldap
aliases:    files 

This file tells the system to resolve host names first looking in the local databases (such as /etc/hosts), and when these don't recognize the host name, to look it up using the DNS service (hosts entry). Other hosts

An impressive amount of tools is focused on network management and remote administration of Linux machines. Your local Linux software mirror will offer plenty of those. It would lead us too far to discuss them in this document, so please refer to the program-specific documentation.

We will only discuss common UNIX/Linux text tools in this section.

To display information on hosts or domains, use the host command:

[emmy@pc10 emmy]$ host www.eunet.be
www.eunet.be. has address

[emmy@pc10 emmy]$ host -t any eunet.be
eunet.be. SOA dns.eunet.be. hostmaster.Belgium.EU.net. 
  2002021300 28800 7200 604800 86400
eunet.be. mail is handled by 50 pophost.eunet.be.
eunet.be. name server ns.EU.net.
eunet.be. name server dns.eunet.be.

Similar information can be displayed using the dig command. To check if a host is alive, use ping. If your system is configured to send more than one packet, interrupt ping with the Ctrl+C key combination:

[emmy@pc10 emmy]$ ping a.host.be 
PING a.host.be ( from 56(84) bytes of data.
64 bytes from a.host.be( ttl=244 time=99.977msec
--- a.host.be ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/mdev = 99.977/99.977/99.977/0.000 ms

To check the route that packets follow to a network host, use the traceroute command:

[emmy@pc10 emmy]$ /usr/sbin/traceroute www.eunet.be
traceroute to www.eunet.be(,30 hops max,38b packets
1 blob (  
       0.297ms  0.257ms  0.174ms
2 adsl-65.myprovider.be ( 
       12.120ms 13.058ms 13.009ms
3 (  
       13.845ms 14.308ms 12.756ms
4 gigabitethernet2-2.intl2.gam.brussels.skynet.be (
       13.123ms 13.164ms 12.527ms
5 pecbru2.car.belbone.be ( 
       16.336ms 13.889ms 13.028ms
6 ser-2-1-110-ias-be-vil-ar01.kpnbelgium.be (
       14.602ms 15.546ms 15.959ms
7 unknown-195-207-939.eunet.be ( 
       16.514ms 17.661ms 18.889ms
8 S0-1-0.Leuven.Belgium.EU.net ( 
       22.714ms 19.193ms 18.432ms
9 dukat.Belgium.EU.net ( 22.758ms * 25.263ms

The mtr program gives streaming information about reachability of remote hosts, but you need to be root to run it.

Specific domain name information can be queried using the whois command, as is explained by many whois servers, like the one below:

[emmy@pc10 emmy]$ whois cnn.com

Whois Server Version 1.3

	$<--snap server message-->

   Domain Name: CNN.COM
   Whois Server: whois.networksolutions.com
   Referral URL: http://www.networksolutions.com
   Name Server: TWDNS-01.NS.AOL.COM
   Name Server: TWDNS-02.NS.AOL.COM
   Name Server: TWDNS-03.NS.AOL.COM
   Name Server: TWDNS-04.NS.AOL.COM
   Updated Date: 12-mar-2002
>>> Last update of whois database: Fri, 5 Apr 2002 05:04:55 EST <<<

The Registry database contains ONLY .COM, .NET, .ORG, .EDU domains
and Registrars.


        $<--snap server message-->

Turner Broadcasting (CNN-DOM)
   1 CNN Center
   Atlanta, GA 30303

   Domain Name: CNN.COM

   Administrative Contact:
        $<--snap contactinfo-->   
   Technical Contact:
        $<--snap contactinfo-->   
   Billing Contact:
	$<--snap contactinfo-->
   Record last updated on 12-Mar-2002.
   Record expires on 23-Sep-2009.
   Record created on 22-Sep-1993.
   Database last updated on 4-Apr-2002 20:10:00 EST.

   Domain servers in listed order:


For Belgian domain names, specify the whois server:

whois domain.be@whois.dns.be