In networking, routing is the process of moving a packet of data from source to destination. The principles of routing can apply to many networks such as circuit-switched networks and computer networks. Routing is typically performed by a specialized device known as a router.
Routing is a core feature of the internet, where the router selects the paths for Internet Protocol (IP) packets to travel from their origin to the destination. The routing process performed by a router typically directs forwarding on the basis of routing tables, which maintain a record of the routes to various network destinations. A routing table can be compared to a train timetable, where train passengers consult the timetable to decide which train to catch. Routing tables function in the same way, but for network paths rather than trains. These tables may be specified by an administrator, learned by observing network traffic, or built with the assistance of routing protocols.
When a router receives a packet, it reads the headers of the packet to see its intended destination. It then determines where to route the packet based on information in its routing table. As a packet travels to its destination, it may be routed multiple times by several routers. Routers perform this process millions of times a second with millions of packets.
There are three main types of routing: