Skip to content

30 ‐ Basics ‐ VLAN Config Gluon

aron-darmstadt edited this page Jul 31, 2024 · 7 revisions

motivation

To use to enable gluon based offloaders to support different VLANs, as it may be used at larger networks.

Important notes

  • Existing interface roles have to be removed if any of the assigned ports are remapped
    • Example: When re-assigning lan1, the role of the /lan pseudointerface have to be removed
  • This does only work for platforms who use DSA for the switch-driver
  • To apply changed config, don't forget to save with uci commit and apply with gluon-reconfigure
    • Check the resulting config in /etc/config/network and restart the network by executing reboot or /etc/init.d/network restart

Roles

There exist the following roles

  1. uplink for the interface which the VPN is established with
  2. client for the client network in Gluon
  3. mesh for wired mesh

Example Config

root@64295-hh36-c87f5420a1ee-offloader1:~# uci show gluon
[...]
gluon.iface_wan=interface
gluon.iface_wan.name='/wan'
gluon.iface_wan.role='uplink'
gluon.iface_lan=interface
gluon.iface_lan.name='/lan'
gluon.iface_lan_mesh50=interface
gluon.iface_lan_mesh50.name='lan1.50'
gluon.iface_lan_mesh50.role='mesh'
gluon.iface_lan_mesh60=interface
gluon.iface_lan_mesh60.name='lan1.60'
gluon.iface_lan_mesh60.role='mesh'
gluon.iface_lan_mesh70=interface
gluon.iface_lan_mesh70.name='lan1.70'
gluon.iface_lan_mesh70.role='mesh'
gluon.iface_lan_mesh80=interface
gluon.iface_lan_mesh80.name='lan1.80'
gluon.iface_lan_mesh80.role='mesh'
gluon.iface_lan_mesh90=interface
gluon.iface_lan_mesh90.name='lan1.90'
gluon.iface_lan_mesh90.role='mesh'
root@64295-hh36-c87f5420a1ee-offloader1:~# 

Note the following:

  • gluon.iface_lan has it's role property removed. See important Notes.
  • lan1 in this example is the interface name where the VLAN should be added to.
    • This name is not universal. It depends on the device, e.g. on x86 there might be eth0 or eth1.
    • Execute ip l to get a list of all interfaces.

In this configuration, lan1 has the VLANs 50 60 70 80 90 tagged assigned to it.

They are all treated as a single interface mesh-interface, thus not bridging the individual VLANs.

How-To

Delete the LAN pseudointerface role

uci del gluon.iface_lan.role

Add a new VLAN interface to lan1

uci set gluon.iface_lan_mesh50=interface
uci set gluon.iface_lan_mesh50.name='lan1.50'
uci set gluon.iface_lan_mesh50.role='mesh'
uci commit
gluon-reconfigure
/etc/init.d/network restart

Script

Do not run this script in setup mode.

#!/bin/sh

# Check if VLAN ID is provided
if [ -z "$1" ] || [ -z "$2" ]; then
  echo "Usage: $0 <INTERFACE> <VLAN_ID>"
  exit 1
fi

INTERFACE="$1"
VLAN_ID="$2"

# Remove the role of the /lan pseudointerface
uci del gluon.iface_lan.role

# Add a new VLAN interface to the identified interface
uci set gluon.iface_lan_mesh${VLAN_ID}=interface
uci set gluon.iface_lan_mesh${VLAN_ID}.name="${INTERFACE}.${VLAN_ID}"
uci add_list gluon.iface_lan_mesh${VLAN_ID}.role='mesh'

# Commit the changes and reconfigure the network
uci commit
gluon-reconfigure
/etc/init.d/network restart

echo "VLAN ${VLAN_ID} added to ${INTERFACE} and network reconfigured."