Skip to content

Switching and Layer 2

netverdict models Layer 2 as deterministic forwarding state. The goal is to make access-layer labs, loop-prevention checks, trunk mistakes, and neighbour visibility reproducible, not to emulate a particular switching ASIC.

For narrower pages, see VLAN, STP, EtherChannel, Discovery, and Layer-2 Security.

AreaLevelWhat this means
Ethernet MAC learningSupportedSource MAC learning, unknown-unicast flooding, known-unicast forwarding, and ageing-style state.
VLAN access portsSupportedAccess VLAN assignment and per-VLAN broadcast domains.
802.1Q trunksSupportedAllowed VLAN lists, native VLAN handling, tagged forwarding, and trunk show output.
SVIs and routed VLANsSupportedinterface VlanX can provide a routed gateway for a VLAN.
Router subinterfacesSupportedDot1Q subinterfaces participate in VLAN-aware routing.
STP / PVST+SupportedReal BPDU exchange, root election, forward-delay ladder, TCN. PVST+ runs one tree per VLAN.
RSTP / MSTSupportedProposal/agreement handshake and MST per-instance trees. Every MST switch is in one region; see STP.
BPDU guard / inconsistent stateBehaviour modelEdge-protection and blocked/error state can affect forwarding.
EtherChannelSupportedPort-channel interfaces and member selection.
LACPBehaviour modelActive/passive eligibility and bundled/suspended member state. LACPDUs are on the wire in a capture (Packet Lens), decoded by Wireshark.
PAgPBehaviour modelAuto/desirable bundle outcome. PAgP bundles only with PAgP.
CDPBehaviour modelNeighbour discovery and IOS-style show output.
LLDPBehaviour modelStandards-style neighbour discovery and show output.
VTPBehaviour modelServer/client/transparent, domain and revision decide VLAN propagation.
UDLDBehaviour modelUDLD shutdown/reset-style behaviour in supported scenarios.
Port securitySupportedStatic/sticky MACs, maximum, and violation actions.
DHCP snoopingBehaviour modelTrusted ports and binding table state used by security labs.
802.1XBehaviour modelPort authorization from RADIUS reachability and credentials, with MAB and the guest and auth-fail VLANs. See Layer-2 security.
Q-in-Q (802.1ad)Supportedswitchport mode dot1q-tunnel carries the customer tag inside an S-tag.
Voice VLANSupportedA phone port carries the data VLAN and the voice VLAN.
MACsecBehaviour modelMatching pre-shared keys protect the link; a mismatch drops frames. No MKA.
MLAG / vPCPartialDual-homing rides the LAG model. On NX-OS a flood that crossed the peer-link does not leave by a vPC whose member is up on the other peer, so a dual-homed host hears a broadcast once. The peer control plane is not modelled.
Standard / feature familyCoverageNotes
IEEE 802.3 behaviourSupportedEthernet frame forwarding outcome, MAC learning, and flooding.
IEEE 802.1QSupportedVLAN tags, access/trunk membership, native VLAN, and SVI/subinterface interactions.
IEEE 802.1D / PVST+SupportedBPDU exchange, port roles, forward delay, TCN/TCA.
IEEE 802.1w / RSTPSupportedProposal/agreement and topology-change propagation.
IEEE 802.1s / MSTPartialMSTIs and PVST+ interop at the region boundary. Region name and revision change nothing.
IEEE 802.1AX / LACPBehaviour modelBundle negotiation outcome and member eligibility.
IEEE 802.1AB / LLDPBehaviour modelNeighbour table and selected TLV-style state.
Cisco CDP / VTP / UDLD / PAgPBehaviour modelVendor-specific access-layer behaviour where supported by labs and command tree.
Cisco port securitySupportedSticky/static MACs, max count, violation actions, and show output.
DHCP snooping / DAI familySupportedBindings learned from DHCP ACKs on untrusted ports; DAI and IP Source Guard drop against them. See Layer-2 Security.
IEEE 802.1XBehaviour modelPort authorization rather than a byte-level EAPOL supplicant.
IEEE 802.1adSupportedQ-in-Q S-tag over C-tag.
FeatureStatusNotes
MAC address tableSupportedLearns and resolves per-switch forwarding state.
Broadcast floodingSupportedFlooding is scoped to VLAN membership and STP state.
Unknown unicast floodingSupportedUnknown destination MACs flood within the VLAN domain.
STP network ports and legacy switchesSupportedspanning-tree portfast network / port type network with Bridge Assurance; UplinkFast and BackboneFast on access switches (see STP). spanning-tree etherchannel guard misconfig and optimize bpdu transmission have no effect.
VLAN databaseSupportedVLAN IDs and names are stored and emitted. On IOS and EOS an access port creates a missing VLAN (IOS prints % Access VLAN does not exist. Creating vlan N); NX-OS does not. no vlan N leaves its access ports inactive; no vlan 1 is refused. Enforced where the configuration states a database (vlan / no vlan lines or VTP); a switch from a topology document carries what its ports say.
Access VLANSupportedUntagged ingress maps to the configured access VLAN.
Trunk allowed listSupportedVLANs not allowed on a trunk are filtered.
Native VLANSupportedUntagged trunk traffic maps to the native VLAN.
SVI gatewaySupportedVLAN interfaces can route traffic from the L2 domain, also over a trunk (tagged, or untagged on the native VLAN). Traffic bridged to an SVI enters L3 on the SVI, so an ACL bound to the SVI filters it.
Interface templatesSupportedIOS-XE template blocks apply to every port with source template. A line the port states itself wins. The running config writes the template and the source template line.
NX-OS FEXSupportedswitchport mode fex-fabric with fex associate N brings FEX N’s host ports (EthernetN/1/x) up as the parent’s ports.
NX-OS system default switchportSupportedDecides a port’s default mode, and with shutdown whether a port without no shutdown is up.
LACP min-linksPartialNX-OS lacp min-links N: with fewer members bundled, the port-channel has no link. IOS port-channel min-links is not read; Junos minimum-links is accepted and has no effect.
Non-routing switch default routeSupportedip default-gateway is the switch’s default route when ip routing is off.
Dot1Q subinterfacesSupportedRouter-on-a-stick scenarios are represented.
STP root electionSupportedPriority and bridge ID decide the root, per VLAN under PVST+.
STP blocked portsSupportedBlocked links are removed from forwarding paths.
Loop guard / BPDU filterSupportedA silent port blocks; a filtered port leaves the tree.
PortFast / edge intentSupportedStored and reflected in STP/access-layer state.
BPDU guardBehaviour modelEdge-protection failures can block/shutdown forwarding.
EtherChannel static bundleSupportedPort-channel participates as a logical interface.
LACP / PAgP member selectionBehaviour modelBundle eligibility is calculated from configured mode.
CDP / LLDP neighboursBehaviour modelNeighbour tables are derived from topology and config.
VTP VLAN propagationBehaviour modelSupported modes can propagate VLAN state in labs.
UDLD failureBehaviour modelSupported scenarios can represent a unidirectional-link shutdown.
Port security sticky MACSupportedLearns/stores sticky MAC intent and enforces maximum where modelled.
DHCP snooping trustSupportedServer replies are allowed only on trusted ports.
802.1X authorizationBehaviour modelThe port is placed in its access, auth-fail or guest VLAN. An unauthorized port drops all frames (dot1x.unauthorized).
CommandIOS-styleJunos-styleVyOS-styleNotes
vlan 10SupportedPartialPartialVLAN creation.
name USERSSupportedSupportedSupportedVLAN metadata.
switchport mode accessSupportedSupportedPartialAccess-port mode. Junos: family ethernet-switching interface-mode access. VyOS: a bridge member with native-vlan.
switchport access vlan 10SupportedSupportedPartialAccess VLAN membership. Junos: vlan members.
switchport mode trunkSupportedSupportedPartialTrunk-port mode. VyOS: a bridge member with allowed-vlan.
switchport trunk allowed vlan 10,20SupportedSupportedPartialAllowed VLAN filtering.
switchport trunk native vlan 99SupportedSupportedPartialNative VLAN intent.
interface Vlan10SupportedSupportedPartialSVI routed interface.
encapsulation dot1q 10SupportedPartialSupportedRouter subinterface VLAN tag. VyOS: ethernet ethN vif 10.
spanning-tree vlan 10 priority 4096SupportedSupportedSupportedSTP root influence. Junos via VSTP. VyOS: bridge priority.
spanning-tree mode rapid-pvstSupportedSupportedPartialSTP mode selection. Junos: protocols rstp|stp|mstp|vstp. VyOS: bridge stp (classic STP only).
spanning-tree portfastSupportedSupportedNot modelledEdge-port intent. Junos edge.
spanning-tree bpduguard enableSupportedSupportedNot modelledBPDU guard. Junos: bpdu-block-on-edge.
channel-group 1 mode activeSupportedSupportedPartialLACP bundle membership. Junos: gigether-options 802.3ad aeN. VyOS: ethernet ethN bond-group bondN.
channel-group 1 mode desirableSupportedn/an/aPAgP bundle membership.
cdp enable / no cdp enableSupportedn/an/aCDP interface control.
lldp transmit / lldp receiveSupportedSupportedNot modelledLLDP interface control. Junos: protocols lldp interface all|IF [disable].
vtp mode server/client/transparentSupportedn/an/aVTP mode surface.
udld port aggressiveSupportedn/an/aErr-disables a port whose peer is not there.
switchport mode dot1q-tunnelSupportedn/an/aQ-in-Q customer edge.
switchport port-securitySupportedn/an/aPort-security enablement.
switchport port-security mac-address stickySupportedn/an/aSticky MAC learning.
ip dhcp snooping trustSupportedSupportedn/aDHCP snooping trusted port. Junos: dhcp-security; see Layer-2 Security.
authentication port-control autoSupportedNot modelledn/a802.1X interface control.
source template NAMESupportedn/an/aIOS-XE interface template.
vpc N / vpc peer-linkNX-OS: Supportedn/an/avPC loop avoidance.
vlan members / port-moden/aSupportedn/aJunos EX ports by VLAN name, range or all; also vlans NAME interface and interface-range.
show mac address-tableSupportedVendor-shaped viewVendor-shaped viewLearned MAC state: each entry’s VLAN, MAC address, type and port.
show vlan briefSupportedPartialPartialVLAN membership.
show interfaces trunkSupportedPartialPartialTrunk state.
show spanning-treeSupportedPartialPartialModel-derived STP state.
show etherchannel summarySupportedPartialPartialBundle state.
show cdp neighborsSupportedn/an/aCDP neighbours.
show lldp neighborsSupportedSupportedn/aLLDP neighbours. VyOS LLDP is not read.

Layer-2 forwarding is VLAN-scoped. A frame is first classified into a VLAN from access, trunk, subinterface, or native-VLAN context. Forwarding then uses the MAC table and the active STP/EtherChannel state for that VLAN.

STP is a distributed protocol. Every switch sends BPDUs from its designated ports every 2 seconds, stores the best BPDU per port, and elects its root and port roles locally. New ports climb the forward-delay ladder; RSTP ports use proposal/agreement instead. A legacy change sends a TCN up to the root. The result is deterministic: the same topology converges the same way.

EtherChannel is represented as a logical forwarding interface when member ports are eligible. LACP and PAgP decide bundling from the two ends’ modes. LACPDUs, DTP and VTP advertisements are on the wire in a capture (Packet Lens), decoded by Wireshark.

CDP and LLDP neighbours are learned from advertisements and age out. The frames are on the wire in a capture (Packet Lens), decoded by Wireshark. Version and duplex TLVs are not sent.

Access VLAN with SVI gateway
configure terminal
vlan 10
name USERS
interface GigabitEthernet0/1
switchport mode access
switchport access vlan 10
interface Vlan10
ip address 10.0.10.1 255.255.255.0
no shutdown
end
show vlan brief
show mac address-table

Vendor styles

IOS-style
vlan 10
name USERS
interface GigabitEthernet0/1
switchport mode access
switchport access vlan 10
interface Vlan10
ip address 10.0.10.1 255.255.255.0
Junos-style
set vlans USERS vlan-id 10
set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode access
set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members USERS
set interfaces irb unit 10 family inet address 10.0.10.1/24
set vlans USERS l3-interface irb.10
VyOS-style
set interfaces bridge br0 member interface eth1
set interfaces bridge br0 member interface eth2
set interfaces bridge br0 address 10.0.10.1/24
Trunk with native VLAN
configure terminal
interface GigabitEthernet0/24
switchport mode trunk
switchport trunk allowed vlan 10,20,30
switchport trunk native vlan 99
end
show interfaces trunk
EtherChannel with LACP
configure terminal
interface range GigabitEthernet0/1 - 2
channel-group 1 mode active
interface Port-channel1
switchport mode trunk
switchport trunk allowed vlan 10,20
end
show etherchannel summary
Port security on an access port
configure terminal
interface GigabitEthernet0/3
switchport mode access
switchport access vlan 10
switchport port-security
switchport port-security maximum 2
switchport port-security mac-address sticky
switchport port-security violation restrict
end
show port-security interface GigabitEthernet0/3

UDLD, DHCP snooping, and 802.1X are represented at the behaviour-outcome level. UDLD frames and the EAPOL exchange are not sent. 802.1X and MAB decide once, at settle; the critical VLAN, CoA and re-authentication are not modelled.

EtherChannel bundling checks only the channel modes and link state; speed and VLAN mismatches between members are not checked.

Private VLANs are not modelled. Switch ASIC behaviours such as CAM resource limits and hardware errata are outside the current model.