In packet-switched networks such as the internet, a router is a device or, in some cases, software on a computer, that determines the best way for a packet to be forwarded to its destination.
A router connects networks. Based on its current understanding of the state of the network it is connected to, a router acts as a dispatcher as it decides which way to send each information packet. A router is located at any gateway (where one network meets another), including each point-of-presence on the internet. A router is often included as part of a network switch.
A router may create or maintain a table of the available routes and their conditions and use this information along with distance and cost algorithms to determine the best route for a given packet. Typically, a packet may travel through a number of network points with routers before arriving at its destination. Routing is a function associated with the network layer (Layer 3) in the standard model of network programming, the Open Systems Interconnection (OSI) model. A Layer 3 switch is a switch that can perform routing functions.
An edge router is a device located at the boundary of a network that connects to other networks, wide area networks or the internet. For home and business computer users who have high-speed internet connections such as cable, satellite or DSL, a router can act as a hardware firewall. Many engineers believe that the use of a router provides better protection against hacking than a software firewall because no computer internet protocol addresses are directly exposed to the internet. This makes port scans (a technique for exploring weaknesses) essentially impossible. In addition, a router does not consume computer resources, which a software firewall does. Commercially manufactured routers are easy to install and are available for hard-wired or wireless networks.