How to change IP adresse in CLI

Nope, if you can reach the web interface then you can assign an IP Address from the web interface.

1 Like

Thanks. I have a masters in EE and I didn’t know this. @k8gg: No need to be condescending to newbies who need step by step instructions.

1 Like

Thank you @tom_l !!! I really appreciate the instructions.

1 Like

After 2 days off-line I found @odiaz59 procedure and this works fine.

To change your home assistant ip address:

ha> network info

look for interface to grab the name

ha > network update enp0s3 --ipu4-address 192.168.1.45/24

this takes about 20 seconds

Command completed successfully.

5 Likes

Untitled

My connection profile doesnt have a device associated how do i fix that?

Good question. My system automatically set up the profile, so I’m not so sure.

First let’s see what there is (type each of the following):
nmcli connection show - just to verify there are no other profiles.
nmcli device status - to see if there are any interfaces.

If “Supervisor enp11s0” is the only profile, and you have an interface enp11S0, then you may be able to add the interface to the profile using:
nmcli con add con-name "Supervisor enp22s0" ifname enp11s0 type ethernet

Hey Tommy thanks for that,

So it looks like my connection is showing as disconnected when I run the status command:

image

For a little context this is running under ESXi 7.0U2 and had been working successfully for some time. Recently I had issues as Veeam tried to backup the VM (it creates snapshots) and subsequently it wouldn’t boot. I resolved that issue and now I have this one…

I ran the: nmcli con add con-name "Supervisor enp22s0" ifname enp11s0 type ethernet command successfully but it has now created two profiles:

image

Although it looks as if the actual problem is the adapter showing as disconnected.

Sorry, I think I was fiddle-fingering my response and mistyped the profile name.
Since the interface name is shown as enp2s1,
try: nmcli con add con-name "Supervisor enp11s0" ifname enp2s1

I guess its an old statement, but if you look in a bigger picture. Cloud providers are using endless leasetime DHCP. Its just simpler to handle the IP outside of the OS.

Your statement is more true like in the 1990s, early 2000s where CPU and RAM was limited, but today its not the case anymore.

Just handle (almost) everything using DHCP.

HI I successfully updated my ip address by writing in the CLI:

network info 

to gather infos about the interface’s name (I discovered my interface was different from eth0)
then

network update eth0 --ipv4-method auto

this resolved the stupid decision to assign a manual ip and not checking twice

2 Likes

Simple example. My home network contains about a hundred devices. It’s a large area and several buildings connected by cable and radio bridges. Of course I have a lot of wifi access points, some of which are routers set up as access points. One of these access points went crazy (maybe it was updated incorrectly or some other failure). It so happened that during a scheduled reboot of the central router, there was no electricity in part of the buildings at night. When it appeared, this crazy access point turned on its own dhcp server, distributed its addresses in its segment and decided that it was the main gateway. As a result, a whole segment of the network was completely lost to “smart devices” even though everything looked like it was working. Thus, all dhcp-dependent devices were affected by this failure. At that moment only those devices in which ip, gateway and dns were manually set, worked correctly. Of course, this is not a normal situation, and this “too smart” router went to the local flea market, and its place was taken by one that will not be able to do anything on its own.
I’m sure that the use of dhcp is applicable to such devices as smartphones, tablets, TVs and other devices for which ip address is not important in most cases. Well, or those in which it is impossible to set the address manually (the same sensors and tuya outlets). In such cases you need to assign ip addresses in the router with binding to mac. But such things as servers should be configured manually. And the range available for dhcp should be limited to a small and reasonably sufficient segment.

I was looking everywhere for exactly this. I was caught in a terrible loop where HA wouldn’t get an IP address so it couldn’t reach the time server, so it didn’t boot properly, etc.

TL;DR you’re a hero

1 Like

Thanks for this advice!

I managed to change my IP address via CLI using the following commands:

  1. network info to find the correct network adapter and see your current IP address set for HAOS
  2. network update eno1 --ipv4-method auto --ipv6-method disabled (“eno1” needs to be replaced by your network adapter)
  3. network update eno1 --ipv4-gateway 192.168.x.x (“eno1” needs to be replaced by your network adapter, “x” needs to be replaced by your IP gateway, probably router IP)

After doing this, my Fritz!Box auto-assigned showed an IP address for Home Assistant again.

7 Likes

Yeyieh thanks

Thank you for providing a COMPLETE answer. It gets frustrating for answers to be given with incomplete context.

Hi,

my first attempt do move HA from my default LAN to a VLAN in Unifi did not work. Yes, i use a static IP:

Can somebody help which steps in which order are required to move HA to a VLAN? Is there something specific to take care?

This is real magic. I was trying to solve the issue for last three hours with no luck. Tried all options nothing has worked. Finally with just two commands, able to resolve the issue. Thanks a ton for this instruction.

4 Plus hours of struggling and finding nothing at all, and your post saved the day, and my HA instance. Thank God for you!!

cheers , had it set up in proxmox , then installed pfsense , worked perfect cheers fella

Quite. Help is only help if it helps and I often find once I can’t resolve something from the GUI (where ordinary people can explore and learn), and have to drop to the CLI where I’m often in a whole world of hurt and frustration as I’m not a guru don’t speak their often highly abbreviated and full of assumption ‘help’ language. ;-(

‘Just type xyz’ when there might be 10 steps you have to have in place before you can do that.

Like whilst suggesting a new HA owner (Generic X64-86 HAOS) change his IP from DHCP to static, we ended up with a /32 netmask and so have locked ourselves out.

I have been trying to see what you might need to do to get that sorted from the CLI (via my own Odroid N2+ HAOS install) but nothing seems to work (the tips here seem to have got the closest) and so I think we are just going to re-flash the m.2 drive with a fresh HA and try changing the IP address again, before even restoring the one backup he took locally.

Mucking about with different SSH / Terminal tools, SSH keys, CLI logins and incantations that don’t seem to follow the guides …

Why couldn’t there be a HA splash screen terminal / menu driven way of setting such things, like you see of the RPi (Raspi-config or whatever it’s called)?