HOWTO: Set Static IP on Raspberry Pi4 wireless with new HassOS Installation 08/2021

Synopsis: How To Configure Static IP on a PI4, using its onboard Wifi adapter, before ever booting to the GUI or using a wired connection. This documentation was written for HA core-2021.8.8.

Why: I was building a dev box out of a spare PI and needed to get it on Wifi, something I would normally not do. All the documentation I found about setting a static IP was for an already installed machine, I wanted to do this as I built the machine, so it came up the first time on my wifi and with the correct IP. I draw heavily from other peoples work, linked within. The reason I’m writing this guide is that it’s 2021, and the latest I could find was from 2018, and a lot has changed since then, so here’s what worked for me.

You will need:

  • Pi4 (I am told a Pi3 will work, but I have not tried this)
  • Some other computer (mac, win, chrome, lin, doesnt matter) with a USB port available.
  • USB stick of any size which you can erase. You won’t need it after the process is complete so don’t go buy one, use anything you have.
  • a random created UUID, created from https://www.uuidgenerator.net/
  1. Using the spare computer, format the USB drive as Fat32, whatever size it is, doesn’t matter, you are only going to put one file on it.
  2. Name this new USB volume CONFIG (all uppercase, no quotes)
  3. In the root of the USB drive, create a directory called network (lower case) and in that directory, create a file called my-network (all lower case no quotes no spaces)
  4. Edit this file with your text editor of choice and if you are doing static wifi, here’s what you need to put in the file:
[connection]
id=your-wifi-ssid
uuid=random-created-uuid-you-just-created
type=802-11-wireless

[802-11-wireless]
mode=infrastructure
ssid=wh
# Uncomment below if your SSID is not broadcasted
#hidden=true

[802-11-wireless-security]
auth-alg=open
key-mgmt=wpa-psk
psk=your-psk-here

[ipv4]
method=manual
address=192.168.86.110/24;192.168.86.1   (use your subnet, mask, and router)
dns=8.8.8.8;8.8.4.4;

[ipv6]
addr-gen-mode=stable-privacy
method=auto
  1. eject and remove the USB stick from your spare PC, put it into the PI, and boot the PI. If all goes well, it will boot, join your network, and be reachable at the IP address you used above.

Once you have successfully booted the PI to HA, then named your HA, signed into it, created your user, etc, you can shut down the PI and remove the USB key. You will not need it again.

The PI is now configured to boot with your new IP information. Reboot the PI.

If the PI didn’t join your Wifi, have a look at the my-network file again, there should be no fancy characters in it, and no extension on the file name. You can change the syntax to use DHCP or in fact a wired static IP via this same method if you like, see the documentation from git listed below.

I drew this information from the following resources, and thanks to all for your work on this magnificent product!

https://www.uuidgenerator.net/

Hope this helps!
-Jim

1 Like

Please remove hass.io from the title, the term has been deprecated for more than a year now.

good catch thanks