A router is a device for connecting computer networks to one another, used for handling the routing of packets between two networks, or to determine the path that a data packet shall take.
The workstation sends the request to the nearest router, i.e. to the default gateway on the network it is located on. This router determines the next machine to which the data will be forwarded, in such a way as to choose the best pathway possible. To do so, the routers keep up-to-date routing tables, which are like maps showing the paths that can be taken to get to the destination address. There are numerous protocols designed to handle this process.
In addition to their routing function, routers are also used to manipulate data travelling in the form of datagrams so that they can go from one kind of network to another. As not all networks are able to handle the same size of data packets, routers are tasked with fragmenting packets so they can travel freely.
The first routers were simply computers with multiple network cards, with each one linked to a different network. Current routers are mostly hardware designed for routing, generally in the form of 1U servers.
A router has several network interfaces, with each one connected to a different network. Therefore, it has one IP address for every network it is connected to.
A wireless router is the same in principle as a traditional router, the difference being that it lets wireless devices (such as WiFi stations) connect to the networks which the router is connected to by wired connections (usually Ethernet).
There are two major types of routing protocols: