How to monitor VLANs on Linux (Ubuntu with Netplan )

2 min

Introduction

Domotz is able to scan and monitor automatically all the networks attached to the operating system it is running on. For this reason to scan and monitor VLANs, you might configure a virtual network interface for each VLAN on your Linux operating system where the Agent runs on.

For more general information about monitoring VLANs in Domotz please see: https://help.domotz.com/user-guide/vlan-network-interface-configuration/

Prerequisites

Before proceeding please check:

1 – that the device were the Domotz Agent is installed is plugged in on to a trunk port of your switch which is able to see all your VLANs.

2 – test that you are able to ping hosts on those subnets from the Linux computer which the Domotz Agent is installed on

Manual Configuration

You can do this on Ubuntu by editing the netplan file which resides in the /etc/netplan/ directory and has the .yaml extension.

For more information about this please see here: https://vitux.com/how-to-configure-networking-with-netplan-on-ubuntu/

You can download here some examples of those files that can be modified and applied to your Domotz Agent:

You can then make a backup of your current netplan file (you can just rename it to *.yaml.backup) and rename the new netplanfile to 00-network-setup.yaml.

Then perform:

sudo netplan try

Then:

sudo netplan apply

After that your Domotz Agent will show the new vlans as being scanned which will appear in the format $nicname.2 (for example eth0.2 – which means VLAN2 attached to eth0).

Assisted Configuration

To configure the network and vlans you might use also the following bash scripts:

1) Network Configurator:
https://raw.githubusercontent.com/domotz/support_scripts/refs/heads/main/linux_agent/network_config.sh

2) VLAN Configurator:
https://raw.githubusercontent.com/domotz/support_scripts/refs/heads/main/linux_agent/add_vlans.sh


Please note that in case of an error such as:

awk: cannot open "/etc/netplan/00-installer-config.yaml" (No such file or directory)

Please edit the bash script and modify the path of your .yaml file according to its name and path on your linux computer.

The Netplan file path value is defined in the NETPLAN_FILE variable:


Testing VLAN Configuration



To test is please issue:

sudo ifconfig

you will get something like this:

eth0      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
          inet addr:192.168.1.250  Bcast:192.168.1.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2963441738 errors:0 dropped:1537311 overruns:0 frame:0
          TX packets:2492320545 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1140723218 (1.1 GB)  TX bytes:394942035 (394.9 MB)

eth0.103  Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
          inet addr:192.168.103.250  Bcast:192.168.103.255 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:504612755 errors:0 dropped:0 overruns:0 frame:0
          TX packets:422335283 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:25634206918 (25.6 GB)  TX bytes:18165979372 (18.1 GB)

eth0.252  Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
          inet addr:192.168.252.254  Bcast:192.168.252.255 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:528968305 errors:0 dropped:0 overruns:0 frame:0
          TX packets:449295251 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:34981287899 (34.9 GB)  TX bytes:19762756952 (19.7 GB)

eth0.253  Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
          inet addr:192.168.253.254  Bcast:192.168.253.255 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4965237 errors:0 dropped:0 overruns:0 frame:0
          TX packets:400524664 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:237801810 (237.8 MB)  TX bytes:16902032617 (16.9 GB)


In Domotz instead:

In the case above, you see VLAN103, VLAN252, VLAN253 attached to the eth0 interface.

Share via Social Networks

You might also like…

Read more top posts in this category

Want more tips on Network Monitoring?

Ready to get started with Domotz?

  • Powerful
  • Automated
  • Simple
  • Affordable
Start Your Free Trial Contact Sales