Setup VLAN and HA tutorial

Just another update taking into consideration another post here where I “updated” the procedure to use a more recent approach, so I’ll just paste it here and organize it for future reference and to help anyone looking for a solution still. Older tutorials for older version of HA are V1 here and V2 here.

  1. Install and configure (according to documentation) the “Home Assistant Community Add-on: SSH & Web Terminal” add-on in System > Add-ons
  1. After installation, enter the terminal and run:
ha network -h

to have a list of commands and examples shown to you.
OR/AND

ha network info

to have detailed info about your network and existing interfaces

OR/AND

ha network vlan -h

to have detailed help on VLAN creation/management

  1. Create your virtual VLANed interfaces, one per each network you want to create/segregate in your network, and have HA exist in them and talk to its members.
    (If you are using PROXMOX or other virtualization system, this is how you should be doing it! You should create your network interfaces using the webGUI of the hypervisor!)
    If you are using a bare metal installation of HomeAssistant OS, the following applies to you:

If static IP execute: (adjust the capitalized variables below to your needs/context!)

ha network vlan REAL_INTERFACE_NAME VLAN_ID --ipv4-method static --ipv6-method disabled --ipv4-address IP/NETMASK --ipv4-gateway IP_GATEWAY --ipv4-nameserver IP_DNS

if DHCP execute: (adjust the capitalized variables below to your needs/context!)

ha network vlan REAL_INTERFACE_NAME VLAN_ID --ipv4-method auto --ipv6-method disabled 

Use only ONCE the “–ipv4-gateway IP_GATEWAY” variable in the main interface that you want HA to use to go to the internet (usually main LAN interface). Many or per interface defined gateways or poorly configured routing WILL bring you problems and cause configuration errors.

  1. In HA webGUI, go to Settings / System / Network in HA and check if the interfaces/networks added are properly configured and set up. Choose the star for the main adapter in this same page.

  2. Configure your VLANS in your switch/network and test!

  3. Profit!

Good luck :wink:

P.S. - As per @tomik67 suggestion, I’m adding information about how to remove a VLAN, if you need to, for whatever reason. Enter the terminal add-on from step 1 of the tutorial and:

ip link set <vlan-interface> down
ip link delete <vlan-interface>
Resume from step 2 in the tutorial, if you need to create a new VLAN.