A router is a physical or virtual gateway that passes data between two (or more) packet-switched networks. Routers inspect the IP addresses of each packet and calculate the optimal way for the data to reach its desired destination. Routers operate at the network layer (Layer 3) of the OSI model.