A router is a computer whose software and hardware are customized to move data between computer networks. They are responsible for making sure traffic between computers gets where it needs to go. They do this by choosing the shortest path between the computers using a complicated system of rules called routing protocols. Routers generally contain a specialized operating system, RAM, NVRAM, flash memory, and one or more processors, as well as two or more network interfaces. They come in a variety of sizes from something you could hold in your hand to something too large for one person to lift.
If you have an internet connection, you probably have a router somewhere that your computer sends data to. This is the first router your computer will connect to in order to get to the internet. It is also known as a default gateway (because it is your gateway to the internet). By convention the gateway has the lowest IP address (like a phone number for a computer) in the subnet (a group of addresses). Anytime you make a connection (such as a connection to www.wikipedia.org) your computer looks up the IP address using the look-up service called DNS (Domain Name Service). Once the destination address has been found your computer connects to your gateway router. The gateway then sends data to a router at your ISP (Internet Service Provider), that router can be said to be part of the internet and connects to other routers until the data reaches the destination.
In small networks such as homes, small businesses (including internet cafés) and small schools, the router also performs NAT (network address translation) which makes all outgoing connections look like they come from one address. Typically, incoming connections are only allowed if they are replies to connections made by a computer inside the NAT.
Routers connect two or more networks and direct traffic between them. These networks may be physical (the network is associated with a port) or logical (not associated with a port on the router). The term layer 3 switch often is used the same as 'router', but it is a general term without a technical definition. Layer 3 switch implies a device that is built to connect Ethernet devices in a LAN but can also perform routing.
Router operating systems are split into two parts:
- Requirements for IPv4 Routers,RFC 1812, F. Baker,June 1995
- Requirements for Separation of IP Control and Forwarding,RFC 3654, H. Khosravi & T. Anderson,November 2003