cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3720
Views
36
Helpful
6
Replies

Layer 3 Interfaces and STP

senmar
Level 1
Level 1

Currently learning for the CCNA Exam and there is a thing that i dont understand (and probably highlights another deficit):
Why does a Layer 3 Interface not need STP, it still has a MAC Address and uses Layer 2, why is there no danger of a layer 2 loop?

Do i have a general missunderstanding of layer 3 interfaces? Layer 3 Interfaces still use Layer 2 (and 1) correct?

 

Thanks for the Help!

1 Accepted Solution

Accepted Solutions

Joseph W. Doherty
Hall of Fame
Hall of Fame

"Why does a Layer 3 Interface not need STP, it still has a MAC Address and uses Layer 2, why is there no danger of a layer 2 loop?"

Actually, a routable L3 interface might need something like "STP", for L3 loop prevention, but it doesn't forward L2 frames like a L2 bridge interface can. I.e. the L3 interface cannot create a L2 loop, but it could create a L3 loop.

Also understand, both L2 and L3 interfaces only need something like STP to deal with loops. If there are no loops, they don't need such.

"Do i have a general missunderstanding of layer 3 interfaces? Layer 3 Interfaces still use Layer 2 (and 1) correct?"

Yes, I suspect you do. Also yes, L3 interfaces "use" L2 (and L1).

Further, in your later post, asking about L3 "packages" being split into L2 frames; hmm, yes but that's not really germane to dealing with L2 or L3 loops. L3 packets are encapsulated into L2 frames, i.e. they are the "data" field/content within L2 frames. If a L3 packet is larger than a single L2 frame can contain as its "data" it's up to the L3 protocol to deal with that situation. In IP, L3 can create packet fragments that can be used, one fragment per frame, so that a too large packet can be sent across multiple L2 frames. (NB: by default, IP sending hosts try to use L3 packets that will not exceed the capacity of one frame.) L2, itself, since "data" is only that, it doesn't know, nor care, if L3 does this, or not.

For a quick review, when an IP host transmit an IP packet, the L3 packet is encapsulated within a L2 frame which is transmitted as a sequence of bits (L1), on the wire.

If there's an Ethernet multi-port repeater (a hub) that receives the transmitted bits on one interface, it generates an identical copy on all other ports (with some very small time delay, perhaps one bit time).

If there's an Ethernet multi-port bridge (L2 switch) that receives the transmitted bits on one interface, it (on the typical store-and-forward L2 switch) takes different actions based on the type of frame it received and what it "knows".  If it doesn't "know" which port should get the received frame, it send an identical copy out on all the ports, except the one it received the frame on. (With store-and-forward switches, besides the delay of waiting to receive the whole frame, each port might have some other frames waiting to be transmitted before.)

If there's an Ethernet router that receives the transmitted bits on one interface, it de-encapsulates the L3 packets, and determines if it should forward that packet out another port. If it does, it re-encapsulates the L3 packet in a new L2 frame, which probably not only has different source and destination MAC addresses, but might be a frame for a whole different media type (like Ethernet to some serial media, or the reverse). An important thing to note (why there's no L2 loops), that for L3, it's only going to forward based on L3 information, it doesn't care what the ingress L2 frame was or use it w/o examination of the L3 content.

View solution in original post

6 Replies 6

balaji.bandi
Hall of Fame
Hall of Fame

High level - STP used to mitigated L2 Loops in the network, Layer3 working in different manner.

 

here is some reference to learn :

 

https://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/5234-5.html

https://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/10556-16.html

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello @senmar ,

an OSI layer 3 interface uses an OSI layer2 encapsulation to send and receive frames that contain an OSI layer 3 PDU like an IPv4 packet.

IPv4 has two features that are very interesting for this discussion:

a) IPv4 is a routable protocol and dynamic routing protocols like OSPF, EIGRP, IS-IS can deal with network redundancy without the need to block additional links like STP does, they actually support ECMP Equal cost multi path this makes a great difference in contexts like datacenters where traditional topologies using STP could have an high number of unused links

b) the IPv4 header contains the TTL field that allows to drop a packet if it is object of a routing loop: at each router hop the TTL is decremented and once TTL is 0 the packet is discarded. OSI Layer 2 frames lack this field and there is no way to drop frames in a loop.

In addition each link between two routers / multicast layer switch is in its own broadcast domain/Vlan and it has its own IP subnet.

 

Hope to help

Giuseppe

 

JELA
Level 1
Level 1

Hello @senmar,

 

All devices (PC, router, printer...) connected to ethernet networks must have a mac address, wich is their identity.

This is not because you have the ability to talk inside a layer 2 network that you MUST participate in layer 2 topology creation.

 

Only layer 2 topology devices (switches) are able to "speak" and "understand" spanning-tree message (other devices don't care about these kind of messages).

This type of messages (called BPDU) helps layer 2 network device (switches) to build a loop-free infrastructure.

 

So your router basically uses layer 2 to create layer 3 communication with other router through VLANs.

 

Where is becomes confusing is that some devices are "switchs" with "routing" features (also called MultiLayer switches).

Inside this kind of device, you have a virtual switch (all ports belongs to this device by default) and a virtual router.

To allow ports connected to the virtual switch to discuss with other devices with other adressing scheme, you can create a special type of interface called : Switch Virtual Inteface / interface Vlan / SVI to map a given Vlan with a Layer 3 interface.

  • This is probably here that were your confusion?

 

Is it more clear?

Good luck for your certification !!

Thanks everyone and especially @JELA for your help!
I think you found the source of my confusion, its less STP itself and more the Layer 2 / Layer 3 interaction.

 

So a Layer 3 Interface will use Layer 2 Infrastrucure (Frames etc.) to send its information (even Layer 3 Packages are split into Layer 2 Frames, which then will be reasembled by the next (?) Layer 3 device , right?). But it will ignore things like BPDUs that are not relevant to Layer 3?

I think ill have to dive back in to en-/decapsulation to get a better understanding of Layer 2 and Layer 3 networks and how they interact.

You are welcome, keep curious and your confusion will soon become knowledge !

 

I will use the assumption that you were dealing about a physical router interface when you say "layer 3 interface".

 

So if you connect a router physical interface to a network infrastructure (let say a switch), the following event will take place on the router:

- At layer 3, the router will encapsulate the information (receiver by upper layer) by adding the following fields "SRC IP" AND "DST IP"

- It will then "encapsulate" this packet in a layer 2 frame adding "SRC MAC" and "DST MAC" (you have to read about this process and especially understand how the ARP process take place in this part to get the DST MAC)

- This frame goes down to the physical layer

 

When you connect the router to the switch, operation are peformed in the opposite way:

- The physical layer collect your message, decapsulate information to get layer 2 frame

- At layer 2, the switch read "SRC MAC" and "DST MAC" and does not go further as this is a layer 2 device and :

  • store SRC MAC in its memory (now it knows that Router MAC @ connects to this port)
  • check in its memory if it known on which port the DST MAC is connected
  • send frame to the DST port (where the DST MAC is connected)

 

As you can see, the switch does not consider anything else than Layer 2 information..

More, the router does not consider Layer 2 spanning-tree message as it does not understand this language.

 

Hope this helps in your understanding of encapsulation / decapsulation.

 

Joseph W. Doherty
Hall of Fame
Hall of Fame

"Why does a Layer 3 Interface not need STP, it still has a MAC Address and uses Layer 2, why is there no danger of a layer 2 loop?"

Actually, a routable L3 interface might need something like "STP", for L3 loop prevention, but it doesn't forward L2 frames like a L2 bridge interface can. I.e. the L3 interface cannot create a L2 loop, but it could create a L3 loop.

Also understand, both L2 and L3 interfaces only need something like STP to deal with loops. If there are no loops, they don't need such.

"Do i have a general missunderstanding of layer 3 interfaces? Layer 3 Interfaces still use Layer 2 (and 1) correct?"

Yes, I suspect you do. Also yes, L3 interfaces "use" L2 (and L1).

Further, in your later post, asking about L3 "packages" being split into L2 frames; hmm, yes but that's not really germane to dealing with L2 or L3 loops. L3 packets are encapsulated into L2 frames, i.e. they are the "data" field/content within L2 frames. If a L3 packet is larger than a single L2 frame can contain as its "data" it's up to the L3 protocol to deal with that situation. In IP, L3 can create packet fragments that can be used, one fragment per frame, so that a too large packet can be sent across multiple L2 frames. (NB: by default, IP sending hosts try to use L3 packets that will not exceed the capacity of one frame.) L2, itself, since "data" is only that, it doesn't know, nor care, if L3 does this, or not.

For a quick review, when an IP host transmit an IP packet, the L3 packet is encapsulated within a L2 frame which is transmitted as a sequence of bits (L1), on the wire.

If there's an Ethernet multi-port repeater (a hub) that receives the transmitted bits on one interface, it generates an identical copy on all other ports (with some very small time delay, perhaps one bit time).

If there's an Ethernet multi-port bridge (L2 switch) that receives the transmitted bits on one interface, it (on the typical store-and-forward L2 switch) takes different actions based on the type of frame it received and what it "knows".  If it doesn't "know" which port should get the received frame, it send an identical copy out on all the ports, except the one it received the frame on. (With store-and-forward switches, besides the delay of waiting to receive the whole frame, each port might have some other frames waiting to be transmitted before.)

If there's an Ethernet router that receives the transmitted bits on one interface, it de-encapsulates the L3 packets, and determines if it should forward that packet out another port. If it does, it re-encapsulates the L3 packet in a new L2 frame, which probably not only has different source and destination MAC addresses, but might be a frame for a whole different media type (like Ethernet to some serial media, or the reverse). An important thing to note (why there's no L2 loops), that for L3, it's only going to forward based on L3 information, it doesn't care what the ingress L2 frame was or use it w/o examination of the L3 content.

Review Cisco Networking for a $25 gift card