A modern router is a complex piece of equipment. The outside of the equipment
is usually very simple, consisting of a number of network interface ports (shown
on the left in orange in the figure below) to which cables may be connected and
a few indicator lights to indicate that the router is functional.
Overview
Most routers also have a serial connector to which a terminal (or a modem)
may be connected, known as the "Console Port" (shown to the right in the
figure below). This port is usually used to control the router configuration
when the router is first installed. It may be the only port which is allowed to
configure the filter table (used to prevent unauthorised access between the
connected networks).
Block diagram of a complete router showing the interfaces
Interfaces to the network (over which packets are received or
transmitted) are shown left, and the control interface (used to set
up and reconfigure the router) is shown right.
In the simplest case, the processing of packets is implemented in the general
purpose processor which implements all the algorithms. More advanced routers may
separate "forwarding" (the tasks of moving packets from one interface to
another) from "routing" (the task of determining the best path through
the network) and include a number of processors capable of performing these
tasks. A router interface card resembles the LAN Network Interface Cards (NICs)
used in PCs except that the card is normally of a higher specification (faster
packet processing). The very first routers were designed used standard network
interface cards, but modern high performance routers use special high
performance interface cards and may also include a "Forwarding Engine" on-board
the card which speeds the operation.
Router Network Interface Card
Received packets are processed by the link layer protocol controller,
which handles the link layer protocol (e.g. HDLC, Ethernet) used over the
physical link (cable). This also checks the received frame integrity (size,
checksum, address, etc). Valid frames are converted to packets by removing the
link layer header and are queued in the receive queue. This is usually a
First-In-First-Out (FIFO) queue, often in the form of a ring of memory buffers.
The buffers are passed (drained) into the input to the forwarding engine.
This takes each buffer, one at a time, and removes it from the interface
receiver. The packet is then forwarded to an appropriate output interface,
corresponding to the "best" path to the destination specified in the destination
address of the IP packet header.
At the output interface, the packet (together with a new link layer header)
is placed into a transmit queue until the link layer processor is ready
to transmit the packet.This, like the receive queue, is a FIFO queue, and
usually also takes the form of a ring of memory buffers.
Each out-going packet requires a new link layer protocol header to be added
(encapsulation) with the destination address set to the next system to the
receive the packet. The link protocol controller also maintains the hardware
address table associated with the interface. This usually involves using the
Address Resolution Protocol (arp) to find out the hardware (Medium Access
Control) addresses of other computers or routers directly connected to the same
cable (or LAN). The packet is finally sent using the media interface with the
hardware address set to the next hop system. When complete, the buffer (memory)
allocated to the frame, is "freed", that is, it is returned as an empty buffer
to the receive queue, where it may be used to store a new received packet.
You may think from this that the job of forwarding is not too difficult, and
involves a lot of copying of the packet data from one place to another. You
would be wrong on both counts! Forwarding actually involves lots of decisions.
Modern routers avoid copying the data in a packet if at all possible - this is a
significant processing cost, and may easily slow down a router to a very low
throughput. Instead, where ever possible, the router will leave the packet data
in the same place and instead pass information about where a
packet is stored in memory.
|