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
In a nutshell
  • ELS access ports: unit 0 family ethernet-switching interface-mode access plus vlan members NAME.
  • Trunk ports use interface-mode trunk; the native VLAN is native-vlan-id on 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.

Define VLANsname and IDSet port modeaccess or trunkAdd VLAN membersCommitVerifyshow commands

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

CommandShows
show interfaces terseAdmin and link state of every interface, with logical units
show interfaces ge-0/0/1 extensiveCounters, errors, speed, duplex and flags for one port
show vlansEach VLAN with its tag and member interfaces
show ethernet-switching interfacePort state and the VLANs each port belongs to
show ethernet-switching tableLearned MAC addresses
show configuration interfaces ge-0/0/1The 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.

  1. Link: is the port up up in show interfaces terse? An admin down means it is disabled. A link down points to cabling, speed or the far end.
  2. Mode and VLAN: does show vlans list the port under the right VLAN? Is the mode access where a host connects and trunk toward a switch?
  3. Tags and native VLAN: do both trunk ends carry the same VLANs and the same native VLAN?
  4. MAC learning: does the host's MAC address appear in show ethernet-switching table on the expected port and VLAN?
  5. Counters: do the errors in show interfaces extensive show input errors, which suggests a duplex or cable fault?
Exam tip

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.

Watch out

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 access plus vlan members NAME.
  • Trunk ports use interface-mode trunk; the native VLAN is native-vlan-id on the physical interface.
  • VLANs are defined with set vlans NAME vlan-id N.
  • LAG configuration puts 802.3ad ae0 on the members and the VLAN settings on ae0.
  • show vlans, show ethernet-switching interface, show interfaces terse and show ethernet-switching table are the main checks.
  • eth-switch in show interfaces terse marks a switching logical unit.
  • commit confirmed protects against lockout.

Check yourself

  • Where is native-vlan-id configured in ELS?

    On the physical interface, for example set interfaces ge-0/0/24 native-vlan-id 99.

  • A host's port shows up up but 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 members statement?

    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.