Layer 2 Switching and VLANs · Topic 1 of 4
Bridging Components and Frame Processing
Learn how a Junos switch bridges: the Ethernet switching table, MAC learning, forwarding, flooding, filtering, aging and the show commands that check it.
- 5 min
- A switch forwards by destination MAC address and learns from the source MAC address.
- Unknown unicast, broadcast and multicast frames are flooded to all other ports in the VLAN.
- A frame whose destination is on the ingress port is filtered.
What it is
A bridge connects network segments at Layer 2 and forwards Ethernet frames by destination MAC address. A Junos switch is a multiport bridge. It decides where to send each frame by looking up its Ethernet switching table, which maps MAC addresses to ports.
The main building blocks are:
| Component | Role |
|---|---|
| Port | A physical or logical interface (such as ge-0/0/1 or ae0) that frames enter and leave |
| VLAN (bridge domain) | A broadcast domain; frames stay inside the VLAN they belong to |
| Ethernet switching table | The MAC address table, kept per VLAN |
| Broadcast domain | All ports in one VLAN; a broadcast reaches all of them |
| Collision domain | One per switch port, so full duplex links have no collisions |
Every port on a switch is its own collision domain, but all ports in one VLAN share one broadcast domain. Routers, or a switch's routed interfaces, separate broadcast domains.
How it works
The four frame decisions
A switch examines every frame it receives and does the following, in this order.
- Learn: it records the frame's source MAC address and the ingress port in the table for that VLAN.
- Look up: it searches the table for the destination MAC address in the same VLAN.
- Forward: if the destination is known on a different port, it sends the frame out of that port only.
- Flood or filter: if the destination is unknown, or is a broadcast or multicast address, it floods the frame out of every other port in the VLAN. If the destination is known on the port the frame arrived on, it filters (drops) the frame.
A frame is never sent back out of the port it arrived on, even when it is flooded.
Frame types and treatment
| Frame | Destination | Switch action |
|---|---|---|
| Known unicast | MAC in the table | Forward to one port |
| Unknown unicast | MAC not in the table | Flood in the VLAN |
| Broadcast | ff:ff:ff:ff:ff:ff | Flood in the VLAN |
| Multicast | Group MAC address | Flood in the VLAN unless snooping limits it |
Only source addresses are learned. A broadcast or multicast address is never a source address, so it never appears in the table.
Learning and aging
Learned entries are dynamic. Each entry has an aging timer that restarts whenever the switch sees a frame from that source. If the timer runs out, the entry is removed. The default aging time is 300 seconds.
user@switch# set protocols l2-learning global-mac-table-aging-time 600
An address that moves to a new port is learned again on the new port, and the old entry is replaced. You can also add static entries, which do not age.
Viewing the table
user@switch> show ethernet-switching table
Ethernet switching table : 2 entries, 2 learned
Routing instance : default-switch
Vlan MAC MAC Age Logical
name address flags interface
SALES 00:50:56:aa:bb:01 D - ge-0/0/1.0
SALES 00:50:56:aa:bb:02 D - ge-0/0/2.0
The D flag marks a dynamic entry. Each row ties a VLAN name, a MAC address and a logical interface together. The command clear ethernet-switching table removes the learned entries so that the switch learns them again.
Frame processing on a Junos switch
A switch also decides which VLAN a frame belongs to before it learns anything. A frame that arrives on an access port is untagged and takes the VLAN of that port. A frame that arrives on a trunk port is placed in the VLAN named in its 802.1Q tag. The next page covers tagging in detail.
The MAC table is per VLAN. The same MAC address can legitimately appear in two VLANs, with two separate entries.
To find which port a host is on, look up its MAC address in show ethernet-switching table. To find the MAC address that goes with a host's IP address, use show arp on the switch's routed interface.
Common mistakes
Expecting broadcasts to cross VLANs. A broadcast is flooded only inside the VLAN on which it arrived. Reaching another VLAN needs a routed interface.
Thinking the switch learns destination addresses. It learns source addresses only. A destination that has never sent a frame stays unknown, and frames for it are flooded.
Forgetting aging. An idle host's entry disappears after the aging time. The next frame for that host is flooded until the host sends something again.
Do not confuse the collision domain with the broadcast domain. A switch splits collision domains per port but does not split broadcast domains. Only VLANs and routers do.
What to remember for the exam
- A switch forwards by destination MAC address and learns from the source MAC address.
- Unknown unicast, broadcast and multicast frames are flooded to all other ports in the VLAN.
- A frame whose destination is on the ingress port is filtered.
- Each port is a collision domain; each VLAN is a broadcast domain.
- The Ethernet switching table is kept per VLAN.
- Dynamic entries age out after 300 seconds by default;
global-mac-table-aging-timeunderprotocols l2-learningchanges it on ELS switches. show ethernet-switching tabledisplays the table andclear ethernet-switching tableflushes learned entries.
Check yourself
A frame arrives with a destination MAC address that is not in the table. What does the switch do?
It floods the frame out of every other port in the same VLAN.
Which address does a switch learn from a frame, and what does it store with it?
It learns the source MAC address and stores it with the ingress port and VLAN.
How many broadcast domains and collision domains does a 24 port switch with one VLAN and all ports in use have?
One broadcast domain and 24 collision domains, one per port.
Topic 1 of 4 in Layer 2 Switching and VLANs
Test yourself on Layer 2 Switching and VLANs
The full Juniper JNCIS-ENT JN0-352 question bank has 846 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.