5

I saw the STP on layer 2. The guy that made the tutorial says at the end :

Even though it seems that Layer 2 access layer solutions are slowly being replaced by blazing fast Layer 3 solutions.

But when we are routing with IP on layer 3, we are then going layer 2->1 and then 1->2->.. so do we use lower layers protocols ?

Or are they used only for LAN routing ?

1
  • Layer 3 delivery relies on layer 2 delivery, but layer 2 "routing" and layer 3 routing are completely different.
    – user253751
    Oct 31, 2018 at 2:19

4 Answers 4

11

Layer 3 (mostly IP) generally relies on the underlying layer-2 network (mostly Ethernet or Wi-Fi) for delivery. Just like a layer-2 network uses layer-1 links to actually move the bits.

The difference in moving data at layer 1, 2 or 3 is the complexity of the devices. Layer-1 devices (repeaters) just copied bits - simple, yet inefficient and long obsolete. Layer-2 devices (switches) intelligently forward frames and are very efficient, but layer-2 networks are limited in size. Layer-3 devices (routers) can handle networks of (theoretically) any size but their complexity initially prohibited building them in hardware. Software routers were slow and expensive, so they were only used where absolutely necessary. Of course, a router needs to have hardware for layers 2 and 1 as well.

Even though it seems that Layer 2 access layer solutions are slowly being replaced by blazing fast Layer 3 solutions.

The author describes the basic network architecture over time. Formerly, only layer-2 networks were used within a company network connected to the outside by (slow and expensive) routers. As technology advanced, routers became hardware-based and much faster. On the other hand, switches became more advanced and learned basic routing (layer-3 switching).

At the same time, networks grew much larger than they used to be, rendering the "layer 2 throughout" design obsolete - layer-2 networks only scale in a limited way.

With performance up and cost down, it became common design to use routers and layer-3 switch in the network core. Today, the layer-3 approach has grown outside from the core into the aggregation layer, enabling even larger networks. The next step is to also use routing instead of switching towards the access layer where the clients are connected.

Spanning Tree Protocol (STP) is very useful to organize your layer-2 connections. It takes care of preventing bridge loops in case of redundant mesh links in your network - bridge loops usually cause broadcast storms and MAC table instabilities that can take down your entire network.

With a network using layer-3 connections exclusively, you wouldn't need STP - but that would mean that each link is a subnet of its own and all connections between links are routed. While this is reasonable between the core and the aggregation layer and possibly between aggregation and access, it's rather pointless on the access layer towards the clients. Depending on network size, you might use a mix of L2 and L3 within the access layer.

2
  • These-days we route between buildings on the same campus especially, because it lets the broadcast domain in the building remain efficient, and helps prevent one building having a serious outage (storm, for example) from affecting another building. We might even route between "sectors" in the building, and even between VLAN's in those sectors. Oct 31, 2018 at 13:29
  • @Zac67 you're correct.
    – aletoledo
    Oct 31, 2018 at 19:17
5

It used to be, "Switch where you can, route where you must." That has been turned on its head. Of course, an interface, even on a layer-3 router, uses both layer-1 and layer-2 protocols. I think the idea is that the current best practices are moving toward routing all the way to the access switch. Within the access switch, you are still layer-2, but the access switches connect to the distribution via layer-3 connections and routing, and access switches do not connect to each other.

That means that a VLAN exists only on the single access switch, You can have multiple VLANs on a single access switch, but those VLANs do not extend to any other access switches. This will almost completely remove any STP or other layer-2 problems, e.g. broadcast storms, that can bring an entire site to its knees. We live in a layer-3 world, and it is now rare to have an application that needs the same VLAN across all the hosts. We route across the Internet, so why not route in your own network?

The reason it has been changing is that we now have a lot of layer-3 switches used as access switches that can route to the distribution.

8
  • Do we still use layer 2 protocols in LAN ?
    – Rom
    Oct 30, 2018 at 20:40
  • 1
    Yes we do, Ethernet and 802.11 (Wi-Fi) are layer 2 protocols.
    – Ron Trunk
    Oct 30, 2018 at 20:41
  • So when I'm connected on ethernet and I'm sending a packet, it's routed using layer 2 protocol until it reaches the router and then it uses IP routing ?
    – Rom
    Oct 30, 2018 at 20:46
  • Layer-2 doesn't route, it bridges frames. Layer-3 routes packets.
    – Ron Maupin
    Oct 30, 2018 at 20:47
  • 1
    Yes, bridges bridge frames using a table, or flooding of the frame if the destination is not in the table. The frames do not include a bridge ID. That is part of STP, and it is in the BPDUs sent by bridges to each other in order to determine a loop-free path. Bridges only look at the frame to forward the frames, but routers strip off the frame to get to the packet.
    – Ron Maupin
    Oct 30, 2018 at 21:12
4

The quote you quoted is simply misleading. All modern network devices transmit data at wire speed, so they're all "blazing fast." Whether it's layer 2 or 3 makes no difference in data rates.

A host will create data, and then encapsulate it in a lower level protocol data unit. So TCP gets encapsulated in IP, which gets encapsulated in 802.11, etc. It's all 1's and 0's when it leaves the computer. The receiving host reverses the process and de-encapsulates the data as it moves up the protocol software stack.

10
  • Yes, I think he meant how long it takes to get a spanning tree using the protocol
    – Rom
    Oct 30, 2018 at 20:40
  • Rapid Spanning Tree protocol (802.3w) is a significant improvement on convergence time.
    – Ron Trunk
    Oct 30, 2018 at 20:44
  • It most likely isn't misleading in the context in which it appeared, which I expect is about replacing layer 2 routing algorithms (which are simplistic) with layer 3 routing algorithms (which are more advanced). A layer 2 network is one with mostly switches and a layer 3 network is one with mostly routers - of course there is a very simple layer-2 network between each pair of routers, but if you're not doing any layer 2 switching then it's irrelevant.
    – user253751
    Oct 31, 2018 at 2:21
  • @immibis There is no routing at layer 2 because routing is a layer 3 function.
    – Ron Trunk
    Oct 31, 2018 at 2:51
  • 2
    @RonTrunk Fine then, layer 2 and layer 3 forwarding algorithms. Or if that doesn't work either, layer 2 and layer 3 algorithms to determine where to send a packet.
    – user253751
    Oct 31, 2018 at 4:04
1

IP over Ethernet (and sometimes wifi) is the dominant soloution for building networking and increasingly for long distance networking as well. IP and Ethernet don't look like they will lose their dominance.

Unfortunately Ethernet has scalability problems. It is fundamentally designed around a tree network and around discovery using broadcast or effectively broadcast packets.

There are technologies that can improve the scalability of Ethernet, VLANs to provide logical seperation and limit the spread of broadcast traffic, spanning tree for redundancy, link aggregation for performance but still it gets difficult to scale beyond a certain point, especially if you want to mix multiple vendors.

IP OTOH was designed to run massive networks, it runs the internet after all. Add to this that IP routing technology has got a lot more economical.

Modern switch ASICs can do IP forwarding as fast as they can do Ethernet bridging. So the question becomes rather than deal with hacks built on top of hacks to make Ethernet scale why not limit each Ethernet network to a small area (in the extreme case one switch) and then use IP routing to interconnect them.

In such a network ethernet is still in use, but technologies like spanning tree are no longer the way scaling is acheived.

Some have even taken it a step further, building virtual Ethernet networks on top of IP networks which in turn are built on small Ethernet networks, allowing applications to see a flat virtual Ethernet while using IP to manage the scaling.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.