
A switch primarily connects devices within a local network, while a router connects different IP networks and decides where packets should go next. Traditional Ethernet switches use MAC addresses to forward frames inside a LAN. Routers use IP addresses and routing tables to forward packets between networks.
That distinction is the essential starting point, although modern enterprise switches can also perform Layer 3 routing. Understanding routers and switches is fundamental to CCNA, Network+ and practical network administration.
Router vs switch at a glance
| Switch | Router |
|---|---|
| Connects devices within a LAN | Connects different IP networks |
| Traditionally operates mainly at OSI Layer 2 | Operates mainly at OSI Layer 3 |
| Uses MAC addresses for Layer 2 forwarding | Uses IP addresses and routing tables |
| Creates separate collision domains per port | Separates broadcast domains |
| Supports VLANs and trunks | Routes between subnets and external networks |
| Modern multilayer switches can also route | May provide WAN, NAT, VPN and security functions |
What does a network switch do?
A network switch connects Ethernet devices within a local-area network.
Devices might include:
- desktop computers
- servers
- printers
- IP phones
- wireless access points
- security cameras
- other switches
The switch receives Ethernet frames and determines which port should be used to reach the destination device.
How does a switch learn MAC addresses?
Ethernet interfaces have Layer 2 addresses called MAC addresses.
When a switch receives a frame, it examines the source MAC address and learns which switch port that source can be reached through. The switch records this information in a MAC address table.
When a future frame is destined for a known MAC address, the switch can forward it towards the appropriate port rather than sending it everywhere.
What happens if a switch does not know the destination?
If the destination MAC address is unknown within the VLAN, the switch normally floods the frame out other relevant ports in that VLAN.
When the destination responds, the switch learns its location and future traffic can be forwarded more precisely.
What does a router do?
A router connects Layer 3 IP networks.
For example, it can route traffic between:
- 10.10.10.0/24
- 10.10.20.0/24
It can also connect an internal organisation to:
- the internet
- a branch office
- a cloud network
- a service provider
- another routing domain
The router examines the destination IP address and consults its routing table to determine the best available next hop or outgoing interface.
What is a routing table?
A routing table contains information about IP networks the device knows how to reach.
Routes can be learned through:
- directly connected networks
- static routes configured by an administrator
- dynamic routing protocols such as OSPF or BGP
If no more specific route is available, the router may use a default route.
MAC address vs IP address
This is central to understanding the difference between switching and routing.
MAC addresses are used for local Layer 2 Ethernet delivery.
IP addresses identify interfaces and networks at Layer 3 and support routing across multiple networks.
A packet travelling across several routers keeps its IP source and destination broadly associated with the end-to-end conversation, while the Layer 2 frame addressing changes as the packet moves across different local links.
What is the OSI model?
The OSI model provides a layered way of understanding network communication.
Traditional switching is associated mainly with:
Layer 2 - Data Link
Routing is associated mainly with:
Layer 3 - Network
Modern network devices often perform functions across several layers, so these labels are useful concepts rather than rigid product categories.
What is a Layer 2 switch?
A Layer 2 switch forwards Ethernet frames within VLANs using MAC-address information.
If devices belong to different IP subnets or VLANs, a Layer 2 switch alone does not normally route between them.
A router, firewall or Layer 3 switch provides that Layer 3 connectivity.
What is a Layer 3 switch?
A Layer 3 switch, also called a multilayer switch, combines high-speed Ethernet switching with IP routing capabilities.
It can:
- switch frames within VLANs
- create Layer 3 switched virtual interfaces
- route between VLANs
- support static or dynamic routing depending on the platform
- apply Layer 3 policies
In enterprise campus networks, Layer 3 switches commonly perform inter-VLAN routing.
If Layer 3 switches can route, why use routers?
Routers and Layer 3 switches overlap, but product roles still differ.
Routers are commonly designed for:
- WAN connectivity
- internet edge connectivity
- advanced routing features
- VPNs
- service-provider connectivity
- NAT
- specialised interface types
Layer 3 switches are often optimised for high-speed switching and routing inside campuses and data centres.
The exact distinction depends on modern product capabilities and network architecture.
What is a default gateway?
A device uses its default gateway when the destination is outside the local IP subnet.
Suppose a computer has:
- IP address: 192.168.10.25
- prefix: /24
- default gateway: 192.168.10.1
If the computer needs to reach 192.168.20.50, it recognises that the destination is not in its own /24 network and sends the packet towards the default gateway.
The gateway then routes the packet towards the destination network.
Switching and VLANs
Switches use VLANs to create separate Layer 2 broadcast domains.
Ports can be configured as:
- access ports for one primary VLAN
- trunk ports carrying multiple VLANs
Devices in different VLANs need Layer 3 routing to communicate.
See What Is a VLAN?.
Routing and subnetting
Routing only makes sense when there are different IP networks to route between.
Subnetting divides address space into those networks.
For example:
- VLAN 10 / 10.10.10.0/24
- VLAN 20 / 10.10.20.0/24
A Layer 3 device can route packets between them.
See What Is Subnetting? for a beginner's guide.
Do home routers contain switches?
Yes, many consumer devices combine several functions into one box.
A typical home broadband router may contain:
- a router
- a small Ethernet switch
- a wireless access point
- a firewall
- NAT
- DHCP services
This is why the word “router” in a home environment can describe a multifunction device rather than one dedicated routing component.
What is NAT?
Network Address Translation changes IP address information as traffic passes through a routing or firewall device.
Home and business networks commonly use private IPv4 addresses internally and translate them when accessing the public internet.
NAT is often associated with routers and firewalls rather than basic Layer 2 switches.
What is a wireless router?
A wireless router combines routing with Wi-Fi access and commonly includes Ethernet switching as well.
In larger enterprise environments, these functions are usually separated. Wireless access points connect to managed switches, while routers or firewalls provide Layer 3 and WAN connectivity.
What is a managed switch?
A managed switch allows administrators to configure and monitor networking features.
Capabilities can include:
- VLANs
- 802.1Q trunks
- Spanning Tree Protocol
- EtherChannel
- port security
- Power over Ethernet
- quality of service
- SNMP and logging
- Layer 3 routing on supported models
Enterprise Cisco switches are managed network devices.
What is an unmanaged switch?
An unmanaged switch is designed for simple plug-and-play Ethernet connectivity with little or no configuration.
It may be appropriate for a very small environment but does not provide the control and visibility expected in larger managed networks.
What is Power over Ethernet?
Power over Ethernet, or PoE, allows compatible switches to provide electrical power over Ethernet cabling to devices such as:
- wireless access points
- IP phones
- security cameras
- IoT devices
Cisco notes that modern PoE switching can provide significant power levels depending on the relevant PoE standard and switch capability.
What is a collision domain?
In modern switched Ethernet, each switch port normally represents its own collision domain.
This is a major improvement over older hub-based Ethernet, where several devices shared the same collision domain.
Full-duplex switched Ethernet effectively removes normal Ethernet collisions from modern point-to-point links.
What is a broadcast domain?
A broadcast domain is the group of devices that receive a Layer 2 broadcast.
Routers do not normally forward Ethernet broadcasts from one IP network to another.
VLANs allow a switch to create several separate broadcast domains.
Router vs firewall
A router's primary job is to forward traffic between networks. A firewall's primary job is to enforce security policy between traffic flows.
Modern routers can include firewall capabilities and modern firewalls can route, so the features can overlap. In enterprise design, the role and policy requirement are more important than assuming a product can only do one function.
Router vs modem
A modem or other provider termination device connects to the service delivered by an ISP. A router connects IP networks.
Consumer broadband devices often combine modem, router, firewall, switch and wireless functions, which is why these terms are sometimes confused.
Which device do you need?
For a typical business network, you usually need both switching and routing functions.
Use switching to connect devices inside local VLANs.
Use routing to connect those VLANs to each other and to external networks.
In a small environment, one product may provide both. In a larger enterprise, dedicated switches, routers and firewalls divide the responsibilities.
Common troubleshooting questions
When connectivity fails, useful questions include:
- Is the physical switch port up?
- Is the device in the correct VLAN?
- Does it have the correct IP address and subnet mask?
- Can it reach another device in the local subnet?
- Is the default gateway correct?
- Does the router have a route to the destination network?
- Is a firewall or ACL blocking the traffic?
- Is the return route available?
This layered approach helps determine whether the problem is local switching, IP configuration, routing or policy.
Frequently asked questions
Is a switch faster than a router?
The comparison is not very meaningful because they perform different roles and modern devices vary widely in performance. Enterprise switches are commonly designed for very high-speed local forwarding, while routers handle Layer 3 connectivity and additional services.
Can a switch connect to the internet?
A Layer 2 switch can connect devices towards an internet gateway, but it does not normally replace the router or firewall that provides external Layer 3 connectivity.
Can a router work without a switch?
Yes, in a small environment a router may have enough built-in Ethernet ports. Larger networks use switches to provide scalable local connectivity.
Can a Layer 3 switch replace a router?
It can perform many routing functions inside an enterprise network, but dedicated routers may still be needed for WAN, internet-edge or specialised routing requirements.
What is the difference between a hub and a switch?
A hub repeats incoming Ethernet signals to other ports. A switch learns MAC addresses and forwards frames more intelligently to the relevant port.
Does a switch have an IP address?
A managed switch can have one or more IP addresses for management and, if it is a Layer 3 switch, for routed interfaces and SVIs. Layer 2 forwarding itself is based on MAC addresses.
Develop your networking skills with ExperTrain
ExperTrain offers instructor-led Cisco training for networking professionals from associate through advanced specialist levels.
The Implementing and Administering Cisco Solutions (CCNA) course develops practical skills in switches, routers, IPv4 and IPv6, VLANs, routing, wireless, security, automation and network management.
You can also use the Cisco Glossary, read What Is a VLAN? and What Is Subnetting?, or compare CompTIA Network+ vs CCNA.
Further reading
Found this article useful? Add ExperTrain as a Preferred Source on Google to help surface more of our training guides, articles and learning resources.




