netlab VLAN Trunk Example

Last week I described how easy it is to use access VLANs in netlab. Next step: VLAN trunks.

We’ll add two Linux hosts to the lab topology used in the previous blog post, resulting in two switches, two Linux hosts in red VLAN and two Linux hosts in blue VLAN.

Lab topology

Lab topology

Like in the previous example, we’ll use groups in the lab topology file to define our devices. Members of the hosts group will be Linux containers, members of the switches group will be Arista EOS containers using vlan configuration module:

Defining nodes and groups
provider: clab

nodes: [ h1, h2, h3, h4 s1, s2 ]

    members: [ h1, h2, h3, h4 ]
    device: linux
    members: [ s1, s2 ]
    module: [ vlan ]
    device: eos

Next, we’ll define the VLANs. We need red and blue VLANs; as before, netlab will assign 802.1q tags to VLANs as needed.

Defining VLANs

Finally, we need links between nodes. Access VLANs with be defined on switch interfaces. List of VLANs in the VLAN trunk will be defined on the link itself, as it applies to all nodes connected to the trunk. Note that we’re working with VLAN names and don’t have to worry about the VLAN 802.1q tags.

Defining links
- h1:
    vlan.access: red
- h3:
    vlan.access: blue
- s1:
  vlan.trunk: [ red, blue ]
- h2:
    vlan.access: red
- h4:
    vlan.access: blue

And that’s all you have to do. Execute netlab up1 and enjoy your first multi-VLAN lab.

Here are the relevant parts of Arista cEOS configuration (for the two readers who still don’t have a working netlab environment):

Arista cEOS multi-VLAN configuration
spanning-tree mode mstp
vlan 1000
   name red
vlan 1001
   name blue
interface Ethernet1
   mac-address 52:dc:ca:fe:05:01
   switchport access vlan 1000
interface Ethernet2
   mac-address 52:dc:ca:fe:05:02
   switchport access vlan 1001
interface Ethernet3
   description s1 -> s2
   mac-address 52:dc:ca:fe:05:03
   switchport trunk allowed vlan 1000-1001
   switchport mode trunk
interface Vlan1000
   description VLAN red (1000) -> [h1,s2,h2]
   ip address
interface Vlan1001
   description VLAN blue (1001) -> [h3,s2,h4]
   ip address

Want to run this lab on your own, or try it out with different devices? No problem:

Add comment