Routing
In short: Routing is forwarding data packets across several networks to their destination. Routers do this.
In more detail: A router reads the destination IP address of a packet, looks into its routing table and sends the packet on to the next router (next hop). So it travels step by step until it arrives.
In Depth
- Routing table: it holds destination networks, the next router and a metric (cost). If several entries match, the most specific one wins (longest prefix, see subnet mask).
- Default gateway: the router to which a device sends everything not in its own network.
- Static or dynamic: static routes are entered by hand. Dynamic protocols (RIP, OSPF, BGP) exchange information and adapt to failures. BGP connects the big networks of the internet.
- TTL: every packet has a lifetime that drops at each router. This prevents endless loops.
- Seeing the path: tracert shows all routers on the way.
- Distinction: a switch forwards inside one network by MAC addresses, a router between networks by IP addresses.
See also: router, addressing types, ping