How to change IP adresse in CLI

Yes this fix the problem

BTW: this shouldn’t this hard to change a simple IP, every server I’ve used have this option natively…
TrueNas, Untangle, PFSense, Proxmox etc

At least have the option to use the bash by default, this is a bit more power than your tool !

It’s not. You have the GUI in the supervisor Host panel, or the CLI - that does not require anything to be installed.

1 Like

99% of people using the Home Assistant OS, don’t need to change the IP address, it will be assigned by DHCP. Even cheap ISP routers provide the ability to reserve an IP address so the same IP is always delivered by DHCP.

Aside from the fact that there IS a way to change the IP address via the CLI as has been indicated, you obviously also had the option to temporarily set any computer on the network to an IP address in the old range that you were previously using so that you could have accessed the GUI, to change the IP address via the Supervisor page.

1 Like

could you please tell me the commands you used for this or point me to the exact location where you obtained them? thanks

Hum… Is the post #2 of this thread above not clear enough? Or were you asking a different question?

solution process and commands to this

When you are in the ha > prompt just type
login
That will give you the root prompt of hasos. There you can use nmcli … docker , etc.

7 Likes

This is the heavily missed context…

I am developer with experience in Linux, Docker, Python and whatnot and it’s not obvious to my how I can get to the host terminal after reaching the HA> prompt after booting.

6 Likes

Yes, that login command is not listed anywhere. It was present the early days before they changed the OS interface, but still works. Maybe someday will be depreciated, but at this moment it works and let you use docker as usual from the root prompt.

1 Like

I was sure I read it somewhere on the official documentations, and you are right - couldn’t find it now.

The only reference I could find about this login is at the bottom of this page… not obvious at all:

Hello there,

I switched network providers too and I can’t sign into the web UI either.
Did you get yours to work, if so what did you do.

Thanks!

I have had a very hard time getting this far with HA, but I still do not get what you are showing. My nmcli does not understand set and I do not see a ready replacement.Have tried numerous versions of HA with no joy at all.This new way is not very good?First the dictatorial removal of YAML now a startup that is incomprehensible not an auspicious follow up. Is there complete help for this?

Edmond

1 Like

NOTE: This post was written several years ago and outlines a way to set a static IP using low level tools. If your network uses DHCP to assign IP addresses (if you aren’t sure, it does) then please scroll down to this post that describes a newer method.

You want to:

  1. Be connected to the HA CLI, you should see an ha> prompt
  2. Run ‘login’, you should now see a # prompt
  3. Run ‘nmcli connection show’ to see your list of connections and choose which one you intend to edit. In my install there was only one listed, “HassOS default”
  4. Run ‘nmcli con edit “HassOS default”’ (or whatever your connection is), you should now have an nmcli> prompt
  5. Once in the nmcli prompt, run these commands filling in whatever your network details are:

nmcli> set ipv4.addresses 192.168.1.10/24
Do you also want to set ‘ipv4.method’ to ‘manual’? [yes]: yes
nmcli> set ipv4.dns 1.1.1.1
nmcli> set ipv4.gateway 192.168.1.1
nmcli> save
nmcli> quit

  1. Exit the login prompt (run ‘exit’)
  2. At the ha> prompt, run ‘ho reboot’
30 Likes

Just to add to this, if one has two connection profiles, for example this is how mine seems to be setup:

$nmcli con show
NAME               UUID                                  TYPE      DEVICE 
Supervisor enp0s3  c14e9fbc-98dc-49e0-b65e-c39d18abdef9  ethernet  enp0s3 
HassOS default     f62bf7c2-e565-49ff-bbfc-a4cf791e6add  ethernet  --     

only one connection profile can be active at a time, so pick the one that has a device listed under DEVICE (i.e. pick “Supervisor enp0s3”)

2 Likes

thanks for the education, ive become quite proficient with NMCLI now :smiley:

I found a similar command (much differnet syntax) from the ha> CLI that you can use to check and change your network settings:

ha > network info
this will provide information aboiut your networ settings.

HA> network update (followed by your ethernet adaptor name and an IPV$ command)

for example, this command will force the interface to automatic DHCP for ipv4 and ipv6
ha> network update enp2s0 --ipv4-method aut0 --ipv6-method auto

19 Likes

Thank you for posting this. Saved me a ton when I switched to a mesh router.

I also figured out that:
nmcli is not available with the official add-on “Terminal & SSH”
nmcli is available with the HAC Add-on “SSH & Web Terminal”

1 Like

Guys you saved me today. Yesterday after a power outage the Home Assistant OS wasn’t coming up anymore. No IP no matter what. It’s running on Odroid N2+.

I found out that ipv4.method was disabled. So using nmcli I brought it back to life. Awesome.

1 Like

@phobiac your the difference between someone who wants to help and someone that … your write up was soooo helpful and to the point. There are so many posts looking for this info and definitly HA needs to do work in this area.
If you install your HA on a Raspberrypi you should be able to simply config the net without having to connect to a live network that has a dhcp server running…wth.
In my case I build my system got it all configured and restored my backup from my VM. My last step before putting it away was to configure the Wifi. I setup the WIFI and then disabled the lan…Bam, I forgot to enable the wifi and now the system is bricked. and I did not know how to get out of docker to the OS…
Thanks again!!!

2 Likes

Glad I could be of service! Funny enough, I ran into this exact issue again just a few weeks ago and ended up finding this thread and my own post… So like many lessons with documentation, I ultimately helped future me out too.

1 Like