HomeAssistant network MTU

I’m running HomeAssistant on a virtual PC, HAOS and all, but I’m using a tunnel that doesn’t have a 1500 bytes ethernet MTU. How to change the MTU?

HomeAssistant (HA) on Home Assistant Operating System (HAOS) is a pretty slick and pretty well thought out system. The tight coupling between the domotica-part (HomeAssistant) and operating system (OS) part, HAOS, ensures that both keep running well, both are updatable from the web interface and both can be managed easily.

The downside of this coupling is, that once you need specific OS settings, it isn’t always clear how to proceed. Home Assistant itself runs in a container, so you cannot change OS settings. Or can you? Turns out: yes, you can.

Here is how to proceed.

Connect a monitor and a keyboard to your HAOS installation. If it’s a virtual machine (like mine is), you just need to “connect” to the virtual display of the host machine. You will see:

| |  | |                          /\           (_)   | |            | |  
| |__| | ___  _ __ ___   ___     /  \   ___ ___ _ ___| |_ __ _ _ __ | |_ 
|  __  |/ _ \| '_ \ _ \ / _ \   / /\ \ / __/ __| / __| __/ _\ | '_ \| __|
| |  | | (_) | | | | | |  __/  / ____ \\__ \__ \ \__ \ || (_| | | | | |_ 
|_|  |_|\___/|_| |_| |_|\___| /_/    \_\___/___/_|___/\__\__,_|_| |_|\__|

Welcome to the Home Assistant command line.

System information
  IPv4 addresses for enp1s0: 192.168.112.170/24
  IPv6 addresses for enp1s0: fe80::cf78:914d:7da6:2265/64

  OS Version:               Home Assistant OS 11.1
  Home Assistant Core:      2023.11.2

  Home Assistant URL:       
http[s]://......:8123
  Observer URL:             
http[s]://...:4357
ha >

On this HAOS prompt, type login

You’ll now get a rather minimal “HAOS” Linux root prompt, just saying #. The “nmcli c” command will tell you the name of your network interface:

nmcli c
NAME               UUID                                  TYPE      DEVICE 
Supervisor enp1s0  bf97b94b-9d4a-3728-9609-7ff76b1ae1a5  ethernet  enp1s0

The Supervisor enp1s0 link is the one you are looking for. View its MTU by typing nmcli con show 'Supervisor enp1s0', change it to 1234 by typing nmcli con modify 'Supervisor enp1s0' ethernet.mtu 1234. This change will be saved automatically by NetworkManager, but it is not active immediately.

Type nmcli c up 'Supervisor enp1s0' to enable the new setting. Check the new setting with ip link list dev enp1s0, it should say something like:

2: enp1s0: mtu 1234 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 98:fa:9b:05:16:ae brd ff:ff:ff:ff:ff:ff

To remove the new MTU, use nmcli c modify 'Supervisor enp1s0' ethernet.mtu "".

Finally, type “exit” to quit the shell.

Leave a Reply

Your email address will not be published. Required fields are marked *