How to change IP adresse in CLI

Hi,

I’ve recently updated my network, change my subnet.
And of course I’ve forgot to change my HA ip adresses before…


So how can I change in CLI my IP adresse ? I cloud’t find anything online, and the HA help can’t help me…

Thx

2 Likes

https://community.home-assistant.io/t/guide-connecting-pi-with-home-assistant-os-to-wifi-or-other-networking-changes/98768

(Part 3)

I cant access the web ui. Because HA nic IP aren’t set for my current network

Really?

but the steps below will show you how to set it with nmcli :

nmcli connection show to list your connections

nmcli con show "Your Connection Name" to list the current properties of that connection

nmcli con edit "Your Connection Name" to enter edit mode for that connection

nmcli> print ipv4 will show you the ipv4 properties of that connection

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

Copy to clipboard

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

If you like, you can also edit set the dns server and local gateway while you’re here. This is important to do if you are making use of the Adguard add-on:

Copy to clipboard

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

Finally, you should follow this with a full reboot using

hassio ho reboot

9 Likes

nmcli need to be enable first on the webui to be accessible on CLI.

I’ve managed to show the --help in HA CLI interface.

There with net (network) options you can set manually your ip and gateway.
Those options and where hidden by the disclaimers, and the “how to”.

Where did you get that idea?

You have to enter login and get to the host console to use nmcli.

3 Likes

@3th3r did this solution fixed your issue? I have a similar one and I am investigating how to solve it. This seems to be a good solution

wasn’t the point, and wouldn’t worked

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.

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.

6 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.

5 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!