Set a static IP address in Home Assistant OS

Full credit goes to this forum post.

I found myself in need of dropping to the CLI for a fresh Home Assistant OS install on top of Proxmox after using the tteck helper scripts to set a static IP.

To do this without access to the Home Assistant UI we must drop to the command line of HAOS itself. Simply typing login will drop you out of the HAOS CLI and you will be able to use nmcli to set these parameters on the underlying OS.

nmcli

nmcli is a command line tool to modify network configurations.

  • Use nmcli connection show to list your connections
  • nmcli con edit "Your Connection Name" to enter edit mode for that connection - in my case this was "Supervisor enp0s18"
  • nmcli> set ipv4.addresses 192.168.1.10/24 Do you also want to set 'ipv4.method' to 'manual'? [yes]:
  • Set the dns server and local gateway while you’re here
# nmcli> set ipv4.dns 192.168.1.254
# nmcli> set ipv4.gateway 192.168.1.254
# nmcli> save
# nmcli> quit

The next thing to do is reboot the HAOS VM and enjoy.