All-in-One Hassbian static IP

Hello there!

I’ve installed AIO Hassbian (guided by Bruh). At first my rasp pi 3 was connect to modem via UTP. I found a script on Bruh’s website ( http://www.bruhautomation.com/single-post/2016/09/20/Home-Assistant-Quick-Start-Guide ) how to set your rasp pi 3 to connect thu WIFI. Disconnected UTP and it worked.

Now i’d need to set my rasp pi 3 a static IP.

how can i do this? i can’t find any guide. can somebody please help me?

thank you! :slight_smile:

As someone who just recently moved from my ISP provided WiFi to Google WiFi and had to change my entire network config (static IPs) due to Google creating it’s own unchangeable subnet. I decided to use DHCP reservations this time around. If your router supports it I highly recommend going that route.

1 Like

Unfortunately i dont have access to my modem. blocked by ISP provider. They said i should set on device statis ip with excact last position number and the device should be avaliable to be reached via WAN. So i need to set a statis IP on my rasp pi 3.

I used this site as a guide which was pretty straight forward :slight_smile:

Two ways to do this:

  1. Manually assigned IP address on your DHCP server (which is probably your router).
  2. Fixed address in your network settings, but you still have to make sure that address is outside of the DHCP scope so you are certain you don’t get any conflicts.

I would go with option 1 when possible. It has the benefit och re-assigning the same IP even if you start over with a fresh distribution, as long as the MAC adress doesn’t change, but since it´s not an option for you…

If you go for option #2 you need to edit two files:

# /etc/network/interfaces:
# probably something like this:
iface wlan0 inet static
    address 192.168.1.222
    netmask 255.255.255.0
    gateway 192.168.1.1
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

And since you don’t get your address via dhcp you probably want to set the DNS yourself, you do that in /etc/resolv.conf

# /etc/resolv.conf
domain yourdomain.name
nameserver 8.8.8.8

Btw, what do you mean by this? Should you set the ip to somthing like 192.168.1.254? And will it forward ALL requests to that raspberry? In that case I would look into enabling the firewall to your pi, and deny all outside requests that are not needed for homeassistant.

Something like that, yes. how can I deny all outside requests but mine?

i need to set a static IP on the pi first tho :slight_smile:

It’s been too long since I dealt with iptables/ipchains on linux, you have to check the details on the net.

Basically you want to start with a rule that denies all incoming connections from everywhere
Then you make a whitelist with what’s allowed, like 8123 from anywhere, and 22 (ssh) from your local network, and so on.

Just make sure you don’t lock yourself out unless you can connect with a keyboard+screen (TV?) :slight_smile:

OK, I create an interfaces file in /etc/network, and the DNS in /etc/resolv.conf.
When I reboot, those files go back to their default.

ifconfig shows my IP address as 172.30.30.0 (???), yet an ipscan shows that my hassio.home is at 192.168.1.32.

So, how do I set up a static IP on Home Assistant?

https://docs.resin.io/deployment/network/2.0.0/#setting-a-static-ip

Edit file called resin-wifi in the folder /system-connections/:

Replace everything in file with and change 192.168.1.111 to IP address on your PI3:

[connection]
id=my-ethernet
type=ethernet
interface-name=eth0
permissions=
secondaries=

[ethernet]
mac-address-blacklist=

[ipv4]
address1=192.168.1.111/24,192.168.1.1
dns=8.8.8.8;8.8.4.4;
dns-search=
method=manual

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