A router forwards data from one network to another based on an internal routing table and the destination address of the network. With that information, the router determines whether to send the packet out or keep it within the network.
Routers connect devices to networks, both locally and through the Internet. Routers direct network data, using data packets that have several layers of data. One of those layers carries essential information such as sender, data type, size, and most importantly, the destination IP address.
The router reads this layer and chooses the best transmission route. Routers in a local network (LAN) are dedicated to packet forwarding. They connect to stand-alone modems and Wi-Fi access points.
Switches can inspect incoming traffic and make forwarding decisions accordingly. Switches are typically faster than routers because they don’t waste time examining the network layer header information. Instead, they look at the hardware address of each frame to decide what to do with it – forward, flood, or drop.
Forward - frames are sent to a specific interface because the device's MAC address is included.
Flood - frames are flooded to all ports if a MAC address is missing in hopes the data will arrive where it is needed.
Drop - frames are dropped when connections are unstable.
A switch knows which device is connected to a particular port and forwards a frame based on the frame's MAC address. This reduces traffic and tightens security.