A router is an Intermediate System (IS) which operates at the network layer of the OSI reference model. Routers may be used to connect two or more IP networks, or an IP network to an internet connection.

A router consists of a computer with at least two network interface cards supporting the IP protocol. The router receives packets from each interface via a network interface and forwards the received packets to an appropriate output network interface. Received packets have all link protocol headers removed, and transmitted packets have a new link protocol header added prior to transmission.

The router uses the information held in the network layer header (i.e. IP header) to decide whether to forward each received packet, and which network interface to use to send the packet. Most packets are forwareded based on the packet's IP destination address, along with routing information held within the router in a routing table. Before a packet is forwarded, the processor checks the Maximum Transfer Unit (MTU) of the specified interface. Packets larger than the interface's MTU must be fragmented by the router into two or more smaller packets. If a packet is received which has the Don't Fragment (DF) bit set in the packet header, the packet is not fragmented, but instead discarded. In this case, an ICMP error message is returned to the sender (i.e. to the original packet's IP source address) informing it of the interface's MTU size. This forms the basis for Path MTU discovery (PMTU).

The routing and filter tables resemble similar tables in link layer bridges and switches. Except, that instead of specifying link hardware addresses (MAC addresses), the router table sepcify network (IP addresses). The routing table lists known IP destination addresses with the appropraite network interface to be used to reach that destiantion. A default entry may be specified to be used for all addresses not explicitly defined in the table (this is very common in routers close to the edge of the networ, where the default routes packets towards the Internet backbone).

A filter table may also be used to ensure that unwanted packets are discarded. The filter may be used to deny access to particular protocols or to prevent unauthorised access from remote computers by discarding packets to a specified destination address. Routers at the edge of ISP networks also often perform filtering of the IP source address, as a way to prevent "spoofing" of addresses belonging to other networks.

A router forwards packets from one IP network to another IP network. Like other systems, it routes based on the longest-prefxi match of the IP addresss in the routing table. One exception to this rule is when a router receives an IP packet to a network broadcast address. In this case, the router will process the packet internally (to see if it needs to respond) and then discards the packet. Forwarding broadcast packet can lead to severe storms of packets, and if uncontrolled could lead to network overload.

A router introduces delay (latency) as it processes the packets it receives. The total delay observed is the sum of many components including:

The router queue of packets waiting to be sent also introduces a potential cause of packet loss. Since the router has a finite amount of buffer memory to hold the queue, a router which receives packets at too high a rate may experience a full queue. In this case, the router ahs no other option than to simply discard excess packets. If required, these may later be retransmitted by a transport protocol.

Architecture of a router

Routers are often used to connect together networks which use different types of links (for instance an HDLC or PPP link connecting a WAN to a local Ethernet LAN). The optimum (and maximum) packet lengths (i.e. the maximum transmission unit (MTU)) is different for different types of network. A router may therefore uses IP to provide segmentation of packets into a suitable size for transmission on a network.

Associated protocols perform network error reporting (ICMP), communication between routers (to determine appropriate routes to each destination) and remote monitoring of the router operation (network management).

The operation of a simple modern router is described on a separate page. If you want to know how the router actually works click HERE.

See also




Operation of a Router

Gorry Fairhurst - Date: 01/06/2011 EG3557