A router is a networking device that connects at least two networks and forwards data packets along networks using headers and forwarding tables to determine the best path. A switch filters and forwards packets between network segments at the data link layer, using MAC addresses to identify which device is connected to each port. A hub copies packets arriving at one port to all other ports so all network segments can see all traffic, but it does not distinguish intended ports and bandwidth is shared, impacting performance when multiple devices broadcast.