Router Structure
Router
A router is a network-layer device that connects different networks and is responsible for moving packets from a source network toward a destination network.
When a packet arrives at a router, the router examines the destination address, consults its forwarding table, determines the appropriate output port, and forwards the packet to the next network.
A router can therefore be viewed as a device that performs the following basic operation:
Incoming packet ↓ Input Port ↓ Forwarding Table ↓ Switching Fabric ↓ Output Port ↓ Outgoing packet
The four main components of a router are:
- Input ports
- Output ports
- Routing processor
- Switching fabric
1. Input Ports
An input port is the point through which a packet enters the router.
It performs functions related to the physical layer and data-link layer.
The basic operations are:
Incoming signal ↓ Physical-layer processing ↓ Frame received ↓ Data-link-layer processing ↓ Packet extracted ↓ Error checking ↓ Input queue ↓ Switching fabric
Main functions
- Receives the incoming signal.
- Constructs the bits from the received signal.
- Decapsulates the packet from the data-link-layer frame.
- Checks the packet/frame for errors.
- Discards the packet if it is corrupted.
- Places the packet in an input buffer/queue until it can be transferred through the switching fabric.
The input port therefore contains:
- Physical-layer processor
- Link-layer processor
- Queue/buffer
2. Output Ports
An output port performs functions similar to the input port, but in the reverse direction.
The basic operation is:
Packet from switching fabric ↓ Output queue ↓ Encapsulate in data-link frame ↓ Physical-layer processing ↓ Signal sent
Main functions
- Receive the packet from the switching fabric.
- Store it temporarily in an output queue.
- Encapsulate the packet in a data-link-layer frame.
- Perform physical-layer processing.
- Convert the frame into a signal.
- Transmit the signal through the outgoing link.
An output port therefore also contains:
- Queue/buffer
- Link-layer processor
- Physical-layer processor
3. Routing Processor
The routing processor performs the major network-layer functions of the router.
When a packet arrives, the routing processor examines its destination address and uses the forwarding table to determine:
- The next hop
- The appropriate output port
This operation is often called a table lookup.
For example:
Destination IP ↓ Forwarding table ↓ Next-hop information ↓ Output port number
Important point
The routing processor is responsible for making the forwarding decision.
In newer routers, some of this functionality is moved to the input ports so that packets can be processed and forwarded more quickly.
4. Switching Fabric
The switching fabric is the internal mechanism that transfers a packet from an input queue to the appropriate output queue.
This is one of the most important parts of a router because the speed of the switching fabric affects:
- Packet-processing speed
- Queue size
- Packet delay
- Overall router performance
Conceptually:
Input Port 1 ──┐ Input Port 2 ──┤ Input Port 3 ──┤──→ Switching Fabric ──→ Output Port Input Port 4 ──┘
The textbook discusses three switching-fabric designs:
a. Crossbar Switch
A crossbar switch is a simple switching fabric.
It connects n inputs to n outputs using electronic microswitches at the crosspoints.
A suitable crosspoint is activated to connect an input to an output.
b. Banyan Switch
A Banyan switch is a multistage switching system.
It uses microswitches arranged in multiple stages. Packets are routed according to the binary representation of the destination output port.
For an n × n Banyan switch:
-
Number of stages =
log₂(n) -
Each stage contains
n/2microswitches.
For example, for 8 inputs and 8 outputs:
Number of stages = log₂(8) = 3
Suppose a packet needs to go to output 6.
The binary representation of 6 is:
6 = 110₂
The three stages use the three bits:
Stage 1 → 1 Stage 2 → 1 Stage 3 → 0
Thus, the packet is routed through the switching stages according to 110.
Problem with Banyan Switch
A Banyan switch can suffer from an internal collision.
Two packets may be going to different output ports but may still try to use the same internal switching path at the same time.
5. Batcher-Banyan Switch
The Batcher-Banyan switch is designed to overcome the internal-collision problem of the Banyan switch.
It combines:
Batcher sorting switch ↓ Trap ↓ Banyan switching network
Batcher switch
The Batcher switch first sorts incoming packets according to their destination ports.
Trap
A trap is placed between the Batcher and Banyan switches.
It prevents multiple packets destined for the same output port from entering the Banyan switch simultaneously.
If two packets have the same destination:
Packet A ──→ Destination 5 Packet B ──→ Destination 5
only one is allowed to proceed during the current tick. The other waits for the next tick.
Thus, the Batcher-Banyan combination reduces the switching conflicts that can occur in a Banyan switch.
Overall Structure of a Router
The complete router operation can be summarized as:
ROUTER ┌─────────────────────────────────────────┐ │ │ │ Input Ports │ │ ┌──────┐ │ Packet ─→│ Queue│───┐ │ │ └──────┘ │ │ │ ↓ │ │ ┌───────────────┐ │ │ │ Switching │ │ │ │ Fabric │ │ │ └───────────────┘ │ │ ↓ │ │ ┌───────────────┐ │ │ │ Output Queue │──→ Output Port │ │ └───────────────┘ │ │ │ │ Routing Processor │ │ → examines destination address │ │ → performs table lookup │ │ → determines output port │ │ │ └─────────────────────────────────────────┘
In simple terms
Think of a router like a parcel sorting center:
- Input port → receives the parcel.
- Routing processor → checks the destination and decides where it should go.
- Switching fabric → moves the parcel internally to the correct exit.
- Output port → prepares and sends the parcel to the next destination.
Key point to remember
Input ports receive packets, the routing processor determines where they should go, the switching fabric moves them internally, and output ports transmit them to the next network
Comments
Post a Comment