jump to navigation

Networking tutorial – part 2 / Layer 2 vs. Layer 3 February 28, 2011

Posted by TelUS Consulting Services in Data Networking catagory.

Flow Control

The transport layer is also responsible for data flow control, which refers to the way in which the receiving device can accept data transmissions. There are two common methods of flow control used, buffering and windowing:

  • Buffering – when buffering flow control is used, data is temporarily stored and waits for the destination device to become available. Buffering can cause a problem if the sending device transmits data much faster than the receiving device is able to manage it.
  • Windowing – in a windowing environment, data is sent in groups of segments that require only one acknowledgment. The size of the window (that is, how many segments fit into one acknowledgment) is defined at the time the session between the two devices is established. As you can imagine, the need to have only one acknowledgment for every, say, five segments can greatly reduce overhead.

Switching vs. Routing (Layer 2 vs. Layer 3)

A switch works at Layer 2 of the OSI model. It is a LAN device that can also be called a multi-port bridge. A switch switches Ethernet frames between Ethernet devices. Switches do not care about IP addresses nor do they even examine IP addresses as the frames flow through the switch. However, unlike a hub that just duplicates data and sends it out all ports, switches keep a bridge forwarding table that shows what MAC addresses have been seen on what port.

If a switch receives an Ethernet frame for a destination that it doesn’t have in its table, it floods that frame out to all ports (like a hub does all the time). However, the switch learns from the response of that flood and records the response to that frame in its forwarding table for the next time. Switches form collision domains. In other words, the switches “play traffic cop” with the inbound frames by buffering each packet before switching it. This way, there are no collisions and, to each device connected to the switch, it seems like that device has its own Ethernet segment and can talk at full speed, without risk of collisions.

A router on the other hand, works at Layer 3 of the OSI model. It is a WAN device that connects a LAN to a WAN or a subnetted LAN to another subnetted LAN. A router routes IP packets between IP networks. Routers do this using an IP routing table . In that table, they have either static or dynamic routes. When an IP packet comes in, the router looks up the destination IP in the IP routing table. If that destination IP is not found in the table the router drops the packet, unless it has a default route. Routers form broadcast domains because they drop broadcast packets.

Layer 3 switching

A Layer 3 switch works much like a router because it has the same IP routing table for lookups and it forms a broadcast domain. However, the “switch” part of “Layer 3 switch” is there because:

  • The layer 3 switch looks like a switch. It has 24+ Ethernet ports and no WAN interfaces.
  • The layer 3 switch will act like a switch when it is connecting devices that are on the same network.
  • The layer 3 switch is the same as a switch with the router’s IP routing intelligence built in.
  • The switch works very quickly to switch or route the packets it is sent.

In other words, the Layer 3 switch is really like a high-speed router without the WAN connectivity.

So why would one want the routing functionality of a router in their switch if they don’t have WAN interfaces. Well, the routing functionality of the Layer 3 switch is there to route between different subnets or VLANs. This means that the Layer 3 switch is really for large Ethernet networks that need to subnet into smaller networks. Most of the time, this is done using VLANs.

When it comes to Layer 3 switching, there are two kinds: hardware and software. With a hardware-based solution, the device is using an ASIC (a dedicated chip) to perform the function. With the software implementation, the device is using a computer processor and software to perform the function. Generally, Layer 3 switches and high-end routers route packets using hardware (ASICs) and general-purpose routers use software to perform routing functions.

A brief VLAN description

A VLAN is a virtual LAN. This virtual LAN is also an IP subnet. The difference between just subnetting a network and using VLANs is the flexibility that VLANs can provide for your LAN subnetting. Say that you have a single switch port in one VLAN, in one building. One hundred yards away, you can have another switch port, in another building. Both of those switch ports can be in the same VLAN and only those two switch ports can talk, despite the fact that they are separated by multiple buildings and are connected by a 100 yard fiber optic cable. Without a VLAN, this type of organization wouldn’t be possible.

In a traditional VLAN, switches tag the VLAN traffic, and only the devices on the same VLAN can communicate with one another. If devices on different VLANs need to communicate, they would talk to each other via a trunk port on a router. That trunk port and the processing power of the router would create a bottleneck for communications. With a Layer 3 switch, routing and trunking are performed at very high speeds.

Besides the functionality mentioned above, a VLAN has a number of other features such as:

  • Performance & broadcast control
  • Segregating departments or project networks
  • Security

This is not an effort to cover all that you need to know about VLANs. What you need to know is that Layer 3 switches are used to make VLANs easier and faster. Layer 3 switches make VLANs easier to configure because you don’t need a separate router between VLANs. All the routing can be done right on the switch. Layer 3 switches make VLANs faster because they eliminate the bottleneck that results from a router forming a single link between VLANs.

As I continue to discuss Networking I will cover a brief description of the remaining OSI model in my next blog. Until then…

Joe Buck, NCE

%d bloggers like this: