Linux IP Networking

A Guide to the Implementation and Modification of the Linux Protocol Stack
Glenn Herrin
TR 00-04
Department oI Computer Science
University oI New Hampshire
Ma 31, 2000
Abstract
This document is a guide to understanding how the Linux kernel (version 2.2.14 speciIically) implements
networking protocols, Iocused primarily on the Internet Protocol (IP). It is intended as a complete
reIerence Ior experimenters with overviews, walk-throughs, source code explanations, and examples. The
Iirst part contains an in-depth examination oI the code, data structures, and Iunctionality involved with
networking. There are chapters on initialization, connections and sockets, and receiving, transmitting, and
Iorwarding packets. The second part contains detailed instructions Ior modiIiying the kernel source code
and installing new modules. There are chapters on kernel installation, modules, the proc Iile system, and a
complete example.
Contents
1 Introduction
1.1 Background
1.2 Document Conventions
1.3 Sample Network Example
1.4 Copyright, License, and Disclaimer
1.5 Acknowledgements
2 Message TraIIic Overview
2.1 The Network TraIIic Path
2.2 The Protocol Stack
2.3 Packet Structure
2.4 Internet Routing
3 Network Initialization
3.1 Overview
3.2 Startup
3.2.1 The Network Initialization Script
3.2.2 ifconfig
3.2.3 route
3.2.4 Dynamic Routing Programs
3.3 Examples
3.3.1 Home Computer
3.3.2 Host Computer on a LAN
3.3.3 Network Routing Computer
3.4 Linux and Network Program Functions
3.4.1 ifconfig
3.4.2 route
4 Connections
4.1 Overview
4.2 Socket Structures
4.3 Sockets and Routing
4.4 Connection Processes
4.4.1 Establishing Connections
4.4.2 Socket Call Walk-Through
4.4.3 Connect Call Walk-Through
4.4.4 Closing Connections
4.4.5 Close Walk-Through
4.5 Linux Functions
5 Sending Messages
5.1 Overview
5.2 Sending Walk-Through
5.2.1 Writing to a Socket
5.2.2 Creating a Packet with UDP
5.2.3 Creating a Packet with TCP
5.2.4 Wrapping a Packet in IP
5.2.5 Transmitting a Packet
5.3 Linux Functions
6 Receiving Messages
6.1 Overview
6.2 Receiving Walk-Through
6.2.1 Reading Irom a Socket (Part I)
6.2.2 Receiving a Packet
6.2.3 Running the Network ``Bottom HalI''
6.2.4 Unwrapping a Packet in IP
6.2.5 Accepting a Packet in UDP
6.2.6 Accepting a Packet in TCP
6.2.7 Reading Irom a Socket (Part II)
6.3 Linux Functions
7 IP Forwarding
7.1 Overview
7.2 IP Forward Walk-Through
7.2.1 Receiving a Packet
7.2.2 Running the Network ``Bottom HalI''
7.2.3 Examining a Packet in IP
7.2.4 Forwarding a Packet in IP
7.2.5 Transmitting a Packet
7.3 Linux Functions
8 Basic Internet Protocol Routing
8.1 Overview
8.2 Routing Tables
8.2.1 The Neighbor Table
8.2.2 The Forwarding InIormation Base
8.2.3 The Routing Cache
8.2.4 Updating Routing InIormation
8.3 Linux Functions
9 Dynamic Routing with routed
9.1 Overview
9.2 How routed Works
9.2.1 Data Structures
9.2.2 Initialization
9.2.3 Normal Operations
9.3 routed Functions
10 Editing Linux Source Code
10.1 The Linux Source Tree
10.2 Using EMACS Tags
10.2.1 ReIerencing with TAGS
10.2.2 Constructing TAGS Iiles
10.3 Using vi tags
10.4 Rebuilding the Kernel
10.5 Patching the Kernel Source
11 Linux Modules
11.1 Overview
11.2 Writing, Installing, and Removing Modules
11.2.1 Writing Modules
11.2.2 Installing and Removing Modules
11.3 Example
12 The proc File System
12.1 Overview
12.2 Network proc Files
12.3 Registering proc Files
12.3.1 Formatting a Function to Provide InIormation
12.3.2 Building a proc Entry
12.3.3 Registering a proc Entry
12.3.4 Unregistering a proc Entry
12.4 Example
13 Example - Packet Dropper
13.1 Overview
13.2 Considerations
13.3 Experimental Systems and Benchmarks
13.4 Results and Preliminary Analysis
13.4.1 Standard Kernel
13.4.2 ModiIied Kernel Dropping Packets
13.4.3 Preliminary Analysis
13.5 Code
13.5.1 Kernel
13.5.2 Module
14 Additional Resources
14.1 Internet Sites
14.2 Books
15 Acronyms
Chapter 1
Introduction
This is version 1.0 oI this document, dated May 31, 2000, reIerencing the Linux kernel version 2.2.14.
1.1 Background
Linux is becoming more and more popular as an alternative operating system. Since it is Ireely available
to everyone as part oI the open source movement, literally thousands oI programmers are constantly
working on the code to implement new Ieatures, improve existing ones, and Iix bugs and ineIIiciencies in
the code. There are many sources Ior learning more about Linux, Irom the source code itselI
(downloadable Irom the Internet) to books to ``HOW-TOs'' and message boards maintained on many
diIIerent subjects.
This document is an eIIort to bring together many oI these sources into one coherent reIerence on and
guide to modiIying the networking code within the Linux kernel. It presents the internal workings on Iour
levels: a general overview, more speciIic examinations oI network activities, detailed Iunction walk-
throughs, and reIerences to the actual code and data structures. It is designed to provide as much or as
little detail as the reader desires. This guide was written speciIically about the Linux 2.2.14 kernel (which
has already been superseded by 2.2.15) and many oI the examples come Irom the Red Hat 6.1
distribution; hopeIully the inIormation provided is general enough that it will still apply across
distributions and new kernels. It also Iocuses almost exclusively on TCP/UDP, IP, and Ethernet - which
are the most common but by no means the only networking protocols available Ior Linux platIorms.
As a reIerence Ior kernel programmers, this document includes inIormation and pointers on editing and
recompiling the kernel, writing and installing modules, and working with the /proc Iile system. It also
presents an example oI a program that drops packets Ior a selected host, along with analysis oI the results.
Between the descriptions and the examples, this should answer most questions about how Linux perIorms
networking operations and how you can modiIy it to suit your own purposes.
This project began in a Computer Science Department networking lab at the University oI New
Hampshire as an eIIort to institute changes in the Linux kernel to experiment with diIIerent routing
algorithms. It quickly became apparent that blindly hacking the kernel was not a good idea, so this
document was born as a research record and a reIerence Ior Iuture programmers. Finally it became large
enough (and hopeIully useIul enough) that we decided to generalize it, Iormalize it, and release it Ior
public consumption.
As a Iinal note, Linux is an ever-changing system and truly mastering it, iI such a thing is even possible,
would take Iar more time than has been spent putting this reIerence together. II you notice any
misstatements, omissions, glaring errors, or even typos (!) within this document, please contact the person
who is currently maintaining it. The goal oI this project has been to create a Ireely available and useIul
reIerence Ior Linux programmers.
1.2 Document Conventions
It is assumed that the reader understands the C programming language and is acquainted with common
network protocols. This is not vital Ior the more general inIormation but the details within this document
are intended Ior experienced programmers and may be incomprehensible to casual Linux users.
Almost all oI the code presented requires superuser access to implement. Some oI the examples can create
security holes where none previously existed; programmers should be careIul to restore their systems to a
normal state aIter experimenting with the kernel.
File reIerences and program names are written in a slanted Iont.
Code, command line entries, and machine names are written in a Iont.
Generic entries or variables (such as an output Iilename) and comments are written in an italic Iont.
1.3 Sample Network Example
There are numerous examples in this document that help clariIy the presented material. For the sake oI
consistency and Iamiliarity, most oI them reIerence the sample network shown in Figure 1.1.
Figure 1.1: Sample network structure.
This network represents the computer system at a Iictional unnamed University (U!). It has a router
connected to the Internet at large (). That machine is connected (through the interIace) to
the campus-wide network, ., consisting oI computers named Ior Chrysler owned car companies
(, , etc.). There is also a LAN subnet Ior the computer science department, .., whose
hosts are named aIter Dodge vehicle models (, , etc.). They are connected to the campus
network by the / computer. Both the . and .. networks use Ethernet hardware
and protocols.
This is obviously not a real network. The IP addresses are all taken Irom the block reserved Ior class B
private networks (that are not guaranteed to be unique). Most real class B networks would have many
more computers, and a network with only eight computers would probably not have a subnet. The
connection to the Internet (through ) would usually be via a T1 or T3 line, and that router
would probably be a ``real'' router (i.e. a Cisco Systems hardware router) rather than a computer with two
network cards. However, this example is realistic enough to serve its purpose: to illustrate the the Linux
network implementation and the interactions between hosts, subnets, and networks.
1.4 Copyright, License, and Disclaimer
Copyright (c) 2000 by Glenn Herrin. This document may be Ireely reproduced in whole or in part
provided credit is given to the author with a line similar to the Iollowing:
C  L IP N,  
http://.cs.unh.edu/cnrg/gherrin.
(The visibility oI the credit should be proportional to the amount oI the document reproduced!)
Commercial redistribution is permitted and encouraged. All modiIications oI this document, including
translations, anthologies, and partial documents, must meet the Iollowing requirements:
1. ModiIied versions must be labeled as such.
2. The person making the modiIications must be identiIied.
3. Acknowledgement oI the original author must be retained.
4. The location oI the original unmodiIied document be identiIied.
5. The original author's name may not be used to assert or imply endorsement oI the resulting
document without the original author's permission.
Please note any modiIications including deletions.
This is a variation (changes are intentional) oI the Linux Documentaion Project (LDP) License available
at:
http.//www.linuxdoc.org/COPYRIGHT.html
This document is not currently part oI the LDP, but it may be submitted in the Iuture.
This document is distributed in the hope that it will be useIul but (oI course)without any given or implied
warranty oI Iitness Ior any purpose whatsoever. Use it at your own risk.
1.5 Acknowledgements
I wrote this document as part oI my Master's project Ior the Computer Science Department oI the
University oI New Hampshire. I would like to thank ProIessor Pilar de la Torre Ior setting up the project
and ProIessor Radim Bartos Ior being both a sponsor and my advisor - giving me numerous pointers,
much encouragement, and a set oI computers on which to experiment. I would also like to credit the
United States Army, which has been my home Ior 11 years and paid Ior my attendance at UNH.
Glenn Herrin
Major, United States Army
Primary Documenter and Researcher, Version 1.0
gherrin¸cs.unh.edu
Chapter 2
Message Traffic Overview
This chapter presents an overview oI the entire Linux messaging system. It provides a discussion oI
conIigurations, introduces the data structures involved, and describes the basics oI IP routing.
2.1 The Network Traffic Path
The Internet Protocol (IP) is the heart oI the Linux messaging system. While Linux (more or less) strictly
adheres to the layering concept - and it is possible to use a diIIerent protocol (like ATM) - IP is almost
always the nexus through which packets Ilow. The IP implementation oI the network layer perIorms
routing and Iorwarding as well as encapsulating data. See Figure 2.1 Ior a simpliIied diagram oI how
network packets move through the Linux kernel.
Figure 2.1: Abstraction oI the Linux message traIIic path.
When an application generates traIIic, it sends packets through sockets to a transport layer (TCP or UDP)
and then on to the network layer (IP). In the IP layer, the kernel looks up the route to the host in either the
routing cache or its Forwarding InIormation Base (FIB). II the packet is Ior another computer, the kernel
addresses it and then sends it to a link layer output interIace (typically an Ethernet device) which
ultimately sends the packet out over the physical medium.
When a packet arrives over the medium, the input interIace receives it and checks to see iI the packet is
indeed Ior the host computer. II so, it sends the packet up to the IP layer, which looks up the route to the
packet's destination. II the packet has to be Iorwarded to another computer, the IP layer sends it back
down to an output interIace. II the packet is Ior an application, it sends it up through the transport layer
and sockets Ior the application to read when it is ready.
Along the way, each socket and protocol perIorms various checks and Iormatting Iunctions, detailed in
later chapters. The entire process is implemented with reIerences and jump tables that isolate each
protocol, most oI which are set up during initialization when the computer boots. See Chapter 3 Ior details
oI the initialization process.
2.2 The Protocol Stack
Network devices Iorm the bottom layer oI the protocol stack; they use a link layer protocol (usually
Ethernet) to communicate with other devices to send and receive traIIic. Input interIaces copy packets
Irom a medium, perIorm some error checks, and then Iorward them to the network layer. Output
interIaces receive packets Irom the network layer, perIorm some error checks, and then send them out
over the medium.
IP is the standard network layer protocol. It checks incoming packets to see iI they are Ior the host
computer or iI they need to be Iorwarded. It deIragments packets iI necessary and delivers them to the
transport protocols. It maintains a database oI routes Ior outgoing packets; it addresses and Iragments them
iI necessary beIore sending them down to the link layer.
TCP and UDP are the most common transport layer protocols. UDP simply provides a Iramework Ior
addressing packets to ports within a computer, while TCP allows more complex connection based
operations, including recovery mechanisms Ior packet loss and traIIic management implementations.
Either one copies the packet's payload between user and kernel space. However, both are just part oI the
intermediate layer between the applications and the network.
IP SpeciIic INET Sockets are the data elements and implementations oI generic sockets. They have
associated queues and code that executes socket operations such as reading, writing, and making
connections. They act as the intermediary between an application's generic socket and the transport layer
protocol.
Generic BSD Sockets are more abstract structures that contain INET sockets. Applications read Irom and
write to BSD sockets; the BSD sockets translate the operations into INET socket operations. See
Chapter 4 Ior more on sockets.
Applications, run in user space, Iorm the top level oI the protocol stack; they can be as simple as two-way
chat connection or as complex as the Routing InIormation Protocol (RIP - see Chapter 9).
2.3 Packet Structure
The key to maintaining the strict layering oI protocols without wasting time copying parameters and
payloads back and Iorth is the common packet data structure (a socket buIIer, or _ - Figure 2.2).
Throughout all oI the various Iunction calls as the data makes it way through the protocols, the payload
data is copied only twice; once Irom user to kernel space and once Irom kernel space to output medium
(Ior an outbound packet).
Figure 2.2: Packet (_) structure.
This structure contains pointers to all oI the inIormation about a packet - its socket, device, route, data
locations, etc. Transport protocols create these packet structures Irom output buIIers, while device drivers
create them Ior incoming data. Each layer then Iills in the inIormation that it needs as it processes the
packet. All oI the protocols - transport (TCP/UDP), internet (IP), and link level (Ethernet) - use the same
socket buIIer.
2.4 Internet Routing
The IP layer handles routing between computers. It keeps two data structures; a Forwarding InIormation
Base (FIB) that keeps track oI all oI the details Ior every known route, and a Iaster routing cache Ior
destinations that are currently in use. (There is also a third structure - the neighbor table - that keeps track
oI computers that are physically connected to a host.)
The FIB is the primary routing reIerence; it contains up to 32 zones (one Ior each bit in an IP address) and
entries Ior every known destination. Each zone contains entries Ior networks or hosts that can be uniquely
identiIied by a certain number oI bits - a network with a netmask oI 255.0.0.0 has 8 signiIicant bits and
would be in zone 8, while a network with a netmask oI 255.255.255.0 has 24 signiIicant bits and would
be in zone 24. When IP needs a route, it begins with the most speciIic zones and searches the entire table
until it Iinds a match (there should always be at least one deIault entry). The Iile /proc/net/route has the
contents oI the FIB.
The routing cache is a hash table that IP uses to actually route packets. It contains up to 256 chains oI
current routing entries, with each entry's position determined by a hash Iunction. When a host needs to
send a packet, IP looks Ior an entry in the routing cache. II there is none, it Iinds the appropriate route in
the FIB and inserts a new entry into the cache. (This entry is what the various protocols use to route, not
the FIB entry.) The entries remain in the cache as long as they are being used; iI there is no traIIic Ior a
destination, the entry times out and IP deletes it. The Iile /proc/net/rt¸cache has the contents oI the routing
cache.
These tables perIorm all the routing on a normal system. Even other protocols (such as RIP) use the same
structures; they just modiIy the existing tables within the kernel using the () Iunction. See
Chapter 8 Ior routing details.
Chapter 3
Network Initialization
This chapter presents network initialization on startup. It provides an overview oI what happens when the
Linux operating system boots, shows how the kernel and supporting programs ifconfig and route establish
network links, shows the diIIerences between several example conIigurations, and summarizes the
implementation code within the kernel and network programs.
3.1 Overview
Linux initializes routing tables on startup only iI a computer is conIigured Ior networking. (Almost all
Linux machines do implement networking, even stand-alone machines, iI only to use the loopback
device.) When the kernel Iinishes loading itselI, it runs a set oI common but system speciIic utility
programs and reads conIiguration Iiles, several oI which establish the computer's networking capabilities.
These determine its own address, initialize its interIaces (such as Ethernet cards), and add critical and
known static routes (such as one to a router that connects it with the rest oI the Internet). II the computer is
itselI a router, it may also execute a program that allows it to update its routing tables dynamically (but this
is NOT run on most hosts).
The entire conIiguration process can be static or dynamic. II addresses and names never (or inIrequently)
change, the system administrator must deIine options and variables in Iiles when setting up the system. In
a more mutable environment, a host will use a protocol like the Dynamic Hardware ConIiguration
Protocol (DHCP) to ask Ior an address, router, and DNS server inIormation with which to conIigure itselI
when it boots. (In Iact, in either case, the administrator will almost always use a GUI interIace - like Red
Hat's Control Panel - which automatically writes the conIiguration Iiles shown below.)
An important point to note is that while most computers running Linux start up the same way, the
programs and their locations are not by any means standardized; they may vary widely depending on
distribution, security concerns, or whim oI the system administrator. This chapter presents as generic a
description as possible but assumes a Red Hat Linux 6.1 distribution and a generally static network
environment.
3.2 Startup
When Linux boots as an operating system, it loads its image Irom the disk into memory, unpacks it, and
establishes itselI by installing the Iile systems and memory management and other key systems. As the
kernel's last (initialization) task, it executes the init program. This program reads a conIiguration Iile
(/etc/inittab) which directs it to execute a startup script (Iound in /etc/rc.d on Red Hat distributions). This
in turn executes more scripts, eventually including the network script (/etc/rc.d/init.d/network). (See
Section 3.3 Ior examples oI the script and Iile interactions.)
3.2.1 The Network Initialization Script
The network initialization script sets environment variables to identiIy the host computer and establish
whether or not the computer will use a network. Depending on the values given, the network script turns
on (or oII) IP Iorwarding and IP Iragmentation. It also establishes the deIault router Ior all network traIIic
and the device to use to send such traIIic. Finally, it brings up any network devices using the ifconfig and
route programs. (In a dynamic environment, it would query the DHCP server Ior its network inIormation
instead oI reading its own Iiles.)
The script(s) involved in establishing networking can be very straightIorward; it is entirely possible to
have one big script that simply executes a series oI commands that will set up a single machine properly.
However, most Linux distributions come with a large number oI generic scripts that work Ior a wide
variety oI machine setups. This leaves a lot oI indirection and conditional execution in the scripts, but
actually makes setting up any one machine much easier. For example, on Red Hat distributions, the
/etc/rc.d/init.d/network script runs several other scripts and sets up variables like _ to
keep track oI which /etc/svsconfig/network-scripts/ifup scripts to run. Tracing the process manually is very
complicated, but simple modiIications oI only two conIiguration Iiles (putting the proper names and IP
addresses in the /etc/svsconfig/network and /etc/svsconfig/network-scripts/ifcfg-eth0 Iiles) sets up the entire
system properly (and a GUI makes the process even simpler).
When the network script Iinishes, the FIB contains the speciIied routes to given hosts or networks and the
routing cache and neighbor tables are empty. When traIIic begins to Ilow, the kernel will update the
neighbor table and routing cache as part oI the normal network operations. (Network traIIic may begin
during initialization iI a host is dynamically conIigured or consults a network clock, Ior example.)
3.2.2 ifconfig
The ifconfig program conIigures interIace devices Ior use. (This program, while very widely used, is not
part oI the kernel.) It provides each device with its (IP) address, netmask, and broadcast address. The
device in turn will run its own initialization Iunctions (to set any static variables) and register its interrupts
and service routines with the kernel. The ifconfig commands in the network script look like this:
 $DEVICE $IPADDR  $NMASK  $BCAST
(where the variables are either written directly in the script or are deIined in other scripts).
The ifconfig program can also provide inIormation about currently conIigured network devices (calling
with no arguments displays all the active interIaces; calling with the ­ option displays all interIaces,
active or not):

This provides all the inIormation available about each working interIace; addresses, status, packet
statistics, and operating system speciIics. Usually there will be at least two interIaces - a network card and
the loopback device. The inIormation Ior each interIace looks like this (this is the interIace):
0  L :E  HW 00:C1:4E:7D:9E:25
       :172.16.1.1  B:172.16.1.255  M:255.255.255.0
      UP BROADCAST RUNNING MULTICAST  MTU:1500  M:1
      RX :389016 :16534 :0 :0 :24522
      TX :400845 :0 :0 :0 :0
      :0 :100
      I:11 B :000
A superuser can use ifconfig to change interIace settings Irom the command line; here is the syntax:
interface [aftvpe] options | address ...
... and some oI the more useIul calls:
 0  - shut down 0
 1  - activate 1
 0  - enable ARP on 0
 0 ­ - disable ARP on 0
 0  255.255.255.0 - set the 0 netmask
   2000 - set the loopback maximum transIer unit
 1 172.16.0.7 - set the 1 IP address
Note that modiIying an interIace conIiguration can indirectly change the routing tables. For example,
changing the netmask may make some routes moot (including the deIault or even the route to the host
itselI) and the kernel will delete them.
3.2.3 route
The route program simply adds predeIined routes Ior interIace devices to the Forwarding InIormation
Base (FIB). This is not part oI the kernel, either; it is a user program whose command in the script looks
like this:
  ­ $NETWORK  $NMASK  $DEVICE -or-
  ­ $IPADDR $DEVICE
(where the variables are again spelled out or deIined in other scripts).
The route program can also delete routes (iI run with the option) or provide inIormation about the
routes that are currently deIined (iI run with no options):

This displays the Kernel IP routing table (the FIB, not the routing cache). For example (the
computer):
K IP  
D   G        G         F M R U I
172.16.1.4    *              255.255.255.255 UH    0      0     0 0
172.16.1.0    *              255.255.255.0   U     0      0     0 0
127.0.0.0     *              255.0.0.0       U     0      0     0 
       ..    0.0.0.0         UG    0      0     0 0
A superuser can use route to add and delete IP routes Irom the command line; here is the basic syntax:
  [-net|-host] target [option arg]
  [-net|-host] target [option arg]
... and some useIul examples:
  ­ 127.16.1.0 1 - adds a route to a host
  ­ 172.16.1.0  255.255.255.0 0 - adds a network
     - sets the deIault route through
(Note that a route to must already be set up)
  ­ 172.16.1.16 - deletes entry Ior host 172.16.1.16
3.2.4 Dynamic Routing Programs
II the computer is a router, the network script will run a routing program like routed or gated. Since most
computers are always on the same hard-wired network with the same set oI addresses and limited routing
options, most computers do not run one oI these programs. (II an Ethernet cable is cut, traIIic simply will
not Ilow; there is no need to try to reroute or adjust routing tables.) See Chapter 9 Ior more inIormation
about routed.
3.3 Examples
The Iollowing are examples oI Iiles Ior systems set up in three diIIerent ways and explanations oI how
they work. Typically every computer will execute a network script that reads conIiguration Iiles, even iI
the Iiles tell the computer not to implement any networking.
3.3.1 Home Computer
These Iiles would be on a computer that is not permanently connected to a network, but has a modem Ior
access. (This section does not reIerence a computer Irom the general example.)
This is the Iirst Iile the network script will read; it sets several environment variables. The Iirst two
variables set the computer to run networking programs (even though it is not on a network) but not to
Iorward packets (since it has nowhere to send them). The last two variables are generic entries.
/etc/svsconfig/network
NETWORKING=
FORWARD_IPV4=
HOSTNAME=.
GATEWAY=
AIter setting these variables, the network script will decide that it needs to conIigure at least one network
device in order to be part oI a network. The next Iile (which is almost exactly the same on all Linux
computers) sets up environment variables Ior the loopback device. It names it and gives it its (standard) IP
address, network mask, and broadcast address as well as any other device speciIic variables. (The
ONBOOT variable is a Ilag Ior the script program that tells it to conIigure this device when it boots.)
Most computers, even those that will never connect to the Internet, install the loopback device Ior inter-
process communication.
/etc/svsconfig/network-scripts/ifcfg-lo
DEVICE=
IPADDR=127.0.0.1
NMASK=255.0.0.0
NETWORK=127.0.0.0
BCAST=127.255.255.255
ONBOOT=
NAME=
BOOTPROTO=
AIter setting these variables, the script will run the ifconfig program and stop, since there is nothing else to
do at the moment. However, when the program connects to an Internet Service Provider, it will
establish a device and addressing and routes based on the dynamic values assigned by the ISP. The
DNS server and other connection inIormation should be in an ifcfg-ppp Iile.
3.3.2 Host Computer on a LAN
These Iiles would be on a computer that is connected to a LAN; it has one Ethernet card that should come
up whenever the computer boots. These Iiles reIlect entries on the computer Irom the general
example.
This is the Iirst Iile the network script will read; again the Iirst variables simply determine that the
computer will do networking but that it will not Iorward packets. The last Iour variables identiIy the
computer and its link to the rest oI the Internet (everything that is not on the LAN).
/etc/svsconfig/network
NETWORKING=
FORWARD_IPV4=
HOSTNAME=...
DOMAINNAME=..
GATEWAY=172.16.1.1
GATEWAYDEV=0
AIter setting these variables, the network script will conIigure the network devices. This Iile sets up
environment variables Ior the Ethernet card. It names the device and gives it its IP address, network mask,
and broadcast address as well as any other device speciIic variables. This kind oI computer would also
have a loopback conIiguration Iile exactly like the one Ior a non-networked computer.
/etc/svsconfig/network-scripts/ifcfg-eth0
DEVICE=0
IPADDR=172.16.1.4
NMASK=255.255.255.0
NETWORK=172.16.1.0
BCAST=172.16.1.255
ONBOOT=
BOOTPROTO=
AIter setting these variables, the network script will run the ifconfig program to start the device. Finally,
the script will run the route program to add the deIault route (GATEWAY) and any other speciIied routes
(Iound in the /etc/svsconfig/static-routes file, iI any). In this case only the deIault route is speciIied, since
all traIIic either stays on the LAN (where the computer will use ARP to Iind other hosts) or goes through
the router to get to the outside world.
3.3.3 Network Routing Computer
These Iiles would be on a computer that serves as a router between two networks; it has two Ethernet
cards, one Ior each network. One card is on a large network (WAN) connected to the Internet (through
yet another router) while the other is on a subnetwork (LAN). Computers on the LAN that need to
communicate with the rest oI the Internet send traIIic through this computer (and vice versa). These Iiles
reIlect entries on the / computer Irom the general example.
This is the Iirst Iile the network script will read; it sets several environment variables. The Iirst two simply
determine that the computer will do networking (since it is on a network) and that this one will Iorward
packets (Irom one network to the other). IP Forwarding is built into most kernels, but it is not active
unless there is a 1 ``written'' to the /proc/net/ipv4/ip¸forward Iile. (One oI the network scripts perIorms an
 1 > ///4/_ iI FORWARD_IPV4 is true.) The last Iour variables identiIy the
computer and its link to the rest oI the Internet (everything that is not on one oI its own networks).
/etc/svsconfig/network
NETWORKING=
FORWARD_IPV4=
HOSTNAME=..
DOMAINNAME=.
GATEWAY=172.16.0.1
GATEWAYDEV=1
AIter setting these variables, the network script will conIigure the network devices. These Iiles set up
environment variables Ior two Ethernet cards. They name the devices and give them their IP addresses,
network masks, and broadcast addresses. (Note that the BOOTPROTO variable remains deIined Ior the
second card.) Again, this computer would have the standard loopback conIiguration Iile.
/etc/svsconfig/network-scripts/ifcfg-eth0
DEVICE=0
IPADDR=172.16.1.1
NMASK=255.255.255.0
NETWORK=172.16.1.0
BCAST=172.16.1.255
ONBOOT=
BOOTPROTO=
/etc/svsconfig/network-scripts/ifcfg-eth1
DEVICE=1
IPADDR=172.16.0.7
NMASK=255.255.0.0
NETWORK=172.16.0.0
BCAST=172.16.255.255
ONBOOT=
AIter setting these variables, the network script will run the ifconfig program to start each device. Finally,
the script will run the route program to add the deIault route (GATEWAY) and any other speciIied routes
(Iound in the /etc/svsconfig/static-routes file, iI any). In this case again, the deIault route is the only
speciIied route, since all traIIic will go on the network indicated by the network masks or through the
deIault router to reach the rest oI the Internet.
3.4 Linux and Network Program Functions
The Iollowing are alphabetic lists oI the Linux kernel and network program Iunctions that are most
important to initialization, where they are in the source code, and what they do. The SOURCES directory
shown represents the directory that contains the source code Ior the given network Iile. The executable
Iiles should come with any Linux distrbution, but the source code probably does not.
These sources are available as a package separate Irom the kernel source (Red Hat Linux uses the rpm
package manager). The code below is Irom the net-tools-1.53-1 source code package, 29 August 1999.
The packages are available Irom the www.redhat.com/apps/download web page. Once downloaded, root
can install the package with the Iollowing commands (starting Irom the directory with the package):
 ­ ­­1.53­1..
 ////SOURCES
  ­­1.53..
This creates a /usr/src/redhat/SOURCES/net-tools-1.53 directory and Iills it with the source code Ior the
ifconfig and route programs (among others). This process should be similar (but is undoubtably not
exactly the same) Ior other Linux distributions.
3.4.1 ifconfig
_() ­ /4/. (398)
      ()     
         
      INET    ,  
         ,    
       
   0  
>>>  () ­ SOURCES/. (478)
     (     )
       
   _()         
         
     ,     
       ()      
_() ­ SOURCES//. (338)
           () 
      ,  , , MTU, ,   
_() ­ SOURCES/. (121)
   _()   ( ) ()
      ( _()       
           )
_() ­ SOURCES//. (261)
   ///      
   _()         
_() ­ /4/_. (855)
         
      [ ,  _()]
() ­
       [= _()]
3.4.2 route
INET_() ­ SOURCES//_. (305)
     (      )
   INET_()
INET_() ­ SOURCES//_. (442)
    FIB   ,  _()
      (, ,     ///)
    CACHE   ,  _()
      (, ,     ///_)
INET_() ­ SOURCE//_. (57)
           
        
    ,    
     
     
   ()       
      0
() ­ 
       [= __()]
__() ­ /4/_. (246)
         ( )
     :
     __()     
      ­>_()    
     
     __()     
      ­>_()     
   0  
>>>  () ­ SOURCES/. (106)
          
         (   
            )
     (        )
      ,  _()
       , ,   ,
       _()    
      ,    
    
_() ­ SOURCES//. (69)
   _()         
     (   )
      ()  [= INET_()]
_() ­ SOURCES//. (72)
   _()         
     (   )
      ()  [= INET_()]
Chapter 4
Connections
This chapter presents the connection process. It provides an overview oI the connection process, a
description oI the socket data structures, an introduction to the routing system, and summarizes the
implementation code within the kernel.
4.1 Overview
The simplest Iorm oI networking is a connection between two hosts. On each end, an application gets a
socket, makes the transport layer connection, and then sends or receives packets. In Linux, a socket is
actually composed oI two socket structures (one that contains the other). When an application creates a
socket, it is initialized but empty. When the socket makes a connection (whether or not this involves
traIIic with the other end) the IP layer determines the route to the distant host and stores that inIormation
in the socket. From that point on, all traIIic using that connection uses that route - sent packets will travel
through the correct device and the proper routers to the distant host, and received packets will appear in
the socket's queue.
4.2 Socket Structures
There are two main socket structures in Linux: general BSD sockets and IP speciIic INET sockets. They
are strongly interrelated; a BSD socket has an INET socket as a data member and an INET socket has a
BSD socket as its owner.
BSD sockets are oI type   as deIined in include/linux/socket.h. BSD socket variables are
usually named or some variation thereoI. This structure has only a Iew entries, the most important oI
which are described below.
 _ * - this structure contains pointers to protocol speciIic Iunctions Ior
implementing general socket behavior. For example, ­ >  points to the
_() Iunction.
struct inode *inode - this structure points to the Iile inode that is associated with this socket.
  * - this is the INET socket that is associated with this socket.
INET sockets are oI type   as deIined in include/net/sock.h. INET socket variables are
usually named or some variation thereoI. This structure has many entries related to a wide variety oI
uses; there are many hacks and conIiguration dependent Iields. The most important data members are
described below:
  *, * - all sockets are linked by various protocols, so these pointers allow
the protocols to traverse them.
 _ *_ - this is a pointer to the route to the socket's other side (the
destination Ior sent packets).
 __ _ - this is the head oI the receive queue.
 __ _ - this is the head oI the send queue.
__32  - the (Internet) source address Ior this socket.
 __ _,_ - extra queues Ior a backlog oI packets (not to
be conIused with the main backlog queue) and erroneous packets Ior this socket.
  * - this structure contains pointers to transport layer protocol speciIic
Iunctions. For example, ­ >  may point to the _4_() Iunction.
  _ _; _ - TCP options Ior this socket.
  * - the parent BSD socket.
Note that there are many more Iields within this structure; these are only the most critical and non-
obvious. The rest are either not very important or have selI-explanatory names (e.g., _ is the
IP Time-To-Live counter).
4.3 Sockets and Routing
Sockets only go through the routing lookup process once Ior each destination (at connection time).
Because Linux sockets are so closely related to IP, they contain routes to the other end oI a connection (in
the ­ > ­ > _ variable). The transport protocols call the __()
Iunction to determine the route Irom host to host during the connection process; aIter that, the route is
presumed not to change (though the path pointed to by the _ may indeed change). The socket
does not need to do continuous routing table look-ups Ior each packet it sends or receives; it only tries
again iI something unexpected happens (such as a neighboring computer going down). This is the beneIit
oI using connections.
4.4 Connection Processes
4.4.1 Establishing Connections
Application programs establish sockets with a series oI system calls that look up the distant address,
establish a socket, and then connect to the machine on the other end.
    /*    */
     = (SERVER_NAME);
    /*   */
     = (AF_INET, SOCK_STREAM, 0);
    /*    */
    ._ = AF_INET;
    ._ = (PORT_NUM);
    (&._,­>_,­>_);
    /*    */
    (, &, ());
The () Iunction simply looks up a host (such as ``viper.cs.u.edu'') and returns a structure
that contains an Internet (IP) address. This has very little to do with routing (only inasmuch as the host
may have to query the network to look up an address) and is simply a translation Irom a human readable
Iorm (text) to a computer compatible one (an unsigned 4 byte integer).
The () call is more interesting. It creates a socket object, with the appropriate data type (a
Ior INET sockets) and initializes it. The socket contains inode inIormation and protocol speciIic pointers
Ior various network Iunctions. It also establishes deIaults Ior queues (incoming, outgoing, error, and
backlog), a dummy header inIo Ior TCP sockets, and various state inIormation.
Finally, the () call goes to the protocol dependent connection routine (e.g., _4_()
or _()). UDP simply establishes a route to the destination (since there is no virtual
connection). TCP establishes the route and then begins the TCP connection process, sending a packet
with appropriate connection and window Ilags set.
4.4.2 Socket Call Walk-Through
Check Ior errors in call
Create (allocate memory Ior) socket object
Put socket into INODE list
Establish pointers to protocol Iunctions (INET)
Store values Ior socket type and protocol Iamily
Set socket state to closed
Initialize packet queues
4.4.3 Connect Call Walk-Through
Check Ior errors
Determine route to destination:
Check routing table Ior existing entry (return that iI one exists)
Look up destination in FIB
Build new routing table entry
Put entry in routing table and return it
Store pointer to routing entry in socket
Call protocol speciIic connection Iunction (e.g., send a TCP connection packet)
Set socket state to established
4.4.4 Closing Connections
Closing a socket is Iairly straightIorward. An application calls () on a socket, which becomes a
_() Iunction call. This changes the socket state to disconnecting and calls the data member's
(INET socket's) release Iunction. The INET socket in turn cleans up its queues and calls the transport
protocol's close Iunction, _4_() or _(). These perIorm any necessary actions (the
TCP Iunctions may send out packets to end the TCP connection) and then clean up any data structures
they have remaining. Note that no changes are made Ior routing; the (now-empty) socket no longer has a
reIerence to the destination and the entry in the routing cache will remain until it is Ireed Ior lack oI use.
4.4.5 Close Walk-Through
Check Ior errors (does the socket exist?)
Change the socket state to disconnecting to prevent Iurther use
Do any protocol closing actions (e.g., send a TCP packet with the FIN bit set)
Free memory Ior socket data structures (TCP/UDP and INET)
Remove socket Irom INODE list
4.5 Linux Functions
The Iollowing is an alphabetic list oI the Linux kernel Iunctions that are most important to connections,
where they are in the source code, and what they do. To Iollow Iunction calls Ior creating a socket, begin
with _(). To Iollow Iunction calls Ior closing a socket, begin with _().
_ ­ /4/_. (195)
    
       
    ' 
      
_() ­ //_. (153)
   _() [= __()]     
      
__() ­ /4/_. (261)
         
_() ­ /4/_. (326)
   _()     
    :
           TCP  UDP
     __()
     ,,. 
       ( )
_() ­ /4/_. (463)
      
   ___     ( )
    '    NULL
   ­>­>() [=TCP/UDP_()]
__() ­ //. (140)
   __()     
          
         
__() ­ /4/. (1664)
      
     (  )     TOS
      ,      
    ___()
___() ­ /4/. (1421)
      ,    
      ,   
   _()     FIB
       
      , , TOS,  ,
      
   __()    
   __(),      
__() ­ /4/. (526)
    __ (   )
    ,      
          
>>> _() ­ /. (476)
      (  )
   _()      
   _()
>>> _() ­ /. (571)
   
   _()         
       
   ­> ( SOCK_STREAM, SOCK_DGRAM...)
   _­>() [= _()]    
    
__() ­ //. (1018)
      
_() ­ /. (309)
     
   ­>­>() [= _()]
   ()      
_() ­ /. (639)
   _()     
   _()       
   ­>  () (  )
   _()   
_() ­ /4/. (1502)
    
         
         ( )
_() ­ /4/_. (910)
           
       
   __()   ,  TCP 
_4_() ­ /4/_4. (571)
    
   __()     
      
   _()   
_() ­ /4/. (954)
   _4_()      
   _()
_() ­ /4/. (900)
   __()     
          
      
       ­>_
Chapter 5
Sending Messages
This chapter presents the sending side oI message traIIicking. It provides an overview oI the process,
examines the layers packets travel through, details the actions oI each layer, and summarizes the
implementation code within the kernel.
5.1 Overview
Figure 5.1: Message transmission.
An outgoing message begins with an application system call to write data to a socket. The socket
examines its own connection type and calls the appropriate send routine (typically INET). The send
Iunction veriIies the status oI the socket, examines its protocol type, and sends the data on to the transport
layer routine (such as TCP or UDP). This protocol creates a new buIIer Ior the outgoing packet (a socket
buIIer, or  _ ), copies the data Irom the application buIIer, and Iills in its header
inIormation (such as port number, options, and checksum) beIore passing the new buIIer to the network
layer (usually IP). The IP send Iunctions Iill in more oI the buIIer with its own protocol headers (such as
the IP address, options, and checksum). It may also Iragment the packet iI required. Next the IP layer
passes the packet to the link layer Iunction, which moves the packet onto the sending device's queue
and makes sure the device knows that it has traIIic to send. Finally, the device (such as a network card)
tells the bus to send the packet.
5.2 Sending Walk-Through
5.2.1 Writing to a Socket
Write data to a socket (application)
Fill in message header with location oI data (socket)
Check Ior basic errors - is socket bound to a port? can the socket send messages? is there something
wrong with the socket?
Pass the message header to appropriate transport protocol (INET socket)
5.2.2 Creating a Packet with UDP
Check Ior errors - is the data too big? is it a UDP connection?
Make sure there is a route to the destination (call the IP routing routines iI the route is not already
established; Iail iI there is no route)
Create a UDP header (Ior the packet)
Call the IP build and transmit Iunction
5.2.3 Creating a Packet with TCP
Check connection - is it established? is it open? is the socket working?
Check Ior and combine data with partial packets iI possible
Create a packet buIIer
Copy the payload Irom user space
Add the packet to the outbound queue
Build current TCP header into packet (with ACKs, SYN, etc.)
Call the IP transmit Iunction
5.2.4 Wrapping a Packet in IP
Create a packet buIIer (iI necessary - UDP)
Look up route to destination (iI necessary - TCP)
Fill in the packet IP header
Copy the transport header and the payload Irom user space
Send the packet to the destination route's device output Iuntion
5.2.5 Transmitting a Packet
Put the packet on the device output queue
Wake up the device
Wait Ior the scheduler to run the device driver
Test the medium (device)
Send the link header
Tell the bus to transmit the packet over the medium
5.3 Linux Functions
The Iollowing is an alphabetic list oI the Linux kernel Iunctions that are most important to message traIIic,
where they are in the source code, and what they do. To Iollow Iunction calls, begin with _().
__() ­ //. (579)
   __()
      
     ()     
     _() [= _()]   
    __()
   __()
DEVICE­>__() ­  , //DEVICE.
        
   
      
   
_() ­ /4/_. (786)
      
         
    
   ­>[/]­>()
__ ­ /4/_. (604)
   ___()     
     
   () [= _()]       
   ­>..() [= __()]
__() ­ /4/_. (234)
    
   IP 
    
   IP 
   ­>­>() [= __()]
_() ­ //_. (50)
     
   ­>__()
   
      ,  
_() ­ /. (325)
   _() [  ]
   ­>[]­>()   
>>> _() ­ /. (399)
   _()     / 
          /
   _()
__() ­ /4/.  (755)
    ,  
   _()        
    
   _()     
   ____()      
   __()
__() ­ /4/_. (160)
   ____()     
   __()  
__() ­ /4/_. (77)
   TCP    
   ____()
   ACK,SYN
   ­>_[]­>_()
_4_() ­ /4/_4. (668)
    IP  ,  ,  
   __()
_() ­ /4/. (516)
         
_() ­ /4/. (559)
   , , 
    UDP    
   
    
      
   __()
   UDP 
   
Chapter 6
Receiving Messages
This chapter presents the receiving side oI message traIIicking. It provides an overview oI the process,
examines the layers packets travel through, details the actions oI each layer, and summarizes the
implementation code within the kernel.
6.1 Overview
Figure 6.1: Receiving messages.
An incoming message begins with an interrupt when the system notiIies the device that a message is
ready. The device allocates storage space and tells the bus to put the message into that space. It then
passes the packet to the link layer, which puts it on the backlog queue, and marks the network Ilag Ior the
next ``bottom-halI'' run.
The bottom-halI is a Linux system that minimizes the amount oI work done during an interrupt. Doing a
lot oI processing during an interrupt is not good precisely because it interrupts a running process; instead,
interrupt handlers have a ``top-halI'' and a ``bottom-halI''. When the interrupt arrives, the top-halI runs and
takes care oI any critical operations, such as moving data Irom a device queue into kernel memory. It then
marks a Ilag that tells the kernel that there is more work to do - when the processor has time - and returns
control to the current process. The next time the process scheduler runs, it sees the Ilag, does the extra
work, and only then schedules any normal processes.
When the process scheduler sees that there are networking tasks to do it runs the network bottom-halI.
This Iunction pops packets oII oI the backlog queue, matches them to a known protocol (typically IP),
and passes them to that protocol's receive Iunction. The IP layer examines the packet Ior errors and routes
it; the packet will go into an outgoing queue (iI it is Ior another host) or up to the transport layer (such as
TCP or UDP). This layer again checks Ior errors, looks up the socket associated with the port speciIied in
the packet, and puts the packet at the end oI that socket's receive queue.
Once the packet is in the socket's queue, the socket will wake up the application process that owns it (iI
necessary). That process may then make or return Irom a system call that copies the data Irom the
packet in the queue into its own buIIer. (The process may also do nothing Ior the time being iI it was not
waiting Ior the packet, and get the data oII the queue when it needs it.)
6.2 Receiving Walk-Through
6.2.1 Reading from a Socket (Part I)
Try to read data Irom a socket (application)
Fill in message header with location oI buIIer (socket)
Check Ior basic errors - is the socket bound to a port? can the socket accept messages? is there
something wrong with the socket?
Pass the message header with to the appropriate transport protocol (INET socket)
Sleep until there is enough data to read Irom the socket (TCP/UDP)
6.2.2 Receiving a Packet
Wake up the receiving device (interrupt)
Test the medium (device)
Receive the link header
Allocate space Ior the packet
Tell the bus to put the packet into the buIIer
Put the packet on the backlog queue
Set the Ilag to run the network bottom halI when possible
Return control to the current process
6.2.3 Running the Network ``Bottom Half''
Run the network bottom halI (scheduler)
Send any packets that are waiting to prevent interrupts (bottom halI)
Loop through all packets in the backlog queue and pass the packet up to its Internet reception
protocol - IP
Flush the sending queue again
Exit the bottom halI
6.2.4 Unwrapping a Packet in IP
Check packet Ior errors - too short? too long? invalid version? checksum error?
DeIragment the packet iI necessary
Get the route Ior the packet (could be Ior this host or could need to be Iorwarded)
Send the packet to its destination handling routine (TCP or UDP reception, or possibly
retransmission to another host)
6.2.5 Accepting a Packet in UDP
Check UDP header Ior errors
Match destination to socket
Send an error message back iI there is no such socket
Put packet into appropriate socket receive queue
Wake up any processes waiting Ior data Irom that socket
6.2.6 Accepting a Packet in TCP
Check sequence and Ilags; store packet in correct space iI possible
II already received, send immediate ACK and drop packet
Determine which socket packet belongs to
Put packet into appropriate socket receive queue
Wake up and processes waiting Ior data Irom that socket
6.2.7 Reading from a Socket (Part II)
Wake up when data is ready (socket)
Call transport layer receive Iunction
Move data Irom receive queue to user buIIer (TCP/UDP)
Return data and control to application (socket)
6.3 Linux Functions
The Iollowing is an alphabetic list oI the Linux kernel Iunctions that are most important to receiving
traIIic, where they are in the source code, and what they do. To Iollow Iunctions calls Irom the network
up, start with DEVICE_(). To Iollow Iunctions calls Irom the application down, start with
_().
>>> DEVICE_() ­  , //DEVICE.
  (   )
           
   __()     
       
   __()    
   _()
    
  (  )
_() ­ /4/_. (764)
      
         
    
   ­>[/]­>()
_() ­ /4/_. (395)
     :
      (    )
      ( 4)
     
   ___()   
     
   __()   
     IP 
   ­>­>() [= _,_()]
_() ­ //. (835)
  (  )
         ,  __()
      (  )
        
        
     _()    
           (FASTROUTED)    
        (  )    
     _­>() [= _()]     
        
   __()    ( )
_() ­ //. (757)
     ­>
       ,  
  
     __()      
         
__() ­ //. (989)
   __()       
   __()   SIGIO   
___() ­ //. (857)
   __()       
   ­>_() [= __()]
>>> _() ­ /. (366)
     
   _()    
_() ­ /. (338)
      ()   
       ­>[]­>()
_() ­ /4/_. (1507)
      
   __()   
   ­>_()   
__() ­ /4/_. (1394)
       :
     ,  
        
   ____()       
    
__() ­ /4/_. (1795)
    
         
     ACK
     ___()       
   ( )
       ,  ACK   
      FIN, SYN, RST, ACK
     _()   
     ACK
_() ­ /4/. (1149)
    
          
       
   _()        
        
   _()      ACK  
   __()    ( )
___() ­ /4/. (963)
   ___()
   UDP  (    )
_() ­ /4/. (1062)
   UDP ,  ,   ( )
   
   _4_()     
     ,  ICMP  ,  ,  
   _() [= ___()]
_() ­ /4/. (794)
   __()     
   ___()        
         
     
          
     
Chapter 7
IP Forwarding
This chapter presents the pure routing side (by IP Iorwarding) oI message traIIic. It provides an overview
oI the process, examines the layers packets travel through, details the actions oI each layer, and
summarizes the implementation code within the kernel.
7.1 Overview
See Figure 7.1 Ior an abstract diagram oI the the Iorwarding process. (It is essentially a combination oI the
receiving and sending processes.)
Figure 7.1: IP Iorwarding.
A Iorwarded packet arrives with an interrupt when the system notiIies the device that a message is ready.
The device allocates storage space and tells the bus to put the message into that space. It then passes the
packet to the link layer, which puts it on the backlog queue, marks the network Ilag Ior the next ``bottom-
halI'' run, and returns control to the current process.
When the process scheduler next runs, it sees that there are networking tasks to do and runs the network
``bottom-halI''. This Iunction pops packets oII oI the backlog queue, matches them to IP, and passes them
to the receive Iunction. The IP layer examines the packet Ior errors and routes it; the packet will go up to
the transport layer (such as TCP or UDP iI it is Ior this host) or sideways to the IP Iorwarding Iunction.
Within the Iorwarding Iunction, IP checks the packet and sends an ICMP message back to the sender iI
anything is wrong. It then copies the packet into a new buIIer and Iragments it iI necessary.
Finally the IP layer passes the packet to the link layer Iunction, which moves the packet onto the sending
device's queue and makes sure the device knows that it has traIIic to send. Finally, the device (such
as a network card) tells the bus to send the packet.
7.2 IP Forward Walk-Through
7.2.1 Receiving a Packet
Wake up the receiving device (interrupt)
Test the medium (device)
Receive the link header
Allocate space Ior the packet
Tell the bus to put the packet into the buIIer
Put the packet on the backlog queue
Set the Ilag to run the network bottom halI when possible
Return control to the current process
7.2.2 Running the Network ``Bottom Half''
Run the network bottom halI (scheduler)
Send any packets that are waiting to prevent interrupts (net¸bh)
Loop through all packets in the backlog queue and pass the packet up to its Internet reception
protocol - IP
Flush the sending queue again
Exit the bottom halI
7.2.3 Examining a Packet in IP
Check packet Ior errors - too short? too long? invalid version? checksum error?
DeIragment the packet iI necessary
Get the route Ior the packet (could be Ior this host or could need to be Iorwarded)
Send the packet to its destination handling routine (retransmission to another host in this case)
7.2.4 Forwarding a Packet in IP
Check TTL Iield (and decrement it)
Check packet Ior improper (undesired) routing
Send ICMP back to sender iI there are any problems
Copy packet into new buIIer and Iree old one
Set any IP options
Fragment packet iI it is too big Ior new destination
Send the packet to the destination route's device output Iunction
7.2.5 Transmitting a Packet
Put the packet on the device output queue
Wake up the device
Wait Ior the scheduler to run the device driver
Test the medium (device)
Send the link header
Tell the bus to transmit the packet over the medium
7.3 Linux Functions
The Iollowing is an alphabetic list oI the Linux kernel Iunctions that are most important to IP Iorwarding,
where they are in the source code, and what they do. To Iollow the Iunctions calls, start with
DEVICE¸rx().
__() ­ //. (579)
   __()
      
     ()     
     _() [= _()]   
    __()
   __()
DEVICE­>__() ­  , //DEVICE.
        
   
      
   
>>> DEVICE_() ­  , //DEVICE.
  (   )
           
   __()     
       
   __()    
   _()
    
  (  )
__() ­ //. (140)
          
       [= __()]
_() ­ /4/_. (72)
     
         ,  
   TTL  ,     ICMP  
       ,     ICMP
         
   ,  ICMP      
      
   TTL
     ,  __()   
   _()
_() ­ /4/_. (395)
     :
      (    )
      ( 4)
     
   ___()   
     
   __()   
     IP 
   ­>­>() [= _()]
__() ­ /4/. (1366)
   __()      
      (  )     
     :
        (  )
          
     
   
       
       ___() ( )
___() ­ /4/. (1421)
      ,    
      ,   
   _()   
       
      , , TOS,  ,
      
   __()    
   __(),      
_() ­ //. (162)
   _()       
   __()
_() ­ //. (835)
  (  )
         ,  __()
      (  )
        
        
     _()    
           (FASTROUTED)    
        (  )    
     _­>() [= _()]     
        
   __()    ( )
_() ­ //. (757)
     ­>
       ,  
  
     __()      
         
_() ­ //_. (50)
     
   ­>__()
   
      ,  
__() ­ /4/. (526)
       
Chapter 8
Basic Internet Protocol Routing
This chapter presents the basics oI IP Routing. It provides an overview oI how routing works, examines
how routing tables are established and updated, and summarizes the implementation code within the
kernel.
8.1 Overview
Linux maintains three sets oI routing data - one Ior computers that are directly connected to the host (via a
LAN, Ior example) and two Ior computers that are only indirectly connected (via IP networking).
Examine Figure 8.1 to see how entries Ior a computer in the general example might look.
Figure 8.1: General routing table example.
The neighbor table contains address inIormation Ior computers that are physically connected to the host
(hence the name ``neighbor''). It includes inIormation on which device connects to which neighbor and
what protocols to use in exchanging data. Linux uses the Address Resolution Protocol (ARP) to maintain
and update this table; it is dynamic in that entries are added when needed but eventually disappear iI not
used again within a certain time. (However, administrators can set up entries to be permanent iI doing so
makes sense.)
Linux uses two complex sets oI routing tables to maintain IP addresses: an all-purpose Forwarding
InIormation Base (FIB) with directions to every possible address, and a smaller (and Iaster) routing cache
with data on Irequently used routes. When an IP packet needs to go to a distant host, the IP layer Iirst
checks the routing cache Ior an entry with the appropriate source, destination, and type oI service. II there
is such an entry, IP uses it. II not, IP requests the routing inIormation Irom the more complete (but slower)
FIB, builds a new cache entry with that data, and then uses the new entry. While the FIB entries are semi-
permanent (they usually change only when routers come up or go down) the cache entries remain only
until they become obsolete (they are unused Ior a ``long'' period).
8.2 Routing Tables
Note: within these tables, there are reIerences to variables oI types such as 32 (host byte order) and
__32 (network byte order). On the Intel architecture they are both equivalent to  s and in
point oI Iact they are translated (using the Iunction) anyway; the type merely gives an indication oI
the order in which the value it contains is stored.
8.2.1 The Neighbor Table
The Neighbor Table (whose structure is shown in Figure 8.2) contains inIormation about computers that
are physically linked with the host computer. (Note that the source code uses the European spelling,
``neighbour''.) Entries are not (usually) persistent; this table may contain no entries (iI the computer has
not passed any network traIIic recently) or may contain as many entries as there are computers physically
connected to its network (iI it has communicated with all oI them recently). Entries in the table are
actually other table structures which contain addressing, device, protocol, and statistical inIormation.
Figure 8.2: Neighbor Table data structure relationships.
 _ *_ - this global variable is a pointer to a list oI neighbor tables; each
table contains a set oI general Iunctions and data and a hash table oI speciIic inIormation about a set oI
neighbors. This is a very detailed, low level table containing speciIic inIormation such as the approximate
transit time Ior messages, queue sizes, device pointers, and pointers to device Iunctions.
Neighbor Table ( _) Structure - this structure (a list element) contains common
neighbor inIormation and table oI neighbor data and pneigh data. All computers connected through a
single type oI connection (such as a single Ethernet card) will be in the same table.
 _ * - pointer to the next table in the list.
 _  - structure containing message travel time, queue length, and
statistical inIormation; this is actually the head oI a list.
 _ *_ - pointer to a list oI inIormation structures.
  *_[] - hash table oI neighbors associated with this table; there
are NEIGH_HASHMASK+1 (32) buckets.
 _ *_[] - hash table oI structures containing device pointers
and keys; there are PNEIGH_HASHMASK+1 (16) buckets.
Other Iields include timer inIormation, Iunction pointers, locks, and statistics.
Neighbor Data ( ) Structure - these structures contain the speciIic inIormation about
each neighbor.
  * - pointer to the device that is connected to this neighbor.
__8 _ - status Ilags; values can be incomplete, reachable, stale, etc.; also contains state
inIormation Ior permanence and ARP use.
 _ * - pointer to cached hardware header Ior transmissions to this neighbor.
 __ _ - pointer to ARP packets Ior this neighbor.
Other Iields include list pointers, Iunction (table) pointers, and statistical inIormation.
8.2.2 The Forwarding Information Base
Figure 8.3: Forwarding InIormation Base (FIB) conceptual organization.
The Forwarding InIormation Base (FIB) is the most important routing structure in the kernel; it is a
complex structure that contains the routing inIormation needed to reach any valid IP address by its
network mask. Essentially it is a large table with general address inIormation at the top and very speciIic
inIormation at the bottom. The IP layer enters the table with the destination address oI a packet and
compares it to the most speciIic netmask to see iI they match. II they do not, IP goes on to the next most
general netmask and again compares the two. When it Iinally Iinds a match, IP copies the ``directions'' to
the distant host into the routing cache and sends the packet on its way. See Figures 8.3 and 8.4 Ior the
organization and data structures used in the FIB - note that Figure 8.3 shows some diIIerent FIB
capabilities, like two sets oI network inIormation Ior a single zone, and so does not Iollow the general
example.)
 _ *_, *_ - these global variables are the access points to the
FIB tables; they point to table structures that point to hash tables that point to zones. The contents oI the
_ variable are in /proc/net/route.
FIB Table _ Structure - include/net/ip¸fib.h - these structures contain Iunction jump tables and
each points to a hash table containing zone inIormation. There are usually only one or two oI these.
 (*_functions)() - pointers to table Iunctions (lookup, delete, insert, etc.) that are set
during initialization to __function().
  _[0] - pointer to the associated FIB hash table (despite its declaration as a
character array).
  _ - table identiIier; 255 Ior _, 254 Ior _.
 _
Netmask Table _ Structure - net/ipv4/fib¸hash.c - these structures contain pointers to the
individual zones, organized by netmask. (Each zone corresponds to a uniquely speciIic network mask.)
There is one oI these Ior each FIB table (unless two tables point to the same hash table).
 _ *_[33] - pointers to zone entries (one zone Ior each bit in the mask;
_[0] points to the zone Ior netmask 0x0000, _[1] points to the zone Ior 0x8000,
and _[32] points to the zone Ior 0xFFFF.
 _ *__ - pointer to Iirst (most speciIic) non-empty zone in the list; iI
there is an entry Ior netmask 0xFFFF it will point to that zone, otherwise it may point to zone
0xFFF0 or 0xFF00 or 0xF000 etc.
Network Zone _ Structure - net/ipv4/fib¸hash.c - these structures contain some hashing
inIormation and pointers to hash tables oI nodes. There is one oI these Ior each known netmask.
 _ *_ - pointer to the next non-empty zone in the hash structure (the next
most general netmask; e.g., _­ > _[28]­ > _ might point to _­ >
_[27]).
 _ **_ - pointer to a hash table oI nodes Ior this zone.
 _ - the number oI entries (nodes) in this zone.
 _ - the number oI buckets in the hash table associated with this zone; there are 16
buckets in the table Ior most zones (except the Iirst zone - 0000 - the loopback device).
32 _ - a mask Ior entering the hash table oI nodes; 15 (0x0F) Ior most zones, 0 Ior
zone 0).
 _ - the index oI this zone in the parent _ structure (0 to 32).
32 _ - the zone netmask deIined as ((1<<(32­_))­1); Ior example, the Iirst
(zero) element is 1 shiIted leIt 32 minus 0 times (0x10000), minus 1 (0xFFFF), and complemented
(0x0000). The second element has a netmask oI 0x8000, the next 0xC000, the next 0xE000,
0xF000, 0xF800, and so on to the last (32d) element whose mask is 0xFFFF.
Network Node InIormation _ Structure - net/ipv4/fib¸hash.c - these structures contain the
inIormation unique to each set oI addresses and a pointer to inIormation about common Ieatures (such as
device and protocols); there is one Ior each known network (unique source/destination/TOS
combination).
 _ *_ - pointer to the next node.
 _ *_ - pointer to more inIormation about this node (that is shared by
many nodes).
__ _ - hash table key - the least signiIicant 8 bits oI the destination address (or 0 Ior
the loopback device).
Other Iields include speciIic inIormation about this node (like _ and _).
Network Protocol InIormation (_) Structure - include/net/ip¸fib.h - these structures contain
protocol and hardware inIormation that are speciIic to an interIace and thereIore common to many
potential zones; several networks may be addressable through the same interIace (like the one that leads to
the rest oI the Internet). There is one oI these Ior each interIace.
_ - index to a network protocol (e.g., IP) used Ior this route.
 _ _[0] - contains a pointer to the device used Ior sending or receiving traIIic
Ior this route.
Other Iields include list pointers and statistical and reIerence data (like _ and
_.
Figure 8.4: Forwarding InIormation Base (FIB) data relationships.
FIB Traversal Example:
1. ___() (called because the route is not in the routing cache) sets up an _
structure with a source address oI 172.16.0.7, a destination address oI 172.16.0.34, and a TOS oI 2.
2. ___() calls _() and passes it the key to search Ior.
3. _() calls _­ > _() (which is a reIerence to the
__ Iunction) to make the local table Iind the key.
4. __() searches the local table's hash table, starting in the most speciIic zone - 24
(netmask 255.255.255.0 dotted decimal) (pointed to by the __ variable).
5. _() builds a test key by ANDing the destination address with the zone netmask, resulting in
a key value 172.16.0.0.
6. _() perIorms the hash Iunction (see _()) and ANDs this value with the zone's
_ (15) to get an index (6) into the zone's hash table oI nodes. UnIortunately, this node
is empty; there are no possible matches in this zone.
7. __() moves to the next non-empty zone - 16 (netmask 255.255.0.0 dotted decimal)
(pointed to by the current zone's _ variable).
8. _() builds a new test key by ANDing the destination address with this zone's netmask,
resulting in a key value oI 172.16.0.0.
9. _() perIorms the hash Iunction and ANDs this value with the zone's _ (15) to
get an index (10) into the zone's hash table oI nodes. There is a node in that slot.
10. __() compares its search key to the node's key. They do not match, but the search
key value is less than that oI the node key, so it moves on to the next node.
11. __() compares its search key to the new node's key. These do match, so it does
some error checking and tests Ior an exact match with the node and its associated inIo variable.
12. Since everything matches, __() Iills in a _ structure with all the
inIormation about this route. (Otherwise it would continue checking more nodes and more zones
until it Iinds a match or Iails completely.)
13. ___() takes the _ structure and, assuming everything is in order,
creates a new routing cache entry Irom it.
8.2.3 The Routing Cache
Figure 8.5: Routing Cache conceptual organization.
The routing cache is the Iastest method Linux has to Iind a route; it keeps every route that is currently in
use or has been used recently in a hash table. When IP needs a route, it goes to the appropriate hash
bucket and searches the chain oI cached routes until Iinds a match, then sends the packet along that path.
(See Section 8.2.2 Ior what happens when the route is not yet in the cache.) Routes are chained in order,
most Irequently used Iirst, and have timers and counters that remove them Irom the table when they are no
longer in use. See Figure 8.5 Ior an abstract overview and Figures 8.6 and 8.7 Ior detailed diagrams oI the
data structures.
  *__[RT_HASH_DIVISOR] - this global variable contains 256 buckets oI
(pointers to) chains oI routing cache () entries; the hash Iunction combines the source address,
destination address, and TOS to get an entry point to the table (between 0 and 255). The contents oI this
table are listed in /proc/net/rt¸cache.
Routing Table Entry () Structure - include/net/route.h - these structures contain the destination
cache entries and identiIication inIormation speciIic to each route.
 <  _ ;  * _) >  - this is an entry in the
table; the union structure allows quick access to the next entry in the table by overusing the
's next Iield to point to the next cache entry iI required.
__32 _ - the destination address.
__32 _ - the source address.
_  - the input interIace.
__32 _ - the address oI the neighbor to route through to get to a destination.
 _  - a structure containing the cache lookup key (with src, dst, iiI, oiI, tos, and
scope Iields)
Other Iields contain Ilags, type, and other miscellaneous inIormation.
Destination Cache (_) Structure - include/net/dst.h - these structures contain pointers to speciIic
input and output Iunctions and data Ior a route.
  * - the input/output device Ior this route.
  - the maximum packet size Ior this route.
  * - a pointer to the neighbor (next link) Ior this route.
 _ * - a pointer to the hardware header cache; since this is the same Ior every
outgoing packet on a physical link, it is kept Ior quick access and reuse.
 (*)( _*) - a pointer to the input Iunction Ior this route (typically
_()).
 (*)( _*) - a pointer to the output Iunction Ior this route (typically
__()).
 _ * - a pointer to a structure containing the Iamily, protocol, and check,
reroute, and destroy Iunctions Ior this route.
Other Iields hold statistical and state inIormation and links to other routing table entries.
Neighbor Link () Structure - include/net/neighbor.h - these structures, one Ior each host that is
exactly one hop away, contain pointers to their access Iunctions and inIormation.
  * - a pointer to device that is physically connected to this neighbor.
 _ * - a pointer to the hardware header that always precedes traIIic sent to this
neighbor.
 (*)( _*) - a pointer to the output Iunction Ior this neighbor (typically
__()?).
 __ _ - the Iirst element in the ARP queue Ior traIIic concerning this
neighbor - incoming or outgoing?
 _ * - a pointer to a structure that containing Iamily data and and output
Iunctions Ior this link.
Other Iields hold statistical and state inIormation and reIerences to other neighbors.
Figure 8.6: Routing Cache data structure relationships.
Figure 8.7: Destination Cache data structure relationships.
Routing Cache Traversal Example:
1. __() (called to Iind a route) calls __() with a source address oI
172.16.1.1, a destination address oI 172.16.1.6, and a TOS oI 2.
2. __() perIorms a hash Iunction on the source, destination, and TOS and ANDs the
result with 255 to get an entry into the hash table (5).
3. __() enters the hash table at index 5. There is an entry there, but the destination
addresses do not match.
4. __() moves to the next entry (pointed to by the ._ Iield oI the last entry).
This one matches in every case - destination address, source address, oI 0, matching , and
acceptable TOS.
5. __() updates the statistics in the newIound _ structure oI the table entry,
sets a pointer Ior the calling Iunction to reIer to the route, and returns a 0 indicating success.
8.2.4 Updating Routing Information
Linux only updates routing inIormation when necessary, but the tables change in diIIerent manners. The
routing cache is the most volatile, while the FIB usually does not change at all.
The neighbor table changes as network traIIic is exchanged. II a host needs to send something to an
address that is on the local subnet but not already in the neighbor table, it simply broadcasts an ARP
request and adds a new entry in the neighbor table when it gets a reply. Periodically entries time out and
disappear; this cycle continues indeIinitely (unless a route has been speciIically marked as ARP
permanent). The kernel handles most changes automatically.
The FIB on most hosts and even routers remains static; it is Iilled in during initialization with every
possible zone to route through all connected routers and never changes unless one oI the routers goes
down. (See Chapter 9 Ior details on IP routing daemons). Changes have to come through external
() calls to add or delete zones.
The routing cache changes Irequently depending on message traIIic. II a host needs to send packets to a
remote address, it looks up the address in the routing cache (and FIB iI necessary) and sends the packet
oII through the appropriate router. On a host connected to a LAN with one router to the Internet, every
entry will point to either a neighbor or the router, but there may be many entries that point to the router
(one Ior each distant address). The entries are created as connections are made and time out quickly when
traIIic to that address stops Ilowing. Everything is done with IP level calls to create routes and kernel
timers to delete them.
8.3 Linux Functions
The Iollowing is an alphabetic list oI the Linux kernel Iunctions that are most important to routing, where
they are in the source code, and what they do.
_() ­ /4/. (542)
     (­ARP ,  ,    ,
          , .)
     ­   REPLY  REQUEST
     
      ­    
        (   )
         __()  :
          :
       __()         
          (    )
           
    :
       __()         
       _()
       ,  _()   
        _()   0
       :
     ___()
         ARP    ;   
         () 
     _()   ARP 
   _()
       0
_() ­ /4/. (434)
        ARP
    
      
     ARP 
   __()    
__() ­ /4/. (848)
   ___()      
         
   0    ENXIO     ARP 
__() ­ /4/_. (109)
       _­>___()   FS
_() ­ //_. (153)
   _() [= __()]  _  _
       ,    _   0
     
___() ­ /4/_. (971)
   _  _    FS
__() ­ /4/_. (191)
    '   
        
   0    
_() ­ /4/_. (108)
         :
    32  = ()>>(32 ­ _­>_);
     ^= (>>20);
     ^= (>>10);
     ^= (>>5);
     &= FZ_HASHMASK();   // FZ_HASHMASK  15    
___() ­ /4/_. (723)
       FIB   ___() 
       FS
__() ­ /4/_. (261)
         
           (    )
         (  ) 
            TOS   
           __()    
            _      0
   1   
__() ­ /4/_. (220)
    ( )   
     16     (   ­
      0.0.0.0 [] ­    )
    (   ,       
         )
         
       (    )
       
    
_() ­ /4/_. (133)
   _()     
    _   _    
__() ­ /4/_. (147)
               
__() ­ //. (140)
   __()     
          
         
__() ­ /4/. (1366)
      
     (  )    
      (, , TOS,  IIF/OIF)
      ,      
    ___()
___() ­ /4/. (1097)
       
      ( , ,  )
   _()   
        
      , , TOS,  ,
      
   __()    
          
   __()     ()
   __(),      
__() ­ /4/. (1664)
      
     (  )    
      (, , TOS,  IIF/OIF)
      ,      
    ___()
___() ­ /4/. (1421)
       
      ,  __    
      ,   
   _()   
        
      , , TOS,  ,
      
   __()     ()
   __(),      
__() ­ /4/_. (250)
    SIOCADDRT  SIOCDELRT ( EINVAL )
         
        
     ,  __()  ­>()
    __()  ­>()
       0  
__() ­ //. (760)
   ___()       
   _()
      
_() ­ //. (668)
      
           
       :
          ,   
     ,   
   _()      
     
             ,  0
        ,    
       ,  0
   _()  _()  / 
      :
        ARP ,    ()
          
      ARP 
   0
___() ­ /4/. (191)
        __   FS
__() ­ /4/. (18)
    ,  ,     
       ( )   :
     = ((&0F0F0F0F0)>>4)((&00F0F0F0F)<<4);
     = ^^;
     = ^(>>16);
     = (^(>>8)) & 0FF;
__() ­ /4/. (526)
       
Chapter 9
Dynamic Routing with routed
This chapter presents dynamic routing as perIormed by a router (as opposed to an end host computer). It
provides an overview oI how the routed program implements routing protocols under Linux, examines
how it modiIies the kernel routing tables, and summarizes the implementation code.
9.1 Overview
A normal host computer has very limited options Ior routing packets; a message is either Ior itselI or
another computer, and iI it is Ior another computer there are a very limited number oI options Ior sending
it on. Usually such a host needs only to put a packet out on a LAN Ior a ``gateway'' computer (router) to
pick up and send on its way. Linux usually does not maintain any metric (distance) inIormation about
routes, even though there are variables Ior storing it in the FIB. For simple end-host routing, the only
important question is ``can I get there Irom here'', not ``which way is best?''
However, a router must make decisions on where to send traIIic. There may be several routes to a
destination, and the router must select one (based on distance, measured in hops or some other metric such
as the nebulous quality oI service). The Routing InIormation Protocol (RIP) is a simple protocol that
allows routing computers to track the distance to various destinations and to share this inIormation
amongst themselves.
Using RIP, each node maintains a table that contains the distance Irom itselI to other networks and the
route along which it will send packets to that destination. Periodically the routers update each other; when
shorter routes becomes apparent, the node updates its table. Updates are simply RIP messages with the
destination address and metric components oI this table. See Figure 9.1 Ior a diagram oI an RIP routing
table and an RIP packet.
Figure 9.1: Routing InIormation Protocol packet and table.
9.2 How routed Works
routed is a widely available program Ior implementing RIP via UDP messages on POSIX computers. It is
essentially a stand-alone program which uses () calls to get inIormation Irom and update routing
tables on the host machine.
9.2.1 Data Structures
routed maintains two identical data tables - one Ior hosts and one Ior networks. Each is a hash table with
ROUTEHASHSIZ (32) buckets oI chains oI routing entries. The entries contain the RIP inIormation (but can
also line up with a   so that routed can pass them to the kernel through () calls).
Along with the basic destination, router, and metric inIormation the entries store Ilags, state, and timer
inIormation.
9.2.2 Initialization
When routed begins, it perIorms various initialization actions and calls () to get interIace
inIormation Irom the kernel. Next it sends out a RIP/UDP message requesting routing inIormation Irom
all neighboring routers. Finally it enters an inIinite loop in which it waits Ior traIIic or timers to make it do
something.
9.2.3 Normal Operations
When RIP messages arrive (via a UDP socket), routed parses them and either modiIies its table (Ior
response messages) or sends inIormation back to the requesting router (Ior requests). Sending inIormation
is simply a matter oI looking up a destination in its own table, putting that inIormation into a RIP packet,
and sending it out through a UDP socket. Updating its table may have no impact (iI there is no change or
the change makes no diIIerence) or it may result in a routing change. II the update reveals a shorter route
to a destination, routed will update its own table and then call () to update the kernel's routing
tables (the FIB).
When the update timer expires, every TIMER_RATE seconds, routed goes through every entry in both
tables and updates their timers. Entries which are out oI date are set to a distance oI inIinity
(HOPCNT_INFINITY) and entries which are too old are deleted (only Irom the RIP table, not Irom the
kernel's FIB). Finally, it sends an update to its neighboring routers. This update contains the new table
inIormation (response messages) Ior any entries which have changed since the last update.
routed leaves the actual routing to the normal kernel routing mechanisms; all it does is update the kernel's
tables based on inIormation Irom other routers and pass on its own routing inIormation. The updates then
change how the kernel routes packets, but routed itselI does not actually do any routing.
9.3 routed Functions
The Iollowing is an alphabetic list oI the routed program Iunctions that are most important to routing,
where they are in the source code, and what they do. The SOURCES directory shown represents the
directory that contains the source code Ior the given network Iile.
The routed source is available as a package separate Irom the kernel source (Red Hat Linux uses the rpm
package manager). The code below is Irom the netkit-routed-0.10 source code package, 8 March 1997.
This package is available Irom the www.redhat.com/apps/download web page; speciIically this came
Irom www.redhat.com/swt/src/netkit-routed-0.10.src.html. Once downloaded, root can install the package
with the Iollowing commands (starting Irom the directory with the package):
 ­ ­­0.10..
 ////SOURCES
  ­­0.10..
This creates a /usr/src/redhat/SOURCES/netkit-routed-0.10 directory and Iills it with the source code Ior
the routed program. This process should be similar (but is undoubtably not exactly the same) Ior other
Linux distributions.
() ­ SOURCES//. (88)
    UDP 
   (SIOCFIGCONF)    
    :
     ()   ,  , ,  
        
        
     ()      
      
   
() ­ SOURCES//. (298)
     :
       ()
         
     _()   (RIP) 
_() ­ SOURCES//. (60)
     
           
    RIP  (  0)
       ­ 
        :
         
           ,  ()
          ,     
           :
            
          ,      
        :
           
         
            :
          
          , ,   
           (        
              ,   HOPCNT_INFINITY )
         ()       
               :
            ()      
               ,  ()  
         ()      (  
            )
          
     :
        
        
>>>  () ­ SOURCES//. (78)
     
   ()   UDP 
     UDP   RIP  
         
    ,        ( )
   ()    
   ()     
   ()       
      ALRM,HUP,TERM,INT,USR1, USR2
     :
        ,    
     ()    
     ()    (  EINTR),  
     ()   (  )
         ()   
          
           ,  ()
() ­ SOURCES//. (138)
        
    _()     
        (  )
       _ 
   ()     
   ()      
    :
       ,   _()   
            
       ,    
() ­ SOURCES//. (207)
         
   ()   /  
() ­ SOURCES//. (100)
       
    ;      
       
       ,       
        _()   
    (0)   
() ­ SOURCES//. (336)
       ,     
       ,     
() ­ SOURCES//. (346)
       
      
   (SIOCADDRT  SIOCDELRT)    
     ()  ( ­1   )
() ­ SOURCES//. (65)
      
        
     ,     
        (0)
() ­ SOURCES//. (77)
       
      
() ­ SOURCES//. (91)
    RIP  
       
        
              
       ,        
            
() ­ SOURCES//. (56)
    
      
         
          
            
          
   ()    
() ­ SOURCES//. (55)
    :
           
       [()  ()]  
Chapter 10
Editing Linux Source Code
10.1 The Linux Source Tree
Linux source code is usually in the /usr/src directory (iI installed). There may be many versions in
diIIerent directory trees (such as linux-2.2.5 or linux-2.2.14). There should be one soIt link (linux) to the
most current version oI the code (i.e. linux linux-2.2.14).
This is an overview oI the Linux source directory structure (not all branches are shown:
/usr/src/linux/
arch - architecture speciIic code, by processor
i386 - code Ior Intel processors (including 486 and Pentium lines)
boot - location oI newly compiled kernels
drivers - code Ior drivers oI all sorts
block - block device drivers (e.g., hard drives)
cdrom - CD ROM device drivers
net - network device drivers
pci - PCI bus drivers
fs - code Ior diIIerent Iile systems (EXT2, MS-DOS, etc.)
include - header Iiles used throughout the code
asm asm-i386 - processor dependent headers
config - general conIiguration headers
linux - common headers
net - networking headers
kernel - code Ior the kernel speciIic routines
lib - code Ior errors, strings, and printI
mm - code Ior memory management
modules - object Iiles and reIerences Ior the kernel to load as required
net - code Ior networking
core - protocol independent code
ipv4 - code speciIic to IPv4
packet - protocol independent packet code
sched - code Ior scheduling network actions
10.2 Using EMACS Tags
The Linux source is obviously very large and spread throughout many Iiles. A TAGS Iile allows you to
quickly maneuver to a speciIic Iile in search oI a reIerence.
10.2.1 Referencing with TAGS
Inside a Iile, move the cursor to a keyword you would like to look up (e.g., ``sock''). Press ``ESC'' ``.'' -
EMACS will prompt Ior the tag to Iind (deIaulting to the word your cursor is on); hit ``ENTER''. The Iirst
time you use it, you will have to speciIy which TAGS Iile to use (e.g., /usr/src/TAGS). Next EMACS
will automatically open the appropriate Iile (e.g., /usr/src/linux/include/linux/sock.h) in a new buIIer and
put the cursor on the deIinition oI that struct, #deIine, or Iunction. II the deIinition it brings up is not the
one you were looking Ior, press ``CTRL-U'' ``ESC'' ``.'' to bring up alternate reIerences.
These tags work even as you make changes to the source Iiles, though they will run slower as more and
more changes are made. EMACS stores the tags in a Iile (deIaulted to TAGS) with each reIerence,
Iilename, and line number. II the tag is not at the stored line number, EMACS will search the Iile to Iind
the new location.
10.2.2 Constructing TAGS files
II you need to start Irom scratch, Iollow the steps below.
The command to make a tags Iile is:
filename
The command to append new inIormation onto a tags Iile is:
 ­ filename
These put the new tags into the Iile TAGS in the current directory. Filenames are stored as given, so
absolute reIerences will always reIer to the same Iiles while relative reIerences depend on the position oI
the TAGS Iile. (Read the man page Ior etags Ior more inIormation).
For example, to create a tags Iile Ior the ipv4 source Iiles, enter:
 /////4/*.
To add the header Iiles, enter:
 ­ /////*.
The TAGS Iile will now contain quick reIerences to all the C source code and header inIormation in those
directories.
10.3 Using vi tags
The vi editor also supports the use oI tags Iiles (and creates them with the gctags command, which works
almost exactly like the etags command shown above).
10.4 Rebuilding the Kernel
(See the Linux-kernel-HOWTO Ior more detailed instructions.)
This is a quick step-by-step guide to recompiling and installing a kernel Irom scratch.
1. Go to the top oI the source directory (/usr/src/linux). II there is not already a historical copy oI a
working .config Iile (such as the current one), MAKE ONE. Until you have enough experience
that you no longer need this guide, do not overwrite anything until you have made sure there is a
copy to which you can revert. (On the other hand, once you have a stable kernel version, there is
no reason to keep old ones around. Even a development system should probably only have an
original working version, a last known stable version, and a current version.
2. Run   (  and   also work, but xconIig is by Iar the
user-Iriendliest). ConIigure the system as desired; there is help available Ior most options. The
conIig Iile should deIault to the current settings, so you should only have to change the things you
want to add or take out. As a general rule, select ``Y'' Ior essential or Irequently used Ieatures (like
the ext2 Iile system), ``M'' Ior things that are sometimes useIul (like sound drivers), and ``N'' Ior
things that do not apply (like amateur radio support). II in doubt, consult the help text or include
something as a module.
3. Run   to make sure the options you heve selected will compile properly. This make take a
Iew minutes as the computer checks all oI the dependencies. II all goes well, the program will
simply exit; iI there is a problem, it will display error messages and stop.
4. Run   to remove old object Iiles IF you want to recompile everything. This obviously
will make the compilation process take longer.
5. Run  I to build the new kernel. ( I and   also build kernel
images, but the bzImage will compile into the most compact Iile. II you are using one oI these two
methods Ior some reason, you may get a ``kernel too big'' error when you run lilo - try again with a
I.) This will take quite some time, depending on available memory.
6. Run   to build any modules (not included in the main kernel image).
7. Rename the old modules iI necessary:
 ///2.2. ///2.2.­
(Note that you will not have to do this iI you are compiling a completely new version; the old ones
will still be in /lib/modules/2.2.xx when you build version 2.2.vv.)
8. Run  _ to install the new modules. You must do this even iI you built a
monolithic kernel (one with no modules). (Note that there may be a Red Hat module-info text Iile
or link in the boot directory; it is not terribly important and this does not update it.)
9. Copy the new kernel to the /boot directory and change the kernel link (usually vmlinu:):
 /386//I //­2.2.
 ­ //­2.2. //
10. Copy the new Svstem.map Iile to the /boot directory and change the map link:
 S. //S.­2.2.
 ­ //S.­2.2. //S.
11. Create a new initrd Iile iI there are any SCSI devices on the computer:
// //­2.2.. 2.2.
12. Edit the Iile /etc/lilo.conf to install the new kernel; copy the block Ior the old kernel
(=) and change the existing one to keep it as an option. For example, rename the
image to ­2.2.­ and change the label to . This way you can always reboot
to the current (presumably stable) kernel iI your changes cause problems.
13. Run // to install the new kernel as a boot option.
14. Reboot the computer with the new kernel.
15. II the new kernel does not work properly, boot the old kernel and reconIigure the system beIore
trying again.
10.5 Patching the Kernel Source
Linux is a constantly changing operating system; updates can be released every Iew months. There are
two ways to install a new kernel version: downloading the new source in its entirety or downloading
patches and applying them.
Downloading the entire source may be preIerable to guarantee everything works properly. To do so,
download the latest kernel source and install (untar) it. Note that this will (probably) be a complete
distribution, not a machine-speciIic one, and will contain a lot oI extra code. Much oI this can be deleted,
but the conIiguration MakeIiles rely on some Ior inIormation. II space is an issue, delete the *.c and *.h
Iiles in the non-i386 arch/ and include/asm-* directories, but tread lightly.
Downloading patches may be quicker to do, but is somewhat harder. Because oI distribution variations,
changes you have made, or other modiIications the patches may not quite work properly. You must apply
patch Iiles in order (to go Irom 2.2.12 to 2.2.14, Iirst apply patch 2.2.13 then apply 2.2.14). Nevertheless,
patches may be preIerable because they work on an existing directory tree.
Once you have downloaded a patch (and unzipped it, iI necessary), simply put it in the directory above
linux (e.g., /usr/src/) and run the patch program to install it:
 ­N0 ­ ­  < ­2.2. (where xx is the patch version)
The ­N option ignores patches that are already applied, and the ­0 assumes the patch wants to apply
itselI to a source in a linux directory. The ­  option puts all the patch rejects into one Iile
(reffile) - which may or may not be what you want to do. II you have not kept the entire source
distribution, you will have to skip many changes (Ior diIIerent processor architectures) by simply hitting
``ENTER'' at the ``patch which Iile'' and ``ignore patch'' prompts. Once you are comIortable with the
process, run it without the ­ and ­  options.
Once you have a new kernel version, Iollow the instructions on rebuilding the kernel to actually start
using it. You probably will not have to change any oI the conIigurations options, but you will almost
deIinitely want to run   to remove any old object Iiles.
Chapter 11
Linux Modules
This chapter presents the Linux module system. It provides an overview oI how modules work, describes
how to install and remove them, and presents an example program.
11.1 Overview
Linux kernels more recent than 2.0 can be (and usually) are modularized. There is a portion oI the kernel
that remains in memory constantly (the most Irequently used processes, such as the scheduler) but other
processes are only loaded when needed. An MS-DOS Iile system Ior reading disks, Ior example, might
be loaded only on mounting such a disk and then unloaded when no longer needed. This keeps the space
the kernel requires at any one time small while allowing it to do more and more. It is still possible to put
everything into one ``monolithic'' kernel that will not need modules, but that is usually done only Ior
special purpose machines (where all the required processes are known in advance).
Another advantage oI modules is that the kernel can load and unload them dynamically (and
automatically with the kerneld daemon). This means that a (super) user can load a module, test it, unload
it, and debug it repeatedly without having to reboot the computer. This document assumes that the user
has superuser access (you must be to install and remove modules) and the kernel is conIigured Ior
modules. (With a monolithic kernel, it is possible to set conIiguration options not to even allow modules.)
11.2 Writing, Installing, and Removing Modules
11.2.1 Writing Modules
Modules are just like any other programs except that they run in kernel space. As such, they must deIine
MODULE and include module.h and any other kernel header Iiles that deIine Iunctions or variables they use.
Modules can be quite simple (as the example shows) but they can also be quite complex, such as device
drivers and entire Iile systems.
This is the general module Iormat:
# MODULE
# </.>
/* ...     ...  */
/*
 *  ...     ...
 */
 _() 
  /*        */

 _() 
  /*        */

Modules that use the kernel source must be compiled with gcc with the option ­
I////; this ensures that the Iiles included will be Irom the proper source tree.
Note that not all kernel variables are exported Ior modules to use, even iI the code declares them to be
. The /proc/ksvms Iile or ksvms program display the exported symbols (not many oI which are
useIul Ior networking). Recent Linux kernels export both the symbol and its version number using the
EXPORT_SYMBOL() macro. For user created variables, use the EXPORT_SYMBOL_NOVERS() macro
instead or the linker will not retain the variable in the kernel symbol table. Module writers may also want
to use the EXPORT_NO_SYMBOLS macro; modules export all oI their variables by deIault.
11.2.2 Installing and Removing Modules
Installing and removing modules is as simple as calling a program with the name oI the compiled module.
(You must be a superuser to install or remove a module.)
The insmod program installs a module; it Iirst links the module with the kernel's exported symbol table to
resolve reIerences and then installs the code in kernel space.
// module¸name
The rmmod program removes an installed module and any reIerences that it has exported.
// module¸name
The lsmod program lists all the currently installed modules:
    //
    M       S  U 
           13368   0 () [­]
    359       19112   1 ()
11.3 Example
This is a complete example oI a very simple module.
simple¸module.c
/* _.
 *
 * T           
 *     L .  A        
 *           .
 *
 */
# MODULE
# </.>
/* .     */
# </.>
/*************************************************************** _
 *           */
 _() 
  ("<1>T     .\");
   0;
  /* _ */
/************************************************************ _
 *           */
 _() 
  ("<1>T     .\");
  /* _ */
This is the Makefile:
# M  _
CC =  ­I/////
CFLAGS = ­O2 ­D__KERNEL__ ­W
_.: _.
:
  // _
:
  // _
To use (must be ):

#  
#  
#  ///
... : T     .
... : T     .
Chapter 12
The proc File System
This chapter presents the virtual proc Iile system. It provides an overview oI how the Iile system works,
shows how the existing network code uses the system, and details how to write and use proc entries Irom
programs.
12.1 Overview
The proc Iile system is so named because it is Iound in the /proc directory on most Linux machines. NOT
including the proc FS is a conIiguration option, but the system is a powerIul tool oI which many
programs make Irequent use. While designed to appear as a Iile system with directory structures and
inodes, it is in Iact a construct oI registered Iunctions which provide inIormation about important
variables.
The proc directory has many subdirectories - one Ior each running process and others Ior subsystems such
as Iile systems, interIaces, terminals, and networking (/proc/net). There are also many Iiles in the main
/proc directory itselI - interrupts, ioports, loadavg, and version to name a Iew. Within each process
subdirectory (named Ior the process number) are Iiles that describe the process' command line, current
working directory, status, and so on.
The kernel traps proc Iile access and instead oI executing ``normal'' Iile operations on them calls special
(individually registered) Iunctions instead. When a Iile in the /proc directory is ``created'', it is registered
with a set oI Iunctions that tell the kernel what to do when the Iile is read Irom or written to. Most entries
only allow reads and they simply print out the state oI certain system variables Ior use by other programs
or Ior perusal by knowledgeable users.
The only tricky thing about using proc Iiles is that the kernel calls the inIormation generation Iunction
each and every time the Iile is read; subsequent reads oI a changing Iile without copying and buIIering the
results may yield very diIIerent results. The best way to use a proc Iile is to read it into a PAGE_SIZE-byte
buIIer. This will read the entire entry at once and the buIIer will then allow consistent random accesses.
12.2 Network proc Files
This is a list oI the most important Iiles in the /proc/net/ directory, what they contain, and a reIerence to
the Iunction and Iile that creates them. Note that there are many other interesting proc entries, such as the
/proc/svs Iiles, /proc/ksvms, and /proc/modules to name only a Iew.
arp
displays the neighbor table (_); the IP and hardware addresses, hardware type, device, and
Ilags. (__() : net/ipv4/arp.c 988)
dev
displays reception and transmission statistics Ior each registered interIace
dev_stat
displays number oI received packets dropped and throttle and FASTROUTE statistics
(__() : net/core/dev.c 1228)
netstat
displays sync cookie, pruning, and ICMP statistics (__() : net/ipv4/proc.c 355)
raw
displays address, queue, and timeout inIormation Ior each open RAW socket Irom  
_ (__() : net/ipv4/proc.c 165)
route
displays the FIB table (_); the interIace, address, gateway, Ilags, and usage inIormation.
(__()) : net/ipv4/fib¸frontend.c 109)
rt_cache
displays the routing cache (__); the interIace, address, gateway, usage, source, and
other inIormation. (___() : net/ipv4/route.c 191)
sockstat
displays number oI sockets that have been used and some statistics on how many were TCP, UDP,
and RAW (__() : net/ipv4/proc.c 244)
tcp
displays address, queue, and timeout inIormation Ior each open TCP socket Irom  
_ (__() : net/ipv4/proc.c 165)
udp
displays address, queue, and timeout inIormation Ior each open UDP socket Irom  
_ (__() : net/ipv4/proc.c 165)
12.3 Registering proc Files
This section describes the simplest method Ior registering a read-only proc ``Iile'' entry (available only in
Linux 2.0 and later releases). It is possible to create a more Iully Iunctional entry by deIining
_ and _ structures. However, that method is signiIicantly more
complicated than the one presented here; look in the source code Ior details on implementing Iully
Iunctional entry. The method described below - deIining a Iunction and then registering and unregistering
the Iunction - provides most oI the Iunctionality required Ior testing and tracking system resources. Only
the kernel can register a proc Iile; users can do so by building and installing kernel modules (though only
can install and remove modules). These procedures assume that the Linux source is installed and the
kernel is compiled to use modules.
12.3.1 Formatting a Function to Provide Information
  read¸proc¸function( *, **,_ , , )
This is the Iunction that the Linux kernel will call whenever it tries to read Irom the newly created proc
``Iile''. The only parameter that is usually signiIicant is - a pointer to the buIIer the kernel makes
available Ior storing inIormation. The others normally will not change. (read¸proc¸function is oI course
the name oI the new Iunction.)
Typically this Iunction prints out a header, iterates through a list or table printing its contents (using the
normal routine), and returns the length oI the resulting string. The only limitation is that the
buIIer () is at most PAGE_SIZE bytes (this is at least 4KB).
For an example oI this kind oI Iunction, look at the __() Iunction beginning on line 109
oI net/ipv4/fib¸frontend.c. This Iunction displays the contents oI the main FIB table.
12.3.2 Building a proc Entry
Because this is part oI the Iile system, the entry needs an inode. This is easily constructed using a
__:
# </_.>
 __ __ = 
   0,                     // _ ­   (0  )
   5,                     //   ­    
   "",               // 
   S_IFREG  S_IRUGO,     // 
   1,                     // 
   0,                     //  ­ 
   0,                     //  ­ 
   0,                     //  ­  
   NULL,                  //  ­   ( )
   &__    // _ ­    
                          //   !

The contents oI this block can be used as shown by simply replacing the , , and
__ Iields with the desired values. Note that many oI the kernel deIined entries have
predeIined inode numbers (like PROC_NET_ROUTE, part oI an enumeration deIined in
include/linux/proc¸fs.h.
For an example oI this kind oI entry, look at the ___() Iunction beginning on line 607 oI
net/ipv4/fib¸frontend.c. This Iunctions calls __() (described below) with a newly
created __ structure.
12.3.3 Registering a proc Entry
Once the read Iunction and the inode entry are ready, all that remains is to register the new ``Iile'' with the
proc system.
 _( __ *,  __ *)
 __( __ *)
is a pointer to the directory in which the entry belongs - &_ and _ (deIined in
include/proc¸fs.h) are probably the most useIul. is a pointer to the entry itselI, as created above.
These two Iunctions are identical except that __ automatically uses the /proc/net
directory. They return either 0 (success) or EAGAIN (iI there are no available inodes).
12.3.4 Unregistering a proc Entry
When an entry is no longer needed, it should be deleted by unregistering it.
 _( __ *, )
 __( )
is the proc directory in which the Iile resides, and is the inode number oI the Iile. (The inode is
available in the entry's  __._ Iield iI it is not a constant.) Again, these
Iunctions are identical except that __ automatically uses the /proc/net directory.
They return either 0 (success) or EINVAL (iI there is no such entry).
12.4 Example
This is a complete example oI a module that installs a simple proc entry.
simple¸entrv.c
/* _.
 *
 * T            
 *   / F S.  A       
 *     IP.
 */
# MODULE
# </.>
/* _.  __  /  */
# </_.>
/* .   _  */
# </.>
/************************************************************ __
 *      / FS       
 *      //_ ­       
 *    _'      */
 __( *, **,_ , , ) 
   = (,"S IP S:\IP F  ");
   (_.IF)
     += (+,"\");
  
     += (+,"\");
   += (+,"D TTL:  %\",_.IDTTL);
   += (+,"F C: %\",_.IFC);
  /*    .... */
   ;
  /* __ */
/**************************************************************** _
 *           / FS;  
 *    FS     ,   ""  ,  
 *                */
 __ _ = 
  0,                     /* _ ­   (0  )  */
  12,                    /*  ­              */
  "_",        /*                                     */
  S_IFREG  S_IRUGO,     /*                                     */
  1,                     /*                                   */
  0,                     /*  ­                              */
  0,                     /*  ­                              */
  0,                     /*  ­                           */
  NULL,                  /*  ­   ( )    */
  &__         /* _ ­        */
                         /*   !                       */
;
/*************************************************************** _
 *     ;      
 *     / FS  */
 _() 
  /*       FS */
    = _(&_,&_);
  /*        */
   (!)
    ("<1> _:    %.\",
          _._);
  
    ("<1> _:  ,  %.\",);
   ;
  /* _ */
/************************************************************ _
 *     ;     
 *      / FS  */
 _() 
  /*       FS */
    = _(&_,_._);
  /*        */
   (!)
    ("<1> _:   %.\",
          _._);
  
    ("<1> _:  ,  %.\",);
  /* _ */
This is the Makefile:
# M  _
CC =  ­I////
CFLAGS = ­O2 ­D__KERNEL__ ­W
_.: _.
:
  // _
:
  // _
To use (must be ):

#  
#  //_
S IP S:
IP F  
D TTL:  64
F C: 0
#  
#  ///
... : _:    4365.
... : _:   4365.
Chapter 13
Example - Packet Dropper
This sample experiment inserts a routine into the kernel that selectively drops packets to a given host. It
discusses the placement oI the code, outlines the data Irom an actual trial, presents a lightweight analysis
oI the results, and includes the code itselI.
13.1 Overview
This program is implemented as a module that, while installed, compares each outgoing packet's
destination address to a given target. II they match, it randomly drops a percentage oI those packets. It
does this Ior all IP traIIic, no matter where it was generated and what transport protocol it uses.
Implementing this requires a modiIication to the kernel (to allow a module access to the transmission
Iunctions) and a module that takes advantage oI that modiIication.
13.2 Considerations
Code Placement
This code could be built directly into the kernel or it could be designed as a module:
Kernel - this is conceptually much simpler; simply adding some code to the kernel is a Iairly
easy matter. However, it makes semi-permanent changes and takes a long time to debug,
since the entire kernel must be recompiled, installed, and rebooted Ior every change.
Module - this is much saIer and easier since the (super) user can install, remove, and debug
modules quite painlessly. However, it requires access to the kernel that is not always
available - even Irom a module. The kernel does not always export the variables that a
module may need to access. (See the discussion on the ksvms program in Chapter 11.)
Both - this is the best method; by perIorming a Iew minor modiIications to the kernel code to
export necessary variables and make use oI a module only iI it is loaded, a user can
recompile the kernel once and then perIorm tests and experiments with modules. This still
has the disadvantage oI opening potential security holes on a system, but since only the
experimenter knows how they are implemented, this is a minimal risk.
Protocol Level
This code could be implemented at many levels:
Device Driver - this is a possibility since all traIIic comes through the device. However, this
breaks the layering protocols and requires hacking a (presumably) stable hardware driver.
Generic Device Functions - this is the best choice, since this is the lowest level through
which all traIIic travels (speciIically the __() and _() Iunctions). It
still violates the protocol layering, but all oI the modiIications can be made in one section oI
code.
IP Protocol - this is conceptually the right place to insert a special Iunction, either in the input,
routing, or output routines. However, this is unsuitable precisely because there are three
diIIerent routines in the implementation that a packet might go through - _()
(Iorwarded packets), __() (TCP packets), or __() (UDP
packets). See the coding sections in Chapters 5 and 7 to see how these routines interact.
These Iunctions would be a good choice Ior inserting a special-purpose dropper, but not one
that aIIects all traIIic.
Transport Protocol - these routines would be appropriate Ior aIIecting speciIic traIIic types
(such as UDP only) but are not useIul Ior this example.
13.3 Experimental Systems and Benchmarks
This example was implemented on two computers that are connected through a single router as shown in
Figure 13.1; the router runs the modiIed kernel and packet dropper module. In the general example, this
represents traIIic Ilowing between and , with / dropping packets Ior .
Figure 13.1: Experimental system setup.
The switch is a Cisco Catalyst 2900 set up with Virtual LANs (VLANs) Ior each ``subnetwork'' (one Ior
the source computer and one Ior the destination computer, with the routing computer acting as the router
between the two. The switch operates entirely on the link level and is essentially invisible Ior routing
purposes.
The routing computer (/) is a Dell Optiplex GX1 with a Pentium II/350 processor and 128M
oI RAM. It has three 3Com 3c59x Ethernet cards with 10Mbps connections to the switch.
One host computer () is an AST Premmia GX with a Pentium/100 processor and 32M oI RAM. It
has an AMD Lance Ethernet card with a 10Mbps connection to the switch.
The other host computer () is a Dell Optiplex XL590 with a Pentium/90 processor and 32M oI
RAM. It has a 3Com 3c509 Ethernet card with a 10Mbps connection to the switch.
All computers have the Red Hat 6.1 distribution oI Linux; the source and destination computers have
standard recompiled version 2.2.14 kernels, while the router uses either a standard (2.2.14) kernel or a
slightly modiIied one as indicated.
The Iirst benchmark is a ``ping-pong'' test that establishes a TCP connection and then repeatedly sends
packets back and Iorth. It returns a total transmission time (Irom start to Iinish, not including making and
closing the connection); dividing the time by the number oI iterations yields an average Round Trip Time
(RTT). This test was run with 20,000 iterations oI 5 byte packets and 5,000 iterations oI 500 byte packets.
The second benchmark is a ``blast'' test that establishes a TCP connection and then sends data Irom a
source to a destination. It returns a total transmission time (Irom start to Iinish, not including making and
closing the connection); multiplying the number oI packets by the size oI the packets and dividing by the
time yields the throughput. This test was run with 50,000 5 byte packets, 5,000 500 byte packets, and
1,000 1500 byte packets.
The benchmarks were run on both machines (i.e., Irom to and Irom to ), but in
both cases only packets to were dropped. In each trial the blast test was run once with deIault
settings (100 packets oI 1 byte each) beIore running the perIormance tests ``Ior record'' to ensure that the
routing cache and any protocol tables were in a normalized state. The complete suite was run ten times to
capture variations between trials (the averages are presented here). None oI the machines (including the
router) were running any other user programs beyond a login shell and the appropriate module, client, or
server programs (not even X Windows).
13.4 Results and Preliminary Analysis
13.4.1 Standard Kernel
These are the reIerence standards; these routines were run with the two computers directly connected
(NOT routed) and while the router had an unmodiIied Linux 2.2.14 kernel. The error rate on such a direct
connection is near zero.
ping-pong
                           M T ()     A RTT ()
               D R   20K@5    5K@500         20K@5    5K@500
D ­
   :   ­­­      17.24     28.98          0.86     5.80
   :   ­­­      17.20     28.99          0.86     5.80
R ­
   :  (0.0%)    24.53     48.59          1.23     9.72
   :  (0.0%)    24.36     48.46          1.22     9.69
blast
                               M T ()       T (M/)
               D R   50K*5  10K*500  1K*1500   50K*5  10K*500  1K*1500
D ­
   :   ­­­       0.56    3.19     1.89     3.55    6.26    6.36
   :   ­­­       0.78    3.03     1.77     2.58    6.61    6.76
R ­
   :  (0.0%)     0.56    3.19     1.92     3.60    6.27    6.26
   :  (0.0%)     0.77    3.19     1.93     2.60    6.27    6.23
13.4.2 Modified Kernel Dropping Packets
These are the experimental results. The drop rate oI 0.0° provides a reIerence Ior measuring the overhead
oI calling the test and random Iunctions without dropping any packets.
ping-pong
                           M T ()     A RTT ()
               D R   20K@5    5K@500         20K@5    5K@500
  :    0.0%     25.55     49.12          1.28     9.82
                  0.1%     29.87     51.11          1.49    10.22
                  0.5%     44.78     58.07          2.24    11.61
                  1.0%     65.37     68.77          3.27    13.75
                  5.0%    245.51    160.09         12.28    32.02
                 10.0%    506.03    290.77         25.30    58.15
  :    0.0%     25.53     49.21          1.28     9.84
                  0.1%     29.08     50.92          1.45    10.18
                  0.5%     45.87     59.21          2.29    11.84
                  1.0%     66.19     68.66          3.31    13.73
                  5.0%    235.68    156.94         11.78    31.39
                 10.0%    519.61    297.02         25.98    59.40
blast
                               M T ()       T (M/)
               D R   50K*5  10K*500  1K*1500   50K*5  10K*500  1K*1500
  :    0.0%      0.55    3.19     1.91     3.64    6.26    6.27
                  0.1%      0.55    3.07     1.93     3.62    6.51    6.21
                  0.5%      0.55    2.95     1.76     3.64    6.77    6.82
                  1.0%      0.55    2.87     1.75     3.65    6.96    6.87
                  2.5%      0.59    3.36     2.04     3.38    5.59    5.90
                  5.0%      0.63    4.63     2.71     3.19    4.31    4.43
                 10.0%      1.06    7.08     5.11     1.89    2.83    2.35
                 20.0%      3.43   30.35    18.55     0.58    0.66    0.65
  :    0.0%      0.79    3.21     1.93     2.53    6.23    6.23
                  0.1%      0.77    3.22     1.89     2.59    6.20    6.35
                  0.5%      0.80    3.24     1.88     2.51    6.17    6.39
                  1.0%      0.77    3.24     1.91     2.60    6.17    6.27
                  2.5%      0.79    3.17     1.90     2.53    6.31    6.33
                  5.0%      0.78    3.17     1.91     2.57    6.31    6.29
                 10.0%      0.81    3.85     2.51     2.48    5.20    4.78
                 20.0%      2.02    4.06     2.51     0.99    4.92    4.78
13.4.3 Preliminary Analysis
What Iollows is an elementary examination oI the results. It is NOT intended as an exhaustive analysis,
and indeed the experiment was not extensive enough to provide hard data Irom which to draw deIinite
conclusions. However, this does demonstrate the multitude oI Iactors involved and the eIIects that a Iew
lines oI code can have on a network. Further analysis, iI desired, is leIt as an exercise Ior the reader.
Figure 13.2: Ping-pong benchmark results.
Figure 13.3: Blast benchmark results.
The kernel modiIications and module insertion had a small but measurable impact on a TCP connection
(measured by the increased RTT). For very small packets, this diIIerence was approximately 0.05 msec;
Ior large packets it was 0.10 msec. Why should there be a diIIerence? Note that the direction oI travel and
packet size made a large diIIerence on the throughput. This is an indication that processor speed and
layering overhead are aIIecting the RTT; Ior a 1500 byte packet, 66 bytes oI wrappers (20 Ior TCP, 20
Ior IP, and at least 26 Ior Ethernet) are not very signiIicant - but Ior a 5 byte packet, that overhead is very
large. Assume that the actual ``cost'' oI inserting the module the delay Ior the larger packets, 0.10 msec.
Dropping packets Irom a TCP connection resulted in a Iairly linear drop in perIormance on the ping-pong
test; see the graph in Figure 13.2. This is as expected; when either a packet or acknowledgement is lost,
the sender pauses and then sends again. The RTT is also very close (certainly within the expected
experimental error) no matter which machine is the ``source''; again this is because the benchmark tests
the behavior oI both machines at the same time.
At low packet sizes, the throughput was very diIIerent depending on which way data was sent. This is
because one machine () was slower than the other. For a large number oI very small packets, the
chokepoint in the network is not the medium or the interIace, but the speed at which the processor can
build and send packets. However, Ior larger packet sizes, the throughput (Ior low error rate) Ior both
sources is similar; in this case the network is the limiting Iactor, not the processor.
The most surprising result is the apparent peak in throughput when the loss rate is approximately 1° -
better even than no loss at all (Ior blasted data; loss oI ACKs sent Irom the receiver to the source had little
impact). This is a very counter-intuitive Iinding; why should losing packets speed up the throughput? A
1° error might be just enough to prevent a TCP exponential back-oII algorithm Irom slowing the traIIic
rate. The immediate ACK that the receiver sends when an out-oI-sequence packet arrives might include
window size inIormation that keeps the sender Irom pausing. Interrupts caused by out-oI-sequence
packets might result in the scheduler running the benchmark process more Irequently, emptying the buIIer
window and again keeping the sender Irom pausing. There are many potential causes; determining the
real one would take much more study - but would be very interesting.
13.5 Code
13.5.1 Kernel
The Iollowing code adds a trapdoor to the kernel. It creates a Iunction that will be called (iI it exists) Irom
within the __() Iunction and exports it so that modules will be able to use it. These lines
are added directly to the source code; the kernel then has to be recompiled. installed, and booted. Note
that the kernel still Iunctions normally (albeit with one extra comparison) while no test module is installed.
net/core/dev.c (aIter line 579)
...
 *_( _ *)=0;                  /*  */
 __( _ *)...
    ... Q  *;
     (_ && (*_)())         /*  */
        _();                                  /*  */
         0;                                        /*  */
                                                        /*  */
# CONFIG_NET_PROFILE...
net/netsvms.c (aIter line 544)
...
  (*_)( _ *);           /*  */
EXPORT_SYMBOL_NOVERS(_);                     /*  */
EXPORT_SYMBOL(_);...
13.5.2 Module
The Iollowing is the code Ior the packet dropping module itselI. On installation, it calculates a percentage
cut-oII and puts an address into the Iunction pointer deIined above. From then on, any packets sent
through __() will also pass through the _ Iunction, which compares the
destination address to a hard coded one. II they match and a random number comes up below the
calculated cut-oII, it drops the packet; otherwise the packets pass through untouched. When the module is
removed, it resets the Iunction pointer to 0 () again. (Note that this not very robust code depends on
two byte short integers Ior simplicity. The Iunction __() is only accessible to the kernel
- or modules, oI course - and provides random numbers that are ``merely cryptographically strong''.)
packet¸dropper.c
/* _.
 *
 * T            
 *             
 *   (­) .
 *
 * S ///.    __().
 *
 * U (    ):
 *   // _
 *   // _
 */
# MODULE
# MAX_UNSIGNED_SHORT 65535
# </.>
# </.>  /*   _ */
# </.>      /*    */
  (*_)( _ *);       /*   */
  __( *,  ); /*   */
  ;                               /*   */
    = 0.050;                                /*   */
__32  = 0220010AC;                           /* 172.16.0.34 */
/************************************************************ _
 *    __        */
 _( _ *) 
    ;
   (­>.­> == ) 
    __(&,2);
     ( <= )  1;    /*    */
  
   0;                       /*     */
  /* _ */
/*************************************************************** _
 *           */
 _() 
  EXPORT_NO_SYMBOLS;
   =  * MAX_UNSIGNED_SHORT;
  _ = _;
  ("<1> _:   \");
   0;
  /* _ */
/************************************************************ _
 *          */
 _() 
  _ = 0;
  ("<1> _: \");
  /* _ */
Chapter 14
Additional Resources
14.1 Internet Sites
Linux Documentation Project
http://metalab.unc.edu/mdw/index.html
Linux Headquarters
http://www.linuxhq.com
Linux HOWTOs
Itp://metalab.unc.edu/pub/Linux/docs/HOWTO
Linux Kernel Hackers' Guide
http://metalab.unc.edu/mdw/LDP/khg/HyperNews/get/khg.html
Linux Router Project
http://www.linuxrouter.org
New TTCP
http://users.leo.org/bartel
Red Hat Software
http://www.redhat.com
Requests for Comment
http://www.rIc-editor.org/isi.html
14.2 Books
Computer Networks
Tanenbaum, Andrew, Prentice-Hall Inc., Upper Saddle River, NJ, 1996.
High Speed Networks
Stallings, William, Prentice-Hall Inc., Upper Saddle River, NJ, 1998.
Linux Core Kernel Commentary
Maxwell, Scott, CoriolisOpen Press, Scottsdale, AZ, 1999.
Linux Device Drivers
Rubini, Alessandro, O'Reilly & Associates, Inc., Sebastopol, CA, 1998.
Linux Kernel Internals
Beck, Michael, et al., Addison-Wesley, Harlow, England, 1997.
Running Linux
Welsh, Matt, Dalheimer, Matthias, and KauIman, Lar, O'Reilly & Associates, Inc., Sebastopol,
CA, 1999.
Unix Network Programming, Vol. 1 (2d Ed.)
Stevens, W. Richard, Prentice-Hall Inc., Upper Saddle River, NJ, 1998.
Chapter 15
Acronyms
ARP
Address Resolution Protocol
ATM
Asynchronous TransIer Mode (a protocol)
BSD
Berkeley SoItware Distribution
DHCP
Dynamic Hardware ConIiguration Protocol
DNS
Domain Name Server
FIB
Forwarding InIormation Base
GUI
Graphical User InterIace
ICMP
Internet Control Message Protocol
INET
Internet
IP
Internet Protocol
ISP
Internet Service Provider
LAN
Local Area Network
LDP
Linux Documentation Project
lo
Loopback (device or interIace)
MTU
Maximum TransIer Unit
PPP
Point-to-Point Protocol
RARP
Reverse Address Resolution Protocol
RIP
Routing InIormation Protocol
RTT
Round Trip Time
TCP
Transmission Control Protocol
UDP
User Datagram Protocol
UNH
University oI New Hampshire
VLAN
Virtual Local Area Network
WAN
Wide Area Network
File translated Irom T
E
X by T
T
H, version 2.70.
On 31 May 2000, 23:35.

        3.3.1  H  C         3.3.2  H  C      LAN         3.3.3  N  R  C     3.4  L    N  P  F         3.4.1  ifconfig         3.4.2   o e 4  C     4.1  O     4.2  S  S     4.3  S    R     4.4  C  P         4.4.1  E  C         4.4.2  S  C  W ­T         4.4.3  C  C  W ­T         4.4.4  C  C         4.4.5  C  W ­T     4.5  L  F 5  S  M     5.1  O     5.2  S  W ­T         5.2.1  W      S         5.2.2  C    P    UDP         5.2.3  C    P    TCP         5.2.4  W    P    IP         5.2.5  T    P     5.3  L  F 6  R  M     6.1  O     6.2  R  W ­T         6.2.1  R      S  (P  I)         6.2.2  R    P         6.2.3  R    N   B  H         6.2.4  U    P    IP         6.2.5  A    P    UDP         6.2.6  A    P    TCP         6.2.7  R      S  (P  II)     6.3  L  F 7  IP F     7.1  O     7.2  IP F  W ­T         7.2.1  R    P         7.2.2  R    N   B  H         7.2.3  E    P    IP         7.2.4  F    P    IP         7.2.5  T    P     7.3  L  F 8  B  I  P  R     8.1  O

''

''

    8.2  R  T         8.2.1  T  N  T         8.2.2  T  F  I  B         8.2.3  T  R  C         8.2.4  U  R  I     8.3  L  F 9  D  R     o ed     9.1  O     9.2  H   o ed W         9.2.1  D  S         9.2.2  I         9.2.3  N  O     9.3   o ed F 10  E  L  S  C     10.1  T  L  S  T     10.2  U  EMACS T         10.2.1  R    TAGS         10.2.2  C  TAGS      10.3  U         10.4  R    K     10.5  P    K  S 11  L  M     11.1  O     11.2  W , I ,   R  M         11.2.1  W  M         11.2.2  I    R  M     11.3  E 12  T  p oc F  S     12.1  O     12.2  N  p oc F     12.3  R  p oc F         12.3.1  F    F    P  I         12.3.2  B    p oc E         12.3.3  R    p oc E         12.3.4  U    p oc E     12.4  E 13  E  ­ P  D     13.1  O     13.2  C     13.3  E  S    B     13.4  R    P  A         13.4.1  S  K         13.4.2  M  K  D  P         13.4.3  P  A     13.5  C         13.5.1  K         13.5.2  M 14  A  R

 U               .                         S          D      L             )            . T            I   . I            TCP/UDP.   .0      .   M  31.                                  .2.            .2  B 15  A  S C I T      1   1.          . T      L   .      . T              L  2. I             . . IP.    14.      ­               .            . I                (       .                            . 1.2.   .     L      2.              .1  I     14.                         ;            B T H                             )                  .    .   E  ­                       L   .15)                 R  H  6.   .                                                            .        . I                   .  .14   (    2.       (!)      . I     .                     C           .        . 2000. L       ­               .1                           .     A     .        .                                  .    .1  B L     ( T       :    . S                                    L     HOW­TO ''           L             A                     . I          L    N   .14.         /p oc            . F     .2.

   (                               ;    .       lan ed      )  . .               .      C                                          .1.2  D I        A        C     . F      1.                             .1: S     .   F  1.1.      i alic  .   E                                    F .3  S T          N   .    F   C G     1. T                           . S              L               .

 L  D .    . . T          T1   T3  . .       I         . B  I         .  .                       U  (U!).T   (       ­ . T                (     ''   ( .  2.                 (           ) .d/nggern (T   C 1.o g/COPYRIGHT. T          D                   :             L  PN I  .  .n.                 '                          '  . M      B                    .suheucr/hri.             .).           .  .). T        (       )           C                 . T               .  .                      .  . .4  C C  ( ) 2000        C   ht:/ tp/ .            .    (       )    .5  A I               M '       C  S  D     .  P T : M T   A T   T                 .     .  . I       ).  4.  .            ( .  : !)         .   . c. . .  5. T        LAN     D       /   .  .  3. L  G      H   . H    IP            )   C  S       T 1.              P  (LDP) L   h p:// T T         . A                     . U       1.   ( .          )                    :         L   .               .h ml                                  LDP.                       ( .     .lin doc.      E                      B ).      ..  .

         UNH. I         P  P                                    11           T      ­      .  . . V  1.1  T  N T  I  P                      T  P .U  P   U G M P  S    N  R  A  H  B . U  S  D @ . 2. .  A    R . I            IP    .0 C M T     .  H . T  IP            .   2   T          O            L   . S  F      L   .        .1       L  (    (     )   ATM) ­ IP               (IP)           L        ­                      . W        2. I                    .          .

  .            W                      IP                .      .      .                         E     .      IP    .             (IP).                (TCP   UDP)         .1: A        L       . I          2.    )  . I                    (           . I   . I                                               .   .F W                        F                           '                  . I    IP  .       I  B  (FIB).                  .    A .

    . . T         .                   TCP             INET S                 . I               . . S  C    3    2. T .            .               2. O                                   E IP S  UDP            .        (     . I                    S                         '                     R    I         .    ;                       BSD  .            ;          .3  P T   T (                S                                                               ;      ).         '      . I               . I   .               .  .  BSD S    BSD   4    . T             . S     ­             ;          . 2.      G C A    INET  .2).      .      (                     .                                   . H . UDP            .                            . A    INET      ;           (RIP ­   C  9).    _  ­ F     .    .                                 P               .     .            .2  T  P N E         IP                  TCP      )    .      .

                                        . W           . I                     .F T     .               (E ) ­  .0   24                                ).2: P  ( _ )        .               (                FIB.          ;   F    ­       I     T  IP      B  (FIB)                    T  FIB          ;            .    . T               .  .  2.   (IP).           IP  '           32   (            IP  )                           255.0.4  I  R                   . I          256  .    . A         .  ­    . T    /p oc/ne / o e              . W  IP      .255.0.0   8         255.255. T       . (T   .)              ­    .    2.                 24. E              ­   (TCP/UDP). E                  ­             8.

      .                      .1    3. I    R     .                    .      .      .1  O L L         .                              '     (    E   ).              ifconfig  . T                         .2  S W  L   '   (             )        . (I   . A     .      H '  C  P  ­    A         .        o e      3. T                                 . E                (         . I           .  . (T                             ;          .                     I ). I       .        .                     (                   .               ini       . I                    (           .          . T    /p oc/ne / _cache          .                              ).               .                            ;   8     RIP)    (  ) .) T   . S C N T L       .                              .         3   I                 .    .                         .)  L ;      .               R  H  L  6.  . I          (                                    D  H  C . (A   ­ .        . T C   .               GUI   ­              .     (DHCP)              .                    IP            .   DNS            .) W       T             . IP      .     FIB   FIB  .     NOT      T     P .     ) .

 (I       .                         (   . T     : E       .   ­      .   R  H   .            . (N       3. F .      _                      IP /ifcfg­e h0  )                .d/ini .             (IP)  . T       :     DVC   IAD   $ EIE $ PDR (                                     ;                   ­             ).)               .1  T  N T      I        S                         .                     .d/ne o k).  .)    /e c/ c.d/ini .                 (      /e c/ config/ne o k   /e c/ config/ne o k­ c ip    (    GUI          ).          0   L     .      . I                     . U      H  W                         ;       (       . (T   . T  ifconfig          ): T     .2.2  ifconfig T  ifconfig                    .d   R  H   ).         (         )    . (S 3.    .  /e c/ c. W                                   ;                    .                                  .    ):    0C:E7:E2 0:14:D9:5 .        ( .   L                       .                .d/ne o k                         /e c/ config/ne o k­ c ip /if p      . W                             .2. T    (/e c/ c. D  (   ) IP     IP  .)              DHCP           ifconfig        T   ( )                                          H .(/e c/ini ab)        S  3.) I                         .   FIB        . T                               .    o e  . T  ifconfig                NAK  $ MS   BAT $ CS   . F   .3              . T .

607 1  IP                    .. 5 .   N   )            3. 5 .5.          0  0 2...5. .        0  0 7.3  route T   o e  B  (FIB).5 M :5...2.610         2525250 U  0        0 17000  *       5...5.        ;                     F     ­  I       ­   ­   NTOK  $ EWR   NAK  $ MS   IAD   DVC $ PDR $ EIE   D V C  ­ $ EIE (                        (          (                 ):       ).  *       5.5 H     0  0 7..          25000   U  0                 .        ).5.. .6125  121.611  121.614         25252525U  0        0 121.5. )          T   o e      T   ):    K  IP     (  FIB... F    (   K  P I    D     G     G                F   M       R U I 121. 2525250    U RACS UNN UTCS MU10 M    PBODATRNIGMLIAT T:50  : 1    R     X :806 391  :63  154 :  0 :  0 :42 252    T     X :085 404  :  0 :  0 :  0 : 0         :  0 :0 10    I     :1B   1  : 0 0 0 A       ifconfig                ;        :  in e face [af pe] op ion  | add e  .  ­    2525250    00 2 0  ­        1 1 2 1 ..          :7..          (  ­  0    ­  0 ­  ­            0                   .  *       5. T   :                       .                          0   1      ­  :     0   1  ARP    0  ARP    0 0     5 .  ­       7. B :7. F         ...   0000    U  0        0   .5.     G     0  0 A          o e         IP          ;          :  [­ne |­ho ]  a ge  [op ion a g] .

              .5. (I    E       .            ­   config/ne o k­ c ip /ifcfg­lo DVC= EIE .      1  ­  .   [­ne |­ho ]  a ge  [op ion a g]   :  2.   P                                         o ed   ga ed..2.                           .  2525250      ­                       1 2 1 .5.    3.1  H T   T         /e c/     .611 (N           ­         7 . I              ( ) IP                   ..610 171. T                                               .610 121.    ;        o ed.)            I .4  D I           R           .. (T                           . (T      C            (                                                     ;       ( ).            .)         )  . .      .   7.. S   ­                           .              ­   ­         )         0  ­   5.       .  ONBOOT  M     /e c/   .6 3. A       )    . 3. 6 7. T   config/ne o k NTOKN= EWRIG FRADIV= OWR_P4 HSNM= OTAE GTWY AEA= .3.. T      (                L           .3  E T         .) S  C  9      . 6 1 1  ­  121. T                                           .                         .                    .  .

614 PDR121.. config/ne o k NTOKN= EWRIG FRADIV= OWR_P4 HSNM= OTAE .610 BAT121.    .. OANAE GTWY121.5 CS=7. BAT17252525 CS=2..IAD=2.5.3. NTOK17000 EWR=2.. 3. config/ne o k­ c ip /ifcfg­e h0 DVC= 0 EIE IAD=7.           LAN (               . T          IP  .         ). T                LAN)...                    DNS   ifconfig             I                    ifcfg­ppp    . T     /e c/   .5. I      ifconfig p og am         (G T W Y A E A )                         ARP        )    . PDR17001 NAK25000 MS=5.. DMINM= .. NAK2525250 MS=5.  .5. F   ..5.2  H T   . .       . H       .6125 OBO= NOT BOPOO OTRT= A   (                   ..611 GTWYE= 0 AEADV A                       .3  N  R  C .5 OBO= NOT NM= AE BOPOO OTRT= A                       .   S   . T         /e c/        C                                  LAN   .       ISP. AEA=7. NTOK121..     E               . I                                 ­     .3. T                       ;           I  (      LAN;                         E                                   .    P           .              o e           /e c/ config/ a ic­ o e  file.. T 3. EWR=7.            .

.5.     E         ..       ).            ''     /p oc/ne /ip 4/ip_fo a d  . IP F           . NTOK121.          o e   /e c/ config/ a ic­ .5..) A       .5.601 GTWYE= 1 AEADV /e c/ A           . EWR=7. (O                 1>/ / / 4 _ /    F R A D I V     OWR_P4 . config/ne o k NTOKN= EWRIG FRADIV= OWR_P4 HSNM= OTAE . I        ifconfig           (G T W Y A E A )            .5 CS=7. C      LAN                 I            (     ).        IP  .600 BAT121.611 PDR121.610 BAT121.    T                               ;       E       .5.6125 OBO= NOT BOPOO OTRT= /e c/ config/ne o k­ c ip /ifcfg­e h1 DVC= 1 EIE IAD=7. T     .  .                      1          ;     (       .62525 OBO= NOT A   (                 . F       . NAK2525250 MS=5. T         /           ..607 PDR121. NAK252500 MS=5. AEA=7.5 CS=7. (N                                BOOTPROTO          . O              (WAN)       I  (   )               (LAN).      . T                       )             (       ).) T                            I  (                   )..                              o e  file.             I .T     .. EWR=7. 3.       /e c/ config/ne o k­ c ip /ifcfg­e h0 DVC= 0 EIE IAD=7.4  L    N  P  F . T . NTOK121..                      .. OANAE GTWY121. DMINM=.

 38 (9)             ( )                              NT   IE        .                          .     . .53    o e   (   ).T           T T                      L   . T  SOURCES      .                         L   . 85 (5)           .4. 48 (7)          (           )                     _ (    )                                     . edha .                             0         >> >    (  ORE/ )­SUCS . .     pm  1999. T       . 29 A .MU   T.         (  )   _ (  ORE/ )­SUCS . T       )     L   .2  route .         .     _ (] )     (  )­          = [  _ (] ) 3.1  ifconfig _ (   / 4 )­ / .31 15­.                    .3 15.                                              . T                (R  H  L      ne ­ ool ­1.com/app /do nload    .  oo ):         ). /ORE SUCS ­. O      (                 ­ ­   / / /     ­ ­. 11 (2)       _ (    )     ) (      (       _ (    )                   _         (  ORE/ / )­SUCS   / / /       _ (    ) (   )­          ()     )       . . 38 (3)     .   .              (                 3. 21 (6)                  _        [     / 4 _ / . T   ifconfig       / / c/ edha /SOURCES/ne ­ ool ­1.53­1      .4.                 (      )       _ (  ORE/ / )­SUCS                     .

    _ ( )               .          AH    CCE     .     _ .  . 7) (2               ) (  )  =IE_ [ NT )      (] )      (] ) C C T      4        . 16 (0)                                       (                           )           (                            .   . I               .       .   . 6) (9               ) (  )  =IE_ [ NT .      (     .                _             _             (  ORE/ / )­SUCS   _ (    )       (         (  ORE/ / )­SUCS   _ (    )       (         . 42 (4)   _ ( )       /   _ ( )       / / / / / _ ) ) IE_ NT (  ORE )­SUC/ / _ .           _ (  )                   .   .      (     .IE_ NT (  ORE/ )­SUCS           (      NT IE_ ( ) /   _ . 35 (0)           ) IE_ NT (  ORE/ / )­SUCS      I    FB     . 26 (4)                     (] ) _ _                                             (   / 4 )­ /        :   _ _ (  )     ­ _ >      _ _ (  )     ­ _ >      0   (   )       (  )     >> >    (  ORE/ )­SUCS . 5) (7                                             .                                  (  )                         0 (   )­             _         (  )  = _ _ [  .

*         _   *     _ _        ­  _ '      _   _ _ 3  _ 2   _   ).h.            .     .1  O T             .   *      L :   BSD       INET               ­    . _  ­            )                          ­>              _4 _ _ ; _    ­ TCP        .               _  ­                . N          ­          ­ .                    '  .2  S T   BSD  BSD           S                           _       ;   BSD  . _      IP     INET     INET                . . )          .  (         . T              ­                          .              . W           )   IP        .      4.   .     .   . T    ­    .    . F         *     . O     . T   .h.    BSD  .                  . INET              .   (  )  (   . _ .          .   (     .        . I  L . T            incl de/lin / ocke .             .                ­>      _ (  )       c  inode *inode ­       ­  * INET    ;                                                  :   *            incl de/ne / ock.  _     . BSD              .                            4.            ). F       . W              (                                        ­              .         ;           ­        *    (I _        ­  . F      INET        .                    .

                                      .SC_TEM ) A_NT OKSRA.             ­    ( .  _     4. ­ _ > . I     .      / * ( .1  E A       /    *         /    *         /    *                     /    *        P  C   . .           (     . _   FIE; =A_NT . T   ­T ­L       ).  _ .                          TCP       (  ( . ..3  S S B      L                   .                      ­                             _ _ ( )   ;    .4.&   .   ).4  C 4.          ..   ( ); ) (  ) ­ _ > ) ; T        (        I       )       (IP)        . .4. _    = (OTNM; PR_U) ( & .IP T .      / *    = (EVRNM) SRE_AE;    / *    = (FIE. T                        (    IP.  ( ­> ­>                                     ).  .  T   (  )      INET  )          ). T   .      F     .      _       ). _ . UDP  )      ( .  _4 _ ( )       4. T                (              (     .              .           .0;      / * .    (  R       _                  (     ). T             ;            ). T       4. TCP    (  ) ( ).          ( )           4    ).          . I          TCP                            . '')                      .2  S C C  C      (  W       ­T   )    . .

 13 (5)   _ ( = _ )[  _ (]   )        .5  C  W ­T        INET) C      (       ?) C                 D          ( . T               .        .          )                                      '  (         . T )    ­         /            L     .     TCP  F            (TCP/UDP  R      INODE   FIN    ) 4. T _4 _           .  4 _ /   '    (   )­ / / _ .4.5  L T                       _     _          F               _ ( .4.     TCP    )  (         ) C     L     B     P       S   C   S                 4.4  C C _  C     (  )     ' )                . A       (  )            INET              (    ) _ ( .        ..P   E S   S   I  INODE                                 (INET)   4. ) .. .                _         (. T (INET  '  TCP            .4. . 15 (9)             . .3  C C D        C  W     ­T :          FIB                      ( . 4. N . T )          TCP  )            ;   (                         ­   .

 36 (2)       _ (      )             :                         _ _ ( )         . 12) (41             . 56 (2)   _ _   (     .   . 51 (7)             _ (        )                       ­ >    OKSRA. 10 (4) _ (       )                           4 /   . . )            _ _                       >> >              (   / 4 )­ / .TS   O. 21 (6)       _ (   / 4 _ )­ / .             _ (    )      I FB                           . 16) (64          O TS _ _ (   / )­                     (            .   ) _ (   / )­ .                           . ( SC_TEM OKDRM.. 46 (7)         (     )   _ (    )         _ ( )   >> >  _ (   / )­ .                     .    _       _         (   )­   /     4 / _ . 11) (08         . 43 (6)           _ _ _             '       UL NL   ­ > ­ > ( =C/D_ )[TPUP (] ) _   _          C   D TP UP     ( ) (   )­ / / .SC_GA.           _ _     )           _ ( ) _ _ _ (   / 4 )­ / .               _ _ (    )           _ _ (.)       _ ­ > ( = )[  _ (]   )          _     _ (   )­     /   /   .                   ) ( _                 _             (   / 4 _ )­ / . .

  .          C  TP     4  51 . 90 (1)     . 94 (5) _4 _ (    )   _ ( )       (   / 4 )­ / .       .1  O ._             _                 _             _                 _4 _                 _         _                                   (   / )­     ­ > ­ > (    ) . (7)             _     _ (    )       (    )   (   / 4 )­ / . I             . 5. 10) (52                           (   / 4 )­ / _               _ _ (    ) (   )­ _ / 4 / _         ( ) .            . 90 (0)   _ _ (    )                                     ­ > _     C S T            5   M                       . 39 (0) ( = )[      _   (] )   (   / )­ . 69 (3) _ (        ) _ (    )         ­ >     (  )( _ (    )           ) (   / 4 )­ / .

1: M   .    )                 (  IP).                       .              . T                    (  INET).                   (    TCP   UDP).      _   ). T                    (   .           (       .F A            5. T  IP                           (   . T               .        .  .

                                          .2.1  W  W      S           ­T W       F     C         P      (      ­    ?     )          (       ) ?            ) ?       (INET  5. SYN.             ( . ).  .2.2  C C M      P    UDP ?                  ­          ?       UDP                   (    IP  ;            ) C    UDP   (     ) C    IP        5.5  T    P       )           P         W       W       T      ( S       .2  S 5. I   .  .4  W C     L     F       C     S        P        IP             IP  (    (            ­ UDP)  ­ TCP)   '          5.2. F     .3  C    P    TCP ? C    ­      ?      ?        C                   C       C           A             B    TCP       (  ACK . IP  .2.                        .2.) C    IP    5. N            IP  '      ) 5.

 64 (0)   _ _ _ (    )               ( = )[  _ (]    )          ­ . (5)  75             . > ( = )[  _ _ (] ) _ (   )­      P I       P I    ­ > ­ > / 4 _ / .T                   5. . 35 (2) _ (  )[     ­ > [ ]> ­ (    ) (   / )­ _ (    )       _ ( ) . 5) (0       _       (   / )­ .     / /EIE DVC. ) _ _ (   / )­ / .   / ( ) _ _ _ (] )                   _         >> >              _     (   )­     ­ > _         .          . 24 (3)   ( = )[  / _ .       _ (    )     .3  L T      F                        L   . 59 (7)       _ _ ( )                    (      )             _ ( = )[  _ (]   )          _ _ ( )       _ _ ( ) DVC­ EIE> _ _                                     _                 _                 _                     (   )­ (   )­       . 76 (8)                           ­ > [ / ]> ­ ( )   _    / 4 _ ­ / .            _ . (. T               . 39 (9)       ]         /     /             _ _ (   / 4 )­ /     . / 4 _ / .

1  O .   ( ) 4 /    _ ( ) _ .       . 10 (6)     _ (   / 4 )­ /  C  TP         _ _ _ _  C .        . (6)   . 7) (7 ( ) _4 _         _     _                                 4  68 . 56 (1)     .       .   .      D  UP                     _ _ ( )  D  UP   C R T            6   M                 . 59 (5)     (   / 4 )­ /   .            .Y AK SN   ­ _ > [ ]> ­ (   )­    P I    _ _ (   )­   / / 4 / _   . I             . 6.            _         _                       _ _ _ _ _ (      )   _ _ (    ) ( ) 4 / _ (    ) (    )           _ (   / )­  _ _ _ _   _ _   .

F A   .                 .1: R                         . I     . T                      6.

                      .                  '    .        .        . (T                                            (               6. T       .                  . ''. T                             .3  R R S            N             B  (      H )   ''  (   ) .             . W       .      (     ­ W           T                       '  ;              TCP   UDP).            O           '  ).)                      (           .            .    T         ­ ­     ''    .                      . T         .   .  IP).2. .                ­             .                          .2.                    . T  IP           (           )            .                                  .1  R T     F     C   P S          W           ­T  (P  I) )  (           ) ?          ) ?       S      (              ­              ?                            (INET   (TCP/UDP) 6. D ;  ­              L                           ­ ''                .2  R 6. I        ­           ­        .2  R W T R A T P S R      P            ( )                                                    ( )                         6.2.

5  A    P    UDP C  UDP      M       S         P       W                                     6. T   EIE )   (.2.  (         )                             _ _ (    )                           _ _ (    )           _ ( ) . T                   .7  R      S  (P  II) )    (  (TCP/UDP) ) W            ( C         M             R           6.  .  _  F              L             .4  U C   D G     S                P                  ­         IP    (     ) ?            ?      ?    ? ) .6  A    P    TCP      ACK                            C       ;  I    .                >>DVC_ (   > EIE )­   .L F E    ­ IP                                          I   6. )                 .3  L T   .                 (TCP   UDP  6.2.   D V C _ ( .    D       P         W             6.   / /EIE DVC.2.2.

 77 (5)           ­ >               . 38 (3)       ( )       ­ > [ ]> ­ ( ) / 4 / _       _ (    ) _ (    ) . 74 (6)                           ­ > [ / ]> ­ ( )   _ (   / 4 _ )­ / .     _ _    (         )                                       _ (      )                      FSRUE) (ATOTD                    (     )               _ ­ > ( = _ (]   )[  )                        _ _ (    )       ( ) _ (   / )­ / . 99 (8) (      ) (    )  II    SGO           _ _ (   )­ / / . 35 (9)           :           (         )           (  ) 4              _ _ _ (    )                   _ _ (    )            P I        ­ > ­ > ( = )[  _ . 87 (5)   _ _ (      )         ­ > _ ( = )[  _ _ (] ) (   )­   _ / (  ) .               _ _ (      )                 _         _         _     (   )­ _ _ _ _ / ( )             / .     (   _                         (   )­ ) / 4 _ / . 10) (57       (   )­     _   ­ > . 36 (6)         >> >  _               _               _             (   / )­ . _ (] ) _ (   / )­ / . 85 (3)  (       )                   .

 19) (34           _ _ (   / 4 )­ / _                                C AK         _ _ _ (      )       (   )             .                         C IP F T           . 16) (02      D  UP .                         _ _ _ _ (      )         .      7. 19) (75                            C    AK     ( ) (   / 4 )­ / .     . 93 (6) _ _ ( )   (         ) _ (   / 4 )­ / .     7                     (  IP          )    .               _4 _ (    )             .SN S. I     .           .    CP IM        _ ( = )[  _ _ _ (   / 4 )­ / .  .RT C         _ (    )          C AK _ (   / 4 )­ / . 74 (9)       _ _ (      )       _ _ _ (    )                                                           ._ _ (   / 4 )­ / _               :      .1  O .    C    AK          I.AK FN Y. 14) (19                                               _ (    )                     _ (    )         _ _ (    )   _         _   _  D  UP _ .   _ (] )     ( )   .

 (I             F  7.S  F  7. .)           .1: IP  .1              .

A  T       ''  ,  W    

           

    ,   

 

                                      ,       

                ,  .    

 

       

       

 

        . I              

. ­

            ­ ''. T                 ,       IP,          . T  IP                  ;             (    TCP   UDP            )         IP    W       , IP             ICMP              . I                           . F    IP  '              )                                    .         ,              . F   ,       

        .

 (

7.2  IP F
7.2.1  R
W T R A T P S R  

 W
   P

­T

     

           ( )                                                  

 (

)

       

 

       

7.2.2  R
R S L F E          

 

 N
                       

  B
 (      

 H
)    

''
 (   )          I  

 

 

 ­ IP        

7.2.3  E
C   D G     S          

   P
               ­     

   IP
   (   ?            ?           (   ?              ? )    

 

 

)

7.2.4  F
C C  TTL     

   P
 (    

   IP
  )  ( ) 

S  ICMP  C     S    IP  F   S    

                     

         

         

      ' 

 

 

 

7.2.5  T
P W W T S T      

   P
        )                                (              

 

 

 

7.3  L
T  

 F
         L   ,          . T                 ,     IP    ,

                DEVICE ().
_ _

(   / )­ / . 59 (7)       _ _ ( )                    (      )             _ ( = )[  _ (]   )          _ _ ( )       _ _ ( ) DVC­ EIE> _ _                                     (   )­       ,  

 

/

/EIE DVC.

>>DVC_ (   > EIE )­   ,   / /EIE DVC.  (         )                             _ _ (    )                           _ _ (    )           _ ( )          (       ) _         _         (   )­ / / . 10 (4)                = [  . 7) (2     ,     ,      CP IM         

  _ _ (] )

_ (   / 4 _ )­ /                              T      TL ,                                       ,    CP IM 

     CP IM    

 

             T TL                 _ ( )

  ,  

    _ _ (    )  

_ (   / 4 _ )­ / . 35 (9)           :           (                   (  ) 4              _ _ _ (    )                   _ _ (    )            P I        ­ > ­ > ( = _ )[ 

)

(] )

_ _ (   / 4 )­ / . 16) (36       _ _ (      )                   (     )                 :               (     )                                                         _ _ _ (  )(   _ _ _ (   / 4 )­ / . 12) (41             ,                     ,             _ (    )                             ,   ,TS   O,               _ _ (    )           _ _ (, )            _         (   )­   _   _ / / . 12 (6) (    )     _ ( )

 

 

)

 

,

 

 

 

_ (   / )­ / . 85 (3)  (       )                   ,     _ _    (         )                                       _ (      )                      FSRUE) (ATOTD                    (     )               _ ­ > ( = _ (]   )[  )                        _ _ (    )       ( ) _ (   / )­ / . 77 (5)           ­ >               ,               _ _ (      )                

( )

   

       

_ (   )­                 ­ > _                   _     _   / _ . 5) (0   4 /   .   R                       . I   .1  O L   LAN.    E  F     )         8.  8   I              P    IP R     .   ).    8.   / ( ) _ .1               ­                                       (        IP    . 56 (2)   (   / )­     C B T     .  (   .

 L   .1: G     .        P                    (ARP)                .                     A              R               .)             ;                ''). (H  8.F T   (                   . I           .

      .       (   )                  .     (                    (                   :    ­  F   .L I            B  (FIB)                    .1  T  N T  N      T   ''. E       . IP    .          ).2  R N :                        _ 3  ( _ 2  T .2)        .        .         )      ;      3  ( 2                 )            8.2: N _  T  ­                                          .             ;                .              .2.        E        (             ).   IP      .                .  . W    IP                          .  IP  ) ­ 8.  .) E                (      T    F  8. I              (           .        F   _   *  8. IP      FIB. O    (        I                   . W    FIB              )          ''  ). I   . (N            ( )  ;            )             (                       .

                  .            ) S  ­   ­    .   ­                          )      .   ( )  .        T  (                (             *    (       .  ) S        E   .2  T  F  I  B F T  F    I      8.  .     .   . .    _   .   _    ­  *               _ _   _  ­     ARP                .;      .3: F  B    I  (FIB)             B    (FIB)                       IP  .   . ;          . A   )                        _ _  ­   ­  _ _         _ _ ;    *       *  N I H H S M S +  (32)  EG_AHAK1   O N    D . .      ;      * _ [  ­  ]  P E G _ A H A K 1 N I H H S M S +  (16)      .  .         ARP  .    ( ;                 ­  [  ­  ] .2.  .          * _  ­          .   _ 8 _   O                   ;        .           .     .  N . 8.      . .        .    . T               .

c ­        .           ;  ­     _  S       _ *       ­           . 254      _ N T      T     _ .  (     _   _           ­>     [ 7 ). S  F            FIB ­     F  8.   0 C000.   * _ * ­> _    [8­> _ 2]    ­        3  _ 2    ­         ­                      .                        (        ­ 0000 ­                    ; 15 (0 0F)     (0   32).       . _ _  ­       (   )   0 FFFF            .)   _ * _   [2  3]   _           0 FFF0   0 FF00  N  Z     _     _   _        (            0 0000.3                      .  S             _           .     . T              0 8000.    FIB  _ ;                       /p oc/ne / o e.)   . )­) ) 1 ;     1 (0 FFFF). T           _ucin) fnto(.h ­      . 0   16  0).                .       0 E000.  (0 0000).4       FIB           . FIB T   _              ­ incl de/ne /ip_fib.  .   (               .  ­                  _   3  _ 2  ­            (1<3­ _ (<(2 ( )     1     32   0   (0 10000).)      _ _   * _ .  .   0 F000  . W           .         ­             (      FIB  _                               ''   8. .   _  ­    ; 255  . T  IP                                  . (E      FIB   (       [ 3  ­  3]                                                             ). T         . 2] _ ;  .      ( )      . I       .c ­      .3   8. T      ­  _       ;    0 8000.         .          _ [] 0  _  S       *  ­ ne /ip 4/fib_ha h.            * _ucin)) ( f n t o s (  ­  _ [] 0  ­  ).  _ [] 1           0 FFFF..      _ . IP                        . .     ­  ;  ). IP            .  ­ ne /ip 4/fib_ha h.*   _             . E                           .

.h ­                        .4: F : _ (  ( )  I  B  (FIB)    .  _ _ _ _ _  8. _ _ (  )   _ (  )               .     _ _       _      S    ­   ­             (32 )         0 FFFF.16.0 F000.  E _                   )        _            172. 0 F800. _ (  )       '    . _  _   O N  P           _         ;   I    I     ).  3.  2. .     _        (  0  ).    (    ­      ) S                       _  ­ incl de/ne /ip_fib. T  ­  _    ­  ).  4.         F FIB T 1.   _ ).       _   _ *   _ *          (          ( .  N    N     ).34.7.     /     /TOS    (    I     );               ­ ne /ip 4/fib_ha h.0. IP)                   (                             _ [] 0  ­        _       O   _     .      ( .     TOS   2..0. (  )   _ ­> _    (  ( )           _   )                .16.c ­               (                      8   (     .         172.             ­ 24 .

 W  IP      .  13.0.16. U .  7. _ _ (  )             '   . _ _ (  )               '   . .0.  6.6    . .2. (O                                 .16. S     . _ _ (  )         ­    ­ 16 (  255. T             . T       .3  T  R  C F T          8.7             L           ;                  .           .0    ) (           '  _   ).    (S  S  8.               .0.  12. _ (  )          AND               . _ (  )        (   _ ( )  )  AND           ' _  (15)         (6)      '        .255.) R          8.255.                                      .2.  _ _ (  )       _               .  10. T     . _ (  )            AND             '  .            172.) _ _ _ (  )     _     .                          .255. 8.0.                        .5           F  8.                                       .  8.2                              . S  F  8.          .( 5.5: R  C       .                    .                .         172.      ;                .0.  9.  11.0    ) (         _ _   ).   255. _ (  )          AND           '  _  (15)       (10)      '        .

h ­                    *  ­  )              ARP              . _ 3  _ _ 2  ­          _    ­        ) O       . ) S .   TOS             /p oc/ne / _cache.                   .           *       .  . )  * ( ) (   _ *  ­    )                ( _ _ ( ).  * ( _ _   _ ) ( ( ?).         .          255). N  L      (       _  ­    .                       . )   _   *  ­                .h ­          .                . .   C    ( _ ) S      ­         ­ incl de/ne /d . ;     * _      < ) >  ­                                     _ 3   _  ­    _ 2   _ 3   _  ­    _ 2   .  T   ;    '   E     )    ;               (        0     256      . _    ­      .   _    ­    *           ;                      .    D             . . /               .    (     .  . O                           .    .  .     *  ­           (   )      . ) _   _   _  ­  ?        ­    _       *  ­                  O           . T          ( ) S   _    ­ incl de/ne / o e.  .  .  * ( ) (   _ *  ­    )                ( _ ( ).    *    ­       ­    *  ­ incl de/ne /neighbo .h ­      .                              ( .    _ * _ [THS_IIO] R _ A H D V S R  ­  (   R     )         (   .            .  .                                             .  .

  _ _ (  )             .  _ _ (  )            5.F  8.1. 2. 3.16. T         .16.         172.6: R  C       .     TOS   2.   TOS   AND      255                 (5).1.7: D  E :      C       .1.            .  .  T _     )    _ _ (  )         172.6.   C _  8. (  ( ) . F R 1.

4  U L T              R          I .               .         L       .         0        .     0. T                   . P                                         .    .              .                       . T                 .  _ _ (  )   _    TOS.              .  T 5.    ).2.     _ (  )                 _ (    )   0              : ) . T         (                           .  _ (   / 4 )­ / .     .                  ;                ). E        IP    .                 .  _       .           . 8.         FIB  . T                                                         ;         (     ). 52 (4)           ( ­R  AP .   .         .   .     )           I                         8.              T  FIB                          .3  L T          F             .4.            ). I              (  FIB    . (S  C  9       IP  (  )           . I            ARP          ARP                   . _       . )            ­    EL   EUS RPY RQET                        ­                       (                        _ _ (    ) :                  :           _ _ (    )                               (         )                         :           _ _ (    )                         _ ( )           . _     (  )          ­                 ( . O            LAN              .             . C         .

 20 (2)           ( )                6 1          (    0000[    .. 13 (5)       _ ( = _ )[  _ (]   )                .       _ _ _ ( )                R  AP               ( )           _ (    )  R  AP     _ ( )               0 _                     _             _     (   / 4 )­ / . 19 (0) ­ _ > _ _ (  )    S F _ (   )­ / / _ .  ]­          )         (      . 91 (7)    S F .         _           _     _               _   _ _ _            0 (   )­     / _ 4 /   _   _         _   0 . 18 (0)                 :    3       2 = ( )>3   _ >(2­ ­ _ > ) ;     =(>2)    ^  >0;     =(>1)    ^  >0;     =(>5;    ^  >)     =F_AHAK )  /F_AHAK  5    & ZHSMS( ; / ZHSMS  1    _ _ _ (   / 4 )­ / _ .. 73 (2)             I  FB              S F     _ _ _ (  ) _ _ (   / 4 )­ / _ . 44 (3)                            R  AP   _ _ (  )         ;        R AP   _ (   / 4 )­ / .            )   0         ­     . 88 (4)  _ _ _ (    )                            0    NI    EXO      R  AP _   (   )­     / 4 / _     _ . 11 (9) (   / )­ '          4 / _         _ (   / 4 )­ / _ . 21 (6)                                       (                   (     )                  O    TS                 _ _ (    )                     _                    1   _ _ (   / 4 )­ / _ .

          _ (    )                               .     _ _ _ (   / 4 )­ / .TS   O.TS   I/I)  O. 16) (36                       (     )          (     . ) ( ) .   .             _ (    )                               . 17 (4)              (   )­ / / .                        _         _     _                                         )             (             ) (   / 4 )­ / _ . )            _ _ (   / 4 )­ / . IFOF            . 13 (3)   _ (       )       _       _     _ (   )­       _   _       / 4 / _           .   .   .TS   I/I)  O. 20 (5)    ICDR   ICER  SOADT SODLT(  IVL ENA                               .                   _ _ _ ( )     _ _ _ (   / 4 )­ / .                 _ _ (    )                               _ _ (    )       ( )       _ _ (.                   _ _ _ ( ) ) . 19) (07                          (   .     _ _                   . 16) (64                       (     )          (     .                 _ _ (    )       ( )       _ _ (.   . )            _ _                         (   / 4 )­ / _ .TS   O. IFOF            . 10 (4) _ (       )                           _ _ (   / 4 )­ / .   . 12) (41                          .     _ _ (    ) ­ >   _ _ (    ) ­ > ( )   .

 70 (6)       / / . F      I        ''.              . 56 (2)   C D T                9   R                       o ed    . L              (                FIB.         ( )   0      S F _ _ (   / 4 )­ / .     routed                (                L   . 11 (9)     _ _ . I 9. 68 (6)                                                :                   .               .          ?''         ''  )  ­          (   . U     .                              ;                                               LAN        .             _ (    )                                                             .1  O A      .      )    .    _             _            0    _ _     _ (   / )­ / _ (    ) _ ( )     (   )­       .                              R  AP       0 _     _   _   (   / )­     4 / .   . 1) (8         .         : & 0000)<) 0 FFFF<4;   .               (   )               ( =( & FFFF)>)( 0 0000>4 (          = ^ ^ ;          = ^ ( >1) >6;          =( ^ ( >8)&0F; >)   F _     _   (   / )­     4 /   .     0       _ (    ) _ (    ) /             :              R  AP .  ).                     .

 I     9.       (          I             . T                           .             . 9.2  H o ed                 routed W   ­       .            RIP   UDP  (  )            POSIX      .H         U .    .1         RIP    ;    F  9. T  R               .    .        o ed            . S  F              RIP       9.         ).2.1  D o ed    A         .1: R  I  P       . E            RIP   (       (  ) ).  S                               .                                 RIP  . U   .   P   . P     .   .                        .  . T                          (RIP)                                     RIP.   ­  R U E A H I  (32)  OTHSSZ .

  o ed                     (      RIP    .9.        o ed            ). T                           ;              9.h ml.10.3  routed F T                                     o ed        . T            ne ki ­ o ed­0.com/app /do nload    . .10  . I                     (    ) . .0 01.        RIP              '              (H P N _ N I I Y O C T I F N T )    '  FIB).        .   T M R R T   IE_AE .     (   o ed                    . F .        .com/ / c/ne ki ­ o ed­0.  o ed                     (                 . c.     .  oo         ): T      /   o ed  L               / c/ edha /SOURCES/ne ki ­ o ed­0. O          (                 ­   / /     ­ / ­ ­.               . E                                 )                          .          (    UDP  ).  (R  H  L       pm     .2.   ;      .10  T             .   o ed        .3  N W            ( W      RIP         O   )                    . T   .0 01. U             )                . /ORE SUCS ­. edha . . T   o ed                        ).  o ed   FIB). edha .    .2  I W   . F                    RIP/UDP                      (  )                       9. 8 M  1997.       '          ( . T  SOURCES              . N     . T          (     . 8) (8                         )        (  ORE/ )­SUCS /   D  UP   (ICICN)   SOFGOF      : .2. S    (           .         UDP  .

EMITUR.                       (                               . 7) (8                 (     D  ) UP         D  UP    I  RP                             .                 (    )             (  )       (    IT)  ENR. 6) (0                                        I  RP   (    ) 0                ­              :                                 .N.   .                          :                                                    :                             .U.         (  )     (     )             (    )                       )     (   )  S2 UR   .        (      ) .                            :                                    .S1 AR.                     (    )           (    )             (    )                      LMHPTR. 28 (9)      :      ( )             _ (    )  RP  (I)   .     ( )                 .          :               .      OCTIFNT  HPN_NIIY             (    )                                  :                (    )                              .                                 _ (  ORE/ )­SUCS / .                                      (      )                   (  ORE/ )­SUCS / .   .     (    )             (    )         (                  )                         :                             >> >    (  ORE/ )­SUCS / .

 5) (6                                                                                                     .                                                          (  ORE/ )­SUCS / . 7) (7         ) (  ORE/ )­SUCS /                                   .       _ (      )                               .                 (  ORE/ )­SUCS /                             (  ORE/ )­SUCS / . 9) (1        I  RP                                                             . 10 (0)                       ;                                     .     ( ) (  ORE/ )­SUCS / . 36 (4)                     (ICDR   ICER)   SOADT SODLT        (  )    1 ( ­    . 18 (3)                         _ (  )                         (     )               _         (      )           (      )               :             . 6) (5          0 () . 36 (3)     . 27 (0)               (      /   )             (  ORE/ )­SUCS / .                    .                                         (  ORE/ )­SUCS / .                 _ (  )          0      () (  ORE/ )­SUCS             / .       .         (  ORE/ )­SUCS / .

  cd om ­ CD ROM    ne  ­      pci ­ PCI    f  ­          incl de ­        a m   a m­i386 ­  config ­    lin  ­    ne  ­     (EXT2. 5) (5                 (  ORE/ )­SUCS             C E L   T /       / c/lin /          10   L  S  S      C  T                     :    (lin )    10. lin    lin ­2.2.1  T  L      / /    (   ).14). MS­DOS.  .      (    )     / :       [ (    )     (] )      .14).2.            . .5   lin ­2.2  U  EMACS T .) ke nel ­            lib ­      .2.      L        (     a ch ­    i386 ­     I boo  ­          .    mm ­        mod le  ­          ne  ­      co e ­      ip 4 ­       IP 4 packe  ­      ched ­                        10. T          ( .. T    (    lin ­2.     (       )  486   P   ) d i e  ­            block ­       ( . .

                  :    filename ­ T       .            . .       10.  . EMACS             ( .. EMACS              .                  C              10.T  L                                     .  / : / / /.. .''          .       ip 4  4* /. T     . . # . I                         .             TAGS       ( . / / T             ­ / .4  R    K .2.      :       .  ''). / / c/lin /incl de/lin / ock.h)                          .    10. P   ESC''  .      /          TAGS  F                         /  TAGS             e ag     /               .     .'' ­ EMACS               (               );    ENTER''. A TAGS        10. N  EMACS            ( . (R .    . / / c/TAGS).2  C I  T              filename T            TAGS  .1  R    TAGS I     .3  U T                        e ag            (     ).    : .        gc ag   .2.                       .                         ( .               .. F   ). * T  TAGS  . T         . I                              TAGS)    .    CTRL­U''  ESC''  .

        . E             . I         3.(S   T  L ­   ­HOWTO  ­ ­                 .  R       )...                  . Y                      R  H  mod le­info            .)     ;                       (                 ;         /boo       ).  R               .  R             . 22      (   mlin ):   /36 8/     ­ / / / I   / / ­.)   ­. ­ 22      (   .   22 / (N   8.map  ..        .  I               ;                      .      .) T     I  I                              lilo ­    . (N     . T   ).  C                      /lib/mod le /2.       ''                  .  C       S  S em. C                   2    ). I              IF  .  . I        .  R   9. .   22 / / 10. A     M''     (   .    Y''                ).   /     / S  /boo   . .     _                                  2. .                      4. T    (                 1.)                                             . U             .  R 5.config   (         ). T   .                      . (O       . I     .                         N''                  .      I             /             .          . (           . ­..   ( : / /.                               ;        . MAKE ONE.2..     / /.                    .  R  (                     . 22           : .        .                  ­   2.  G                (/ / c/lin ).         6.2.  R 7.      ).

  I      /e c/lilo.13     2.              .     . T     .            .  R 14.              )                              T  ­   N       ( ejfile) ­         lin       . O     lin  ( . B               .                  10. ­   22          (   )        /                     .   22 / / S .   .                 (      2. T   D  M ­ 386 a ch/                  .5  P L                   . N        ( )        . T  ­                           .     *..2. .      ENTER''      . 22         .conf          ;  = )                  ­. T         .           : ­. N   ..12   2.   . 22       :  ..2.             O   .     ­  K         :   S ;                              .. .  E (   13. M           .2.     ­ 0   . /            (            <   .2.14.                        / c/)   N0­ ­   ..              .                .   .        ­  ( he e   i   he pa ch  e ion)             .                                  . O    ­    ­     .  R 15. F       . ).      ( n a )  . I         .h  incl de/a m­*  .         . 22 12. ­. Y                         .      . 11.    D                                   . ..14).           .c   *. Y    2.    ­ / / S .         /                                   . I                  (           ''      ''  .  C     /  ini d  /       /   /    SCSI  ­.

>             )        . * .   R  M               M T                    mod le. A  MS­DOS                                            ''               (                               .1  O L          2.C L T          11   M        L     .                      ). I             .2  W 11. T       )                             ( .                         (                 .          ..        )            .            11. (W       .. I  M .    .      .2. T                 .   )  . A                         .. ..  *.h         (         .          . I             . /        . T        ( .     .0     (   )         (                 .)   .      .   / *    /   * _      .      .         .  11. T A                          ke neld  ).1  W M MDL  OUE .              . * . (  )            / *    /   * _     (  )          / * M                    gcc       ­ .   / *   . : #  OUE MDL #   < / / .

 T  /p oc/k m      k m       ).2.2  I I (Y                  R                  M                 .I / / / / ;                                          . N             .>    / * /*******************************  ********************************      *                  / *   _ (  )     (<>   "1T         .     .    < /                   .   *    *T                 *      L   .             '                .3  E T                   .                       (                           . M                     .       A         *              *  / * # # /  * #  OUE MDL   < / .  mod le_name             : T  l mod    /    /   M            S  U               36       138 0(   35     91       9    112 1( )[   ) ­ ] 11. R  L   EPR_YBL ) XOTSMO(   . "; \ )      ; 0  /   * _  / * _ .c /  * _ . 11.     E P R _ Y B L N V R ( ) XOTSMO_OES         .>     . imple_mod le. F                          E P R _ O S M O S XOTN_YBL  ;        . T  in mod    / /              mod le_name ;            T   mmod  / /                       .)   .

                             p oc      .            ­    . "; \ )  /   * _  / * _ T      Makefile:    I ­/   / / _ / / #M   C   C= CLG  O D_ENL_­ FAS=­2­_KRE_ W _ : / :   / /   _ .  . iopo         .:   _ . . I     .           /p oc                                            .  /                 ..   ­ in e p .1  O T  p oc               p oc FS            .      .  .            . .    e ion    )                  .. W   . C  12  T  proc F  S T     .   /   _ T    (           / / :T     :T     ): #   #   #   #   . W '           L                   . T  p oc      /p oc   (     . loada g. T .        . 12.                . NOT          (/p oc/ne ). ./****************************** ******************************       *                  / *   _ (  )     (<>   "1T         .              p oc          .  .

      _ _             (  : ne /ip 4/p oc.                             ''.  . W          /p oc                                  . T            p oc                                   P G _ I E AESZ­     .2  N T         /p oc/ arp   . T      p oc                ;                . M                 . 12.c 988) )               .    _ _                FASTROUTE        (  : ne /co e/de .c 109) )   .   ( _ _  (   _ _ (  : ne /ip ) 4/p oc.  .  ( ) : ne /ip 4/fib_f on end. UDP.c 1228) ) . N          /p oc/mod le        ( _ );   IP  (  : ne /ip 4/a p.        .3  R  proc F . .   TCP        (  : ne /ip ) udp   _ .  .c 191) )       .  .c 355)           (  : ne /ip 4/p oc.                          .c 244) )         4/p oc. ( dev   dev_stat   ( netstat raw   _ _ _  proc F      /p oc/ne /    .c 165)        TCP.  .        (  : ne /ip 4/p oc.  .   ( _ _ .   );    .   ( _ _ .c 165) ) _  RAW    route   ( _ rt_cache     sockstat    RAW ( tcp   _  FIB  _ );    .  .  (  : ne /ip 4/ o e. ( _  ( _ _ _ _  ( .        .  .c 165) )      UDP        12.    .T   (           T                    p oc  )                                                              ''    . .      .     ICMP      .   p oc      .          . /p oc/k m .

       P   * .          /   1           /   .          .c.  I  * * .   .                    ;                      .                     ­                         p oc             .       /    _FE  _RG. T   . O       12. T                      (     )       L         .2  B B _ #    proc E         :     .          /  _     0           / ­   . T        ­                   ­                                 p oc  ;                     (           ).0      ). N    P O _ E _ O T .           _ _ _ (  )                               .          /   5           /  ­        " "        / .c. ( ead_p oc_f nc ion              . I                       _     _   .     ( .  (              109 F                ne /ip 4/fib_f on end.      F               ne /ip 4/fib_f on end. T   (  ) T  P G _ I E AESZ                         4KB).         / ­       & _ _   /    / _    ­              /               /            0 (      )   (     !     ) T   _     _          (         incl de/lin /p oc_f .3. T   _ _ (  ( )  607      .3.          /   0           /      ­   UL         /      NL. _ _         .          /      0           / ­   . T          FIB  12.)                 .   ) T       ''. T               _   < / _ .>   _ _   _ _    =   . H .1  F      F   ead_p oc_f nc ion(         ).   .          /      0           / ­   .  RCNTRUE       .          )    .  /   SIRG SIUO   /   .T L         ­  p oc  ''   (  2. T          L                 . _  .h.               .

  _                                     ).> /  .    _ #   < / _ .                                            p oc  . 12. 12. )     T    p oc                  '    _ _           _ _    0 ( )   EINVAL (   .   .       12.   .4  U W        proc E       ( _     _ _   .     A  P I. imple_en /  * _   *    *T       * /   F     *   / *   #  OUE MDL #   < / .      * _ .S  PS " I  : I  \ PF    ) ";     _   ( . T                0 (        ­ &   .  _ _   .3.3.  * * .           /p oc/ne   ). F I ) .  .h)    T         .     .      (   _ )     _   *     .3  R O   p oc         proc E   .   )          = ( . _  . (T   .            _ _ )   EAGAIN (             _  (   .   ( _ (   _ _         _     _ _   .4  E T       .  *     _ #   < / .           .> _        / * /    / * /****************************** ******************************  _ _    *           /  S F                  *        / / _      ­               *    _ '           / *   _ _ (   * .     S       .c .     *     ) _       _ _       *   ''  )               incl de/p oc_f .) A .> /  * _ .   /p oc/ne   .

" % \ .          /       ­              /             *  NL. D I .      = +  ( + .  /   _FE  SIUO   *                   *                   /  1           *  .       = +  ( + . " \"; )      = +  ( + . _ ) ;           (<> "1  _ :     .          /  _    ­    0 (    ) /  *  1. _ .       " "     . & _ ) ;  /       *          / *    ! )   (       (<> "1  _ :         .*       ;  /   * _ _  / * . " % \ .          /                   *                  /  0           *  . / . " % \ . ) ;       ;  /   * _  / * /****************************** ******************************     *         ;               *        /  S / F *   _ (  )  /   *            S* F /          = _ ( & _ ..         *  UL         /     ­     (   )  /   *  &   _ _      *     /  _    ­         *   /              *             /      !           *             / ; /*******************************  ******************************** _    *         ;                *      /  S / F *   _ (  )  /   *            S* F /          = _ ( & _ . _ ) ;  /       *          / *    ! )   (       (<> "1  _ :       .           *                      *  /   _ _   _    =  0           *  .          /     ­                /               *  0           *  .             _ .  /   *       .    *                   *                   /  SIRG  _RG.          /     ­                /               *  0           *  . _ ) ;           (<> "1  _ :     . F I C TL; T) ) ; /******************************** ********************************  _    *                    /  S    F;      S   *  F       .     .D "  T:  \" _ TL % . \"; " )            = +  ( + ..     .             _ .F   " C :% \" _   .          *  2          /     ­            *      /  "   _ "    /  .  /   * _  / * _ ) ; T      Makefile:     _ #M   . " % \ .

 H       ­ .  :   _ :   . I     . . I 13.                       .:   _ . ' .  35 46.    .                  .   /   _ T    (     ): #   #     #     / / _ S  PS I  : I  PF     D  T: 4 TL 6 F   C :0   #     #     / / / . .   13   ­ P                   .                  .1  O T     I         .2  C C  P T   K    ­            ..  :   _ :          35 46.  .                  . )      .C   C=  I ­/ / / / CLG  O D_ENL_­ FAS=­2­_KRE_ W _ : / :   / /   _ .         (       ;                    :       .                           .     D   .    .          . H       M  ­                                    . C E T             . I 13.              .               IP  . ..                                 (         )                  .

 T           .  .    .        /           .  _ _ (  (TCP  ) ).)         .                        .         . (S     B  ­          ;                                              P  L T   D G   .  . S          C  5   7        T                     ­       .1;                   S                        B     .    _ ). I                   . IP P        D      D        ­   ­     F                    ­                   k m      C                             . H .   13.                              (   ).. I     ( )                     . T  P  ­              (    UDP  )              .     ­  _ _ (  (UDP ) .                      .      .      . :                11. T               .3  E T F    13. H          ( )       ­          . ).               (     _ _ (  )   _ (  )   .   .           .          .

 I      3C A       T             (RTT). .1: E    V           . ­ ''                     20. I   O        AMD L T       RAM.1     2.000 5    . I   );              ..  32M   RAM. 5. T   T               .2.000 500                             ( .14      .000           R  T    500              .       '' (             .  .F T          C       .                       50. I   .14)        .        32M     2900               LAN  (VLAN )    . I   );  .        . /90     128M )     AST P  GX         10M    ( )     D  O  3 509 E      R  H  6.     XL590     10M      L     ;          .    (2.000 1500    T                TCP           (       . T      RAM.         5.2. I       ).                5     TCP   (                           1.                   GX1   10M      P        P /100       P                   )     D  O  3 59  E     /  II/350          .               T . T    (  3C  (  E  C    13. T .000  ''                            .

2.7  25  66  67   ­    .0   ­   1.7  .2  (.8  .%  2.5          .3  4.7  5.1  S T   (NOT      )             K     .9  (.6       : 00)  07  31   .8          .2          01   98   11     14  1.            .4.2     .0  2.8  20          00  560  207     53  5.7     .7  6.%  6.2  M T                K      D   .3  17   .9  18          10   61   86     33  1.4  2.%  4.7  .6  .  P  A ;                       L  2.2          .6  .4.8  5.6 R   ­       : 00)  05  31   .%  2.0  81     :  .2          .0  .5  01          05   58   92     22  1.8  .6     .9  6.%   .0   ­   1.%  6.  13.3  4.6     .1     .9  19   .0%            . (100     1    )                     (   )               (    X W ).6  58 R   ­       : 00)  45   85     12   .3  9.2  96 bla                                 M   T   ( )   T       M ( / )                 D   R   0* 1K50 K10  0* 1K50 K10  5K5 0*0 1*50 5K5 0*0 1*50 D   ­       : ­­   05  31   .4          . T     ).1  37 .9     .3  97       : 00)  43   84     12   .5  .6  4.8  5. N                   ''         (     .9  19   .7  .9  35  62  63   ­    .7  5.1     .1          .4  R 13.7  37          50  255  100     22  3.3          .%  0.3  26  62  62  (.14    . T                 ping­pong                             M   T   ( )  A      T  RT( )                 D   R   0@  5@0     0@  5@0  2K5  K50    2K5  K50 D   ­       : ­­   72   89     08   .%  2.%  2.0  .4  16          10   53   87     32  1.9  02          05   47   80     22  1.9     . T      P      0.%  4.8  98   00   55   92     12   .5  4.9  18   .%  4.1  .3 13.8     .%  2.2  36  62  62  (.6       : ­­   07  30   .5         1.%  2.6  58       : ­­   72   89     08   .1     .8  98   00   55   91     12   .7     .%   .6  .4          01   90   09     14  1.                             .2     .7    2.9    1.         ping­pong                             M   T   ( )  A      T  RT( )                 D   R   0@  5@0     0@  5@0  2K5  K50    2K5  K50     :  .1  6.

9  19   .2  18   .1  26  61  62          .%   .5  05  06  06         2.2: P ­     .1  19   .5  .9  25  62  63          .9          00   08  38   .9          .8          00   20  40   .5  .5  25   .5          05   08  32   .%   .8  .%   .4  18   .7          25   05  33   .9  .3 3.%   .2  .9  .%   .5          00   34  03  1.    .7  17   .1  .%  1.4    1.2  .3  .%   .%   .3   00   07  32   .3  .9          10   07  32   .0  .1  .9  .3  25  62  62          01   07  32   .9  . H      A     .4.8  25  61  63          .5  17   .7  .7   00   05  31   .%   .         50  256  169     17  3.2    2.9  .7  .2          10   05  28   .%   .6  20   .3  27   .6  36  67  68          . .1  25  63  62          .5  85   .0  .8  94 bla                                 M   T   ( )   T       M ( / )                 D   R   0* 1K50 K10  0* 1K50 K10  5K5 0*0 1*50 5K5 0*0 1*50     :  .1  .9  .5  .5  .7  .5  36  69  68          .7          25   07  31   .4  . I    NOT                                    .7  19   .2  .3  .1  18  28  23         1. F                 .0  .0  25  63  63          .3          00   10  70   .9  .8  5.4  .%   .8  .1  24  52  47         1.%   .0          50   06  46   .8  51   .0  .3  36  65  62          .7  19   .1  31  43  44          .1  .1  9.%  3.5     :  .              .%   .     .%   .8  .6  .3  .                      .0         1. F  13.3          50   07  31   .6  .4  19   .%   .8  13          00  596  270     59  5.7  .6  25   .1          05   05  29   .1  .1  09  49  47         2.1  .7  19   .1  36  62  62          01   05  30   .3  P W                   .%   .7  .6  .6  .5  .3  .8 13.7  .9  .8  .4  33  55  59          .%   .

 W                            RTT;     IP.   (         )    . T    ACK              ­ ­                   .                              TCP   0. T         ­   ;          1%                 TCP    ­   .                                                     (                   A  .10  . T                    ­          .    .5  C . 66     ­       5              D      TCP                   F  13.                   (         . 0.                       ­ ­ .                       ;        . T        1500    . 20 .F T   (            13.       26   E )      . H     . T  RTT          )              '';                .3: B           .      . T .    ;    13.10  .          . T       ;              .05  ;              (20   TCP.2.       1% ­     ? A                           ­ .                 )  . A         ''      ;            .            ? N . I                                       .        RTT).     T                                    (     ;     ACK         ). F            0. F     .

    ..5.        .   Q         ( _  &( & * _ ) ( )     /  )     *           _ ( )                 /  ;                 *            ;                    * 0                    /                               /                               * #  OFGNTPOIE. I   ;     0 ( ..                  . I       )        .   *   _ _ _   _   _  )0         /  *=;         *   * ). ne /co e/de . T   .          *    *U   (         ) :     * / /   _     * / /   _  / *               _ _ (.  / *  / *  / *  / * ne /ne .   ..13. . CNI_E_RFL. N         . (N _   ­              ­ .     ­        . O   .   *      *S / / / . 13. .c (    544)  / *  / *    * ( _ ) (   _  )      * *;     /  EPR_YBLNVR( XOTSMO_OES _ )           * ;          /  EPR_YBL XOTSMO( _ ).5.            .  / * (  *;     .         (     )        ..) . ) . ;. T                   )                  . m .                    .2  M T   ­                   _ _         (  )                 .1  K T                 _   _     (  )       ;     (                        579) (                             .      _   ..c /  * _ .c ( . W                       _ (    )               ''. F packe _d oppe .. .   *    *T                     *                  * ( ­ )   .

 P . ­ > >  = =  )         _ _ ( .  K  H :// . / / .# # # # #  OUE MDL  A_NINDSOT655 MXUSGE_HR 53   <   <   <     / .4* /****************************** ******************************     *       _ _                 _ (   _   * )          ;       ( ­ .> *  /  / . / ' G . :// .  HOWTO :// .>   *    /        _  / *    / *  * ( _ ) (   _  )    * *;   /     / *   _ _ (   * . .) & 2;       =    ( <  )    ;  * 1  /       / *          ;           /  0            *        /   * _  / * _  / *  / * /*******************************  ********************************    *                   / *   _ (  )  EPR_OSMOS  XOTN_YBL;        =   A_NINDSOT *MXUSGE_HR;     _    = _ ;     (<> "1  _ :       \"; )      ; 0  /   * _  / * /****************************** ******************************     *                  / *   _ (  )     _   ; =0     (<> "1  _ :   \"; )  /   * _  / * _ _ C A 14. / /L / /LDP/ /HOWTO /H N / / .> / . .1  I L L L L  D ://  H  14   R  S .5;                *  =000                /     / * _ 3  _ 2    201A;             / 7. .603 / =0 200C              *121..     ) * ;/     / *     ;               /                  *    / *      .

 U  S  C  K  C M . M . S .  & A . CA.    C :// . NJ.. . S . W . I . 1996. .. S  D  D R ..  TTCP :// . E . 1998. O'R U  S  R . H  L W . C O  P .. R . 1 (2  E . C A ARP A ATM A BSD B DHCP D DNS D FIB F GUI G ICMP I  S  H  N  R  15   P  T  D  C  S  I  U  C  I  M  P  B  P  M  (   ) . AZ. L . 1998. / . M .   K CA.    . O'R  & A .  N  P .) S . P ­H  I . 1999. :// . I  K  I B . U  S  N S . 1999. . A ­W . 1998. P ­H  I . M . S . A .  H  S :// .. NJ. W. . V . .L N R R  R  P . . D . .. A . NJ. 1997. P ­H  I .2  B C H L L L R  N T . U  S  R  R . ­ 14. / .

70.   P  S  A  D  (  T      U  N  P )  P  P  2.  TTH. 23:35.INET I IP I ISP I LAN L LDP L L MTU M PPP P ­ ­P  P RARP R  A  R RIP R  I  P RTT R  T  T TCP T  C  P UDP U  D  P UNH U    N  H VLAN V  L  A  N WAN W  A  N F      TEX  O  31 M  2000. .

Sign up to vote on this title
UsefulNot useful