A switch is a device which sends a data packet in a local network. Layer 2 switch work on layer 2 of OSI model i.e. data link layer and sends a “Frames” to destination port using MAC address table which stores the mac address of a device associated with that port. It allows for the connection of multiple devices on a local area network (LAN) but can only work with MAC addresses.
Here are important functions of Layer 2 switching:
Layer 3 switch work on layer 3 of OSI model i.e. network layer where it route packet by using IP address. A Layer 3 switch has both MAC address table and IP routing table, therefore it can do all the job that a Layer 2 switch does. Additionally, it can do static routing and dynamic routing.
A Layer 3 switch combines the functionality of a switch and a router. It handles intra-VLAN communication and packets routing between different VLANs as well.
Here are important functions of Layer 3 switching:
Not exactly.
Just because a device is Layer 3-capable, doesn’t necessarily mean the device is performing routing. As a network administrator, you need to configure the device to route traffic between VLANs if that’s what you want. You can have a Layer 3-capable switch operating in Layer 2-only mode.
So what happens when a Layer 3 switch receives a packet from an end device? When inspecting the packet header, if that packet is destined for another VLAN, the Layer 3 switch “elevates” the packet to the routing layer. A decision is then made at the Layer 3 routing layer on where to send the packet—the switch consults the MAC address forwarding table to decide which port to send the outgoing packet on. And there you have it: a switch that makes routing decisions on traffic and therefore operates at Layer 3.
Layer 2 networks forward all their traffic, including ARP and DHCP broadcasts, so data transmitted by one device on L2 will be forwarded to all devices on the network. This type of broadcast traffic is very fast, but as the network gains in size it creates congestion and leads to inefficiency over the network.
Layer 3 traffic restricts broadcast traffic. Administrators on L3 can segment networks and restrict broadcast traffic to subnetworks, limiting the congestion of broadcast on large networks.
|
Layer 2 Switch |
Layer 3 Switch |
Network layer |
Operate on layer 2 (Data link) of OSI model. |
Operate on layer 3 (Network Layer) of OSI model. |
MAC vs. IP Address |
Send “frames” to destination on the basis of MAC address. |
Route Packet with help of IP address |
Routing function |
Simple switching by working with MAC address only; No routing |
Supports higher routing such as static routing and dynamic routing, |
Application |
Used to reduce traffic on local network; Pure Layer 2 domain |
Mostly Used to implement VLAN (Virtual Local area network); Aggregate multiple access switches |
Speed & Performance |
Quite fast as they do not look at the Layer 3 portion of the data packets. |
Takes time to examine data packets before sending them to their destination |
Broadcast domain |
It has single broadcast domain |
It has multiple broadcast domain. |
Communicating function |
Can communicate within a network only. |
Can communicate within or outside network. |
While you may not know it, you are already familiar with a layer 2 switch; your computer’s Ethernet connection acts as a data link layer, connecting your computer with the network via MAC addresses.
Another application of layer 2 switches is with software companies that have centrally located servers where clients who are dispersed across the globe, can access the one central server without latency.
Another real world application is in organizations that rely on internal communications but don’t need the internet – they may use a VLAN network via a layer 2 switch. A final example would be with software testers who want to keep their sharing tools centrally located, but allow another server to access them without being physically connected to the same network.
When MAC addresses are simply not enough, layer 3 switches can make use of the Internet Protocol (IP) Addresses to connect devices to different IP networks. You’ve already come into contact with a layer 3 switch via your internet router.
Other applications of layer 3 switches include university campuses or data centers that have vast computer networks set up. If a network has thousands of users or the network infrastructure requires heavy device management for the roll-out of patching or policy updates, or if you need specific control rules activated on certain devices within the network, a layer 3 switch is more appropriate due to its firewall protections.
PROS
CONS
PROS
CONS
The recommendation on whether to use a switch at Layer 2 or a Layer 3 depends in part on the size and complexity, and the security requirements, of the network you’re managing.
When designing your network topology, consider some of the following points: