Home Assistant static IP via nmcli

Aus Laub-Home Wiki
Zur Navigation springen Zur Suche springen
  • Login HassOS as root
  • login to get Host OS shell
  • nmcli for configuration shell
  • 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
Do you also want to set 'ipv4.method' to 'manual'? [yes]:
nmcli> save
nmcli> quit

In addition, set the dns server and the local gateway:

nmcli> set ipv4.dns
nmcli> set ipv4.gateway
nmcli> save
nmcli> quit

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 better restart the VM.