How To: Set a Static IP on Hass.io/HassOS

Hi all,

I have seen some people a bit confused on how to set a static IP for the new Hass.io host HassOS. I know their are other guides but they are mostly buried in other posts. Anyway heres how to set up a static IP on Hass.io/HassOS.

Step 1: Once you have got Hass.IO up and running following the guide and can access the front end go to step 2.
Step 2: Take a USB stick put it into your PC and rename it to “CONFIG”.
Step 3: Create the folder “network” and inside create a text file called “my-network” then delete the .txt extension click yes and it should save. The file’s icon should just be a white/blank file icon in windows explorer.
Step 4: Open up that file with Notepad++ or similar and paste in these lines. These lines of code are for a Ethernet connection with a Static IPv4 but if you want to configure WiFi here are more examples of code. Change the IP and gateway IP to fit your setup. Eg. 192.168.1.111 is the Pi’s IP and 192.168.1.1 is your router/gateway’s IP.
Step 5: where UUID is you need to generate a unique one here copy and paste it into the “UUID: section”. Save the file and remove the USB stick from your PC.
Step 6: Shutdown your Pi (pull the power plug or thorough SSH) and insert the USB stick into any free port. Start up the Pi once the stick is inserted.
Step 7: Once it starts up and you can reach the UI go to the Hass.io tab, click on “System” on the far right, scroll down and find host system and click “import from USB”.
Step 8: Wait until it is complete then shut down the Pi, pull the USB and restart, it should now have a static IP.

Please note this will only work for the new HassOS install’s menaing that you have recently downloaded the newest IMG.

Hope this helps Riley.

20 Likes

There is also the very simple option of getting your DHCP server (usually your router) to dish it out the same IP address every time.

Your howto is a great resource for those endless questions of “how do I get wifi working on hassio”!

When using something like the Pi-hole add-on that could give issues the way you say, if a user sets the default DNS on the DHCP server (your router) to the Pi. You will still need to set a static IP address (and dns) on your Pi to have it working.

1 Like

Yes you do need to set your DHCP server to a static address.

Thanks, helps me a lot! :slight_smile:

Thanks for this! I’m facing traoubles with the pihole addon and hopefully this will solve it.

I still have some questions, maybe you could help @LavaGlass?

  1. How can I proof that it used the settings from the usb stick and I have a static ip?

  2. Can/should I keep the address reservation in my router or do I have to delete that?

I can’t get this to work.
I have a USB stick named “CONFIG”
On this drive is a folder named “network”
In this folder a file named “my-network”
In this file is this this configuration:

[connection]
id=hassos-network
uuid=7ca777e9-8ae5-42fe-b725-7714fd4fc386
type=802-3-ethernet

[ipv4]
method=manual
address=192.168.11.10/24,192.168.11.1
dns=192.168.11.1;8.8.8.8;

[ipv6]
addr-gen-mode=stable-privacy
method=auto

Logging says:

19-02-05 20:02:40 INFO (MainThread) [hassio.hassos] Syncing configuration from USB with HassOS.
19-02-05 20:02:40 INFO (MainThread) [hassio.host.services] Restart local service hassos-config.service

I tried rebooting, importing, all the steps above. But Hassio is still on DHCP.

Please help,

J

Address line separator is ; not ,

1 Like

Hi.
Thanks a lot for your topic about static ip.
one question.
right now my raspberry pi get his static ip from the router ,
so, if i do it the way you explained, i can give up the static ip from the router?
the static ip will be from the raspberry, right?
Thanks
Refael

Yep that’s correct mate.

I’m trying to moving to a fix IP as well and it doesn’t work. I even reserved the IP on the Router and still, I won’t move from it’s original IP,
Via the Samba I created the network folder, then I created the file my-network file using Atom.

[connection]
id=hassos-network
uuid=9b05f929-12b2-432a-ae0a-emyuniqkey
type=802-3-ethernet

[ipv4]
method=manual
address=192.168.XX.YY/24,192.168.79.Y
dns=192.168.XX.Y;1.1.1.1

[ipv6]
addr-gen-mode=stable-privacy
method=auto

but after a reboot, the ip is still the original one.

This worked perfectly for me.
Thanks for posting.

1 Like

Welcome!

You don’t place the network folder into /config. You put it on a USB drive and it gets imported, after which you can remove the USB drive.

OR you can make use of an addon and do it as described here, which is probably easier because it is interactive and you can “check your work”: https://community.home-assistant.io/t/guide-connecting-pi-with-hassos-to-wifi/98768

So I can not configure the WIFI and ethernet connections with the same config file? I need to change it to configure each one? What a tedious system.

2 Likes

yes you can.

It will be awesome to see at least one example, because there is noi example about how to configure two network interfaces (wifi and ethernet)

Oh come on, there are hundreds of examples of network manager configurations on the internet.

I’m taking about how to setup the file named my-network to configure two interfaces, not how to do it in linux. This is pretty unique to hassio

No it is not, it uses network manager.

@LavaGlass

I am hoping that someone can help me undo the changes I made. I followed the instructions to set a static IP and after rebooting I lost access to the UI. The static IP was not set using this method, but I was able to get it changed using nmcli via console access. I am still not able to access the UI and am wondering if there is a way to undo the changes that were made when I imported from USB. I can ping hassio and can access the Samba share without issue.