The Internet Protocol (IP) is the heart of the Linux messaging system. While Linux (more
or less) strictly adheres to the layering concept - and it is possible to use a different
protocol (like ATM) - IP is almost always the nexus through which packets flow. The IP
implementation of the network layer performs routing and forwarding as well as
encapsulating data. for a simplified diagram of how network packets move
through the Linux kernel.
Abstraction of the Linux message traffic path.
When an application generates traffic, 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 Information
Base (FIB). If the packet is for another computer, the kernel addresses it and then sends it
to a link layer output interface (typically an Ethernet device) which ultimately sends the
packet out over the physical medium.
When a packet arrives over the medium, the input interface receives it and checks to see
if the packet is indeed for the host computer. If so, it sends the packet up to the IP layer,
which looks up the route to the packet's destination. If the packet has to be forwarded to
another computer, the IP layer sends it back down to an output interface. If the packet is
for an application, it sends it up through the transport layer and sockets for the application
to read when it is ready.
Along the way, each socket and protocol performs various checks and formatting
functions, detailed in later chapters. The entire process is implemented with references
and jump tables that isolate each protocol, most of which are set up during initialization
when the computer boots.