Switching operates at Layer using MAC addresses. Routers operate at Layer using IP addresses.
Switches:
- Forward frames within a single broadcast domain
- Use MAC address tables
- Fast hardware-based forwarding
Routers:
- Forward packets between broadcast domains
- Use routing tables with IP prefixes
- Segment broadcast traffic
When you send data to another network, your packet goes to the default gateway (router) first. The router forwards it toward the destination.