---
name: "packet.link.vlan"
section: "3"
platform: "linux"
package: "nfstest"
version: "3.2-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/packet.link.vlan"
---

# packet.link.vlan(3)

VLAN module

## NAME

packet.link.vlan - VLAN module

## DESCRIPTION

Decode Virtual LAN IEEE 802.1Q/802.1ad layer

## CLASSES

### class VLAN(baseobj.BaseObj)

```
VLAN object
Usage:
    from packet.link.vlan import VLAN
    x = VLAN(pktt)
Object definition:
VLAN(
    pcp   = int,  # Priority Point Code
    dei   = int,  # Drop Eligible Indicator
    vid   = int,  # VLAN Identifier
    etype = int,  # Payload Type
    psize = int,  # Payload Data Size
)
```

**Methods defined here:** ---------------------

**\_\_init\_\_(self, pktt)** Constructor

Initialize object's private data.

- **pktt:**

  Packet trace object (packet.pktt.Pktt) so this layer has access to the parent layers.

**\_\_str\_\_(self)** String representation of object

The representation depends on the verbose level set by debug\_repr(). If set to 0 the generic object representation is returned. If set to 1 the representation of the object is condensed:\
     '802.1Q VLAN pcp: 4, dei: 0, vid: 2704 '

If set to 2 the representation of the object also includes the type of payload:\
     '802.1Q Virtual LAN, pcp: 4, dei: 0, vid: 2704, etype: 0x0800(IPv4)'

## FUNCTIONS

```
vlan_layers(pktt)
Get all nested (stacked VLANs or QinQ) VLAN layers
A Packet layer attribute is created for each VLAN layer:
vlan1, vlan2, ..., and vlan. The last packet attribute
is always vlan.
```

## SEE ALSO

**[baseobj(3)](/baseobj/3.md),** **[packet.link.ethernet\_const(3)](/packet.link.ethernet_const/3.md)**

## BUGS

No known bugs.

## AUTHOR

Jorge Mora (mora@netapp.com)
