Using nmcli to set a static IPV4 address in Hass.io

This method of setting a static IP for Hassio has been tested with a Hass.io vmdk image on an Esxi server. Log into the HASSOS base system via a console – note this is not the same as an SSH login via the add-on.

Welcome to HassOS
Hassio login:

Login as root (no password needed)

At the hassio > prompt, type login (as instructed).

From here you will use the nmcli configuration tool.

# nmcli connection show will list the “HassOS default” connection in use.

# nmcli con edit “HassOS default” will put you in a position to edit the connection.

nmcli> print ipv4 will show you the ipv4 properties of this connection.

To add your static IP address (select ‘yes’ for manual method);

nmcli> set ipv4.addresses 192.168.100.10/24
Do you also want to set 'ipv4.method' to 'manual'? [yes]:
nmcli> save
nmcli> exit

In addition I have found it is wise to set the dns server and the local gateway. For most home routers these will be the same address. If you are using Pi-Hole you can set the dns to that.

nmcli> set ipv4.dns 192.168.100.1
nmcli> set ipv4.gateway 192.168.100.1
nmcli> save
nmcli> exit

If you now view the default connection cat /etc/NetworkManager/system_connections/default you should see the method is manual and the address is set.

Doing a nmcli con reload does not always work so restart the VM.

Facebooktwitterby feather
This entry was posted in Hass.io, HASSOS. Bookmark the permalink.

2 Responses to Using nmcli to set a static IPV4 address in Hass.io

  1. Alderete says:

    Good article, this is useful. Thanks!

    Although for a Hass.io server it might not be critical, normally I’d provide at least two DNS servers for a device to use, to potentially fall back on one if the other is down.

    Could I suggest that you might update this article showing how to add multiple values to the ipv4.dns value, or with a pointer to additional docs on the nmcli tool?

  2. Alderete says:

    One other thing, the command to leave the nmcli interactive session is quit, not exit.

Leave a Reply