Layer 2 Switching and VLANs · Topic 3 of 4
Configuring and Monitoring Interfaces, Ports and VLANs
Configure, monitor and troubleshoot Junos switch interfaces, ports and VLANs in ELS syntax, with LAG basics and the show commands that find faults.
- 5 min
- ELS access ports:
unit 0 family ethernet-switching interface-mode accessplusvlan members NAME. - Trunk ports use
interface-mode trunk; the native VLAN isnative-vlan-idon the physical interface. - VLANs are defined with
set vlans NAME vlan-id N.
What it is
This page ties the earlier concepts to the commands. It covers building a working Layer 2 port and VLAN configuration on an ELS switch, checking that it works and finding the usual faults.
The work has three parts: define the VLANs, put the ports into them with the right mode, and verify with show commands. Junos is a commit based system, so nothing takes effect until you commit.
How it works
Defining VLANs
user@switch# set vlans SALES vlan-id 10
user@switch# set vlans SALES description "Sales floor"
user@switch# set vlans ENG vlan-id 20
A VLAN needs a name and, to carry tagged traffic, a vlan-id. Interfaces refer to VLANs by name. The name is only local, while the ID is what travels in the tag, so two switches can use different names for the same ID, although that is confusing.
Configuring ports
An ELS port is a physical interface with a logical unit 0 that carries family ethernet-switching.
user@switch# set interfaces ge-0/0/1 description "Sales PC"
user@switch# set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode access
user@switch# set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members SALES
user@switch# set interfaces ge-0/0/24 unit 0 family ethernet-switching interface-mode trunk
user@switch# set interfaces ge-0/0/24 unit 0 family ethernet-switching vlan members [ SALES ENG ]
user@switch# set interfaces ge-0/0/24 native-vlan-id 99
The same configuration shown as hierarchy:
interfaces {
ge-0/0/24 {
native-vlan-id 99;
unit 0 {
family ethernet-switching {
interface-mode trunk;
vlan {
members [ SALES ENG ];
}
}
}
}
}
An interface can be taken out of service without deleting it using set interfaces ge-0/0/1 disable.
Not every port on an enterprise switch carries family ethernet-switching. A port that has family inet and an IP address on unit 0 is a routed port, which does no bridging.
Link aggregation
Several physical links can be bundled into one logical interface (ae0) using IEEE 802.3ad, usually with LACP.
user@switch# set chassis aggregated-devices ethernet device-count 2
user@switch# set interfaces ge-0/0/22 ether-options 802.3ad ae0
user@switch# set interfaces ge-0/0/23 ether-options 802.3ad ae0
user@switch# set interfaces ae0 aggregated-ether-options lacp active
user@switch# set interfaces ae0 unit 0 family ethernet-switching interface-mode trunk
user@switch# set interfaces ae0 unit 0 family ethernet-switching vlan members [ SALES ENG ]
The VLAN settings go on ae0, not on the member links. Verify with show lacp interfaces and show interfaces ae0 terse.
Monitoring
| Command | Shows |
|---|---|
show interfaces terse | Admin and link state of every interface, with logical units |
show interfaces ge-0/0/1 extensive | Counters, errors, speed, duplex and flags for one port |
show vlans | Each VLAN with its tag and member interfaces |
show ethernet-switching interface | Port state and the VLANs each port belongs to |
show ethernet-switching table | Learned MAC addresses |
show configuration interfaces ge-0/0/1 | The committed configuration of one port |
user@switch> show interfaces terse ge-0/0/1
Interface Admin Link Proto Local Remote
ge-0/0/1 up up
ge-0/0/1.0 up up eth-switch
The protocol eth-switch on the logical unit confirms that the port is configured for Layer 2 switching. The two up values on the physical line are the administrative state and the link state.
Troubleshooting a host that cannot connect
Work from the bottom up.
- Link: is the port
up upinshow interfaces terse? An admindownmeans it is disabled. A linkdownpoints to cabling, speed or the far end. - Mode and VLAN: does
show vlanslist the port under the right VLAN? Is the mode access where a host connects and trunk toward a switch? - Tags and native VLAN: do both trunk ends carry the same VLANs and the same native VLAN?
- MAC learning: does the host's MAC address appear in
show ethernet-switching tableon the expected port and VLAN? - Counters: do the errors in
show interfaces extensiveshow input errors, which suggests a duplex or cable fault?
Use show | compare before commit to see exactly what the pending change adds and removes. It catches a mistyped VLAN name before it reaches the live switch.
A commit that changes a trunk toward your own management path can lock you out. Use commit confirmed so the switch rolls back if you lose access.
Common mistakes
Forgetting unit 0 family ethernet-switching. A statement placed without the family does not make the port a bridged port.
Putting the VLAN under the wrong interface in a LAG. Settings belong on ae0.
Mixing ELS and older syntax. interface-mode goes with vlan members on the unit, while port-mode and ethernet-switching-options belong to non-ELS software.
Not committing. Candidate configuration is invisible to the traffic and to show interfaces until committed.
What to remember for the exam
- ELS access ports:
unit 0 family ethernet-switching interface-mode accessplusvlan members NAME. - Trunk ports use
interface-mode trunk; the native VLAN isnative-vlan-idon the physical interface. - VLANs are defined with
set vlans NAME vlan-id N. - LAG configuration puts
802.3ad ae0on the members and the VLAN settings onae0. show vlans,show ethernet-switching interface,show interfaces terseandshow ethernet-switching tableare the main checks.eth-switchinshow interfaces tersemarks a switching logical unit.commit confirmedprotects against lockout.
Check yourself
Where is
native-vlan-idconfigured in ELS?On the physical interface, for example
set interfaces ge-0/0/24 native-vlan-id 99.A host's port shows
up upbut the host's MAC address is not in the switching table. What do you check next?Whether the host sends traffic and whether the port is a member of the right VLAN in
show vlans.On a LAG, which interface gets the
vlan membersstatement?The aggregated interface,
ae0, not the member ports.
Topic 3 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.