VLAN & Trunk Cheat Sheet
The Layer-2 commands I keep reaching for, with the IOS and Junos spelling next to each other. Where a line is marked (IOS) or (Junos) only, the other platform has no direct equivalent.
VLANs
| Task | Cisco IOS | Junos |
|---|---|---|
| Create a VLAN | vlan 20 / name Servers | set vlans servers vlan-id 20 |
| List VLANs | show vlan brief | show vlans |
| VLAN membership of a port | show interfaces status | show ethernet-switching interfaces |
Access ports
! IOS
interface Gi1/0/5
description Printer
switchport mode access
switchport access vlan 20
spanning-tree portfast# Junos
set interfaces ge-0/0/5 description Printer
set interfaces ge-0/0/5 unit 0 family ethernet-switching interface-mode access
set interfaces ge-0/0/5 unit 0 family ethernet-switching vlan members servers
set protocols rstp interface ge-0/0/5 edgeTrunk ports
! IOS
interface Gi1/0/48
description Uplink to core
switchport trunk encapsulation dot1q ! older platforms only
switchport mode trunk
switchport trunk allowed vlan 10,20,30
switchport trunk native vlan 999 ! unused VLAN as native
switchport nonegotiate ! no DTP# Junos
set interfaces ge-0/0/47 description "Uplink to core"
set interfaces ge-0/0/47 unit 0 family ethernet-switching interface-mode trunk
set interfaces ge-0/0/47 unit 0 family ethernet-switching vlan members [ users servers voice ]
set interfaces ge-0/0/47 native-vlan-id 999Tip
Prune trunks to the VLANs that actually need to cross them, and never leave VLAN 1 as the native VLAN on a trunk that leaves the rack.
Spanning tree
| Task | Cisco IOS | Junos |
|---|---|---|
| Mode | spanning-tree mode rapid-pvst | set protocols rstp (default on EX) |
| Root bridge | spanning-tree vlan 1-4094 priority 4096 | set protocols rstp bridge-priority 4k |
| Edge port | spanning-tree portfast | set protocols rstp interface ge-0/0/5 edge |
| Protect edge ports | spanning-tree bpduguard enable | set protocols rstp bpdu-block-on-edge |
| Status | show spanning-tree / show spanning-tree root | show spanning-tree bridge / show spanning-tree interface |
Port channels
! IOS - LACP
interface range Gi1/0/1-2
channel-group 1 mode active
interface Port-channel1
switchport mode trunk# Junos - LACP
set chassis aggregated-devices ethernet device-count 2
set interfaces ge-0/0/0 ether-options 802.3ad ae0
set interfaces ge-0/0/1 ether-options 802.3ad ae0
set interfaces ae0 aggregated-ether-options lacp active
set interfaces ae0 unit 0 family ethernet-switching interface-mode trunkTroubleshooting
| What | Cisco IOS | Junos |
|---|---|---|
| MAC table | show mac address-table | show ethernet-switching table |
| Where is a MAC? | show mac address-table address aaaa.bbbb.cccc | show ethernet-switching table | match aa:bb:cc |
| Neighbours | show cdp neighbors / show lldp neighbors | show lldp neighbors |
| Errors on a port | show interfaces Gi1/0/5 | include error | show interfaces ge-0/0/5 extensive | match error |
| Trunk check | show interfaces trunk | show ethernet-switching interfaces ge-0/0/47 |
Last updated on