Computer Networks · Routing Basics
Switching vs Routing: Building and Using Routing Tables
Overview
A physical (MAC) address is only meaningful inside its own network, so reaching a host on another network requires a logical (IP) address.
Routers make the forwarding decision for each incoming packet, and to do so correctly they need routing tables. Two processes must be kept apart: routing builds the table, while switching uses it.
Key concepts
- Logical (IP) address: required for internetworking.
A physical (MAC) address is constant only within your own network and cannot uniquely identify a host across networks; to send a message outside your network, a logical address is required. - Switching: taking a packet from one network and deciding in which network to send it, using the routing table.
It is the process of taking a packet from one network and deciding into which network (out of the many connected) it should be sent.
Without switching, connecting one million computers directly would be a complete mess; switches simplify the organization. Broadly, switching covers how stations are connected and how packets are sent. - Router: a switch that makes the forwarding decision. A router is connected to many networks and must decide, for each incoming packet, which network or way to send it; this decision requires a routing table.
- Routing: the procedure used to build the routing table.
- Switching (using the table): using the routing table — when a packet comes in, deciding (using the routing table or some other method) where to put the packet.
Taking a packet and putting it on the outgoing link is also called switching. - Congestion: occurs when so many packets arrive that buffers become completely full and packets must be discarded.
Congestion-control methods exist at the network layer in general, but IP does not perform congestion control, so network-layer congestion control is not studied; congestion control is handled at the transport layer (TCP).
How it works
- Physical addresses are local to a network, so communication beyond the local network needs a logical address to identify the host uniquely.
- With a very large number of computers (for example, one million), direct full interconnection is a mess; switches connect networks in an organized way.
- A router is connected to many networks and must decide, for each incoming packet, which network or way to send it. This decision requires a routing table.
- Two distinct processes follow:
- Routing = building the routing table.
- Switching = using the routing table (or another method) to decide where to place an incoming packet, i.e., putting the packet on the outgoing link.
- Congestion control exists at the network layer in general, but the syllabus covers IP only, and IP does not do congestion control, so network-layer congestion control is skipped; congestion control is instead handled at the transport layer (TCP).
Comparison
| Aspect | Routing | Switching |
|---|---|---|
| Meaning | Building the routing table | Using the routing table to decide where to send a packet |
| Nature | A procedure/process | An action on each incoming packet |
| Performed by | Routing procedures at routers | Router, when a packet arrives (placing it on the outgoing link) |
| Aspect | Physical address | Logical address |
|---|---|---|
| Scope | Constant only within its own network | Required to reach hosts outside the network |
| Sufficient for internetwork delivery? | No | Yes |
Revision summary
- A physical address alone cannot uniquely identify a host across networks; a logical address is required for outside communication.
- Switching connects various networks and avoids the mess of directly interconnecting a huge number of computers.
- Switches that make forwarding decisions are called routers, and they need routing tables.
- Routing = building the routing table;
Switching = using the routing table (deciding where to put the packet / putting it on the outgoing link).
Many people confuse these two. - Congestion means buffers are full and packets must be discarded.
- IP does not perform congestion control, so network-layer congestion control is not covered; congestion control is done at the transport layer (TCP).
Previous-year exam insights
- A bridge/switch is a layer-2 device that forwards frames based on MAC addresses, reduces the collision domain (each port is its own collision domain) but does NOT reduce the broadcast domain; a router is a layer-3 device that forwards packets based on IP addresses and does reduce the broadcast domain.
Asked inGATE 2005GATE 2004UGC NET 2017 - A transparent bridge builds its forwarding table (MAC address table) by inspecting the source MAC address of incoming frames (backward learning) and forwards/floods based on the destination MAC; a router builds its table by running routing protocols, not by inspecting packet addresses.
Asked inGATE 2004 - The spanning tree algorithm is used in bridge-based networks to avoid loops (which would cause broadcast storms and duplicated frames) by disabling redundant links, not for shortest-path routing, fault tolerance or collision minimization.
Asked inGATE 2005 - Devices that connect networks using different technologies/protocols are routers (layer-3 internetworking devices); bridges/switches connect similar LANs at layer 2, and hubs/modems do not perform internetworking.
Asked inUGC NET 2012 - Routing (building the routing table) and forwarding/switching (using the table per packet) are separate functions; the forwarding decision is a table lookup on the destination address, and the table entry gives the next hop and outgoing interface.
- A hub is a layer-1 device that repeats signals to all ports (one collision domain, one broadcast domain); a switch forwards selectively by MAC address; a gateway performs protocol conversion across dissimilar architectures.
Asked inUGC NET 2017