Hass.io static ip and other network regarding questions

Coming from here:

Currently I have two pi’s. One running HA and another one running Pihole, because installing the pihole addon doesn’t work (see link above).

@frenck told me that the addon won’t work without issues if I don’t setup a static ip and dns. Before I had a dhcp reservation on my router, and I thought this was the same as a static ip.

I think it wasn’t neccesary (I already knew this way), but I reinstalled has on my sd card bootting it the frist time with a configurated stick (CONFIG/network folder).

After that unplugged my pihole-pi and pointed the dns-filed of my router to the hassio device ip.

It still doesn’t work. Any help appreciated. These are the questions I have so far:

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

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

Thanks!

It looks like I will find my answers here:

EDIT:
After trying this, I still have the same issue.

Try Fixed IP address

Should I be able to see this folder

/etc/NetworkManager/

After successfully configurating the static ip?

I read the topic on github, so lets get a bit in depth of what is happening:

Both frenck and me (theBrozilla, don’t ask) told you about reserved and static ip address, those are two different things.

Assigning an address consists of four steps in dhcp:
DISCOVER (a device with no address asks dhcp server for an address)
OFFER (dhcp server offers an available address from the pool)
REQUEST (a device requests an address to be assigned to it)
ACKNOWLEDGE (dhcp server confirms address is assigned to a device

Reserved address means dhcp server will take an address, put it to the side and only give it to a specific device. So a device will send DISCOVER, dhcp will look if there is a reserved address. If there is, it will send OFFER with reserved address to device. If not, it will take an address from the pool and send an OFFER with it to the device. Device will send REQUEST, and dhcp will finally ACKNOWLEDGE.

Static address means device will skip skip first two steps. It will immediately send REQUEST for an address it wants. If that address is available, dhcp will acknowledge. Problem here is if you didn’t reserve that address directly on dhcp, another device might take it.

So, you need both to be sure it works.
Remove reserved address from your router.
To check if you successfully assigned a static address on rpi:
Take any address on your network that is currently not assigned and configure it following this: https://github.com/home-assistant/hassos/blob/dev/Documentation/network.md#static-ip

Reboot your host (not just home assistant) and check the router. If your rpi now has that random address from rpi configuration, you made it. Reserve that address on the router and that should be it.

The thing is I should already have have both, because I have the reservation (that I had for months now) and I set up the static IP as shown in the docs.

Is there a way to keep the ip I currently have? Switching to another one might cause other issues.

You can revert both entries to your previous address later. This is only a method to make sure you did everything right.

Ok so I tried this and as expected I’m doing something wrong.

My my-network file looks like this

[connection]
id=hassos-network
uuid=79343bef-c239-4f09-9d6c-37667a1cfbd1
type=802-3-ethernet

[ipv4]
method=manual
address=192.168.0.199/24,192.168.0.140 
dns=8.8.8.8;8.8.4.4
 
[ipv6]
addr-gen-mode=stable-privacy
method=auto

I’m not sure about the /24 do I have to adapt this value for my network too?
After booting with this file the device got the new IP XXXX:110 so not 199

If you are not doing subnetting then:

Address: 192.168.0.1 11000000.10101000.00000000 .00000001
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111 .00000000
Network: 192.168.0.0/24 11000000.10101000.00000000 .00000000 (Class C)
Broadcast: 192.168.0.255 11000000.10101000.00000000 .11111111
HostMin: 192.168.0.1 11000000.10101000.00000000 .00000001
HostMax: 192.168.0.254 11000000.10101000.00000000 .11111110
Hosts/Net: 254 (Private Internet)

I’m not sure about 192.168.0.140. It must be your router IP address.

No subnet. so my settings above should be ok, right?

I’m doing everything exactly like decribed.

  1. Loading the file in the right direktion on the usb stick
  2. Shutdown host - wait unplug
  3. Put USB Stick in
  4. Plug in Raspi
  5. System - Import from USB - Wait some seconds
  6. Shutdown
  7. Unplug Power
  8. Unplug USB Stick
  9. Plug in Raspi

And it does not take the values of that file, because it gets a random IP not the one I chose.
What else could I do wrong?

Add interface-name=

Did you remove reserved address from router?
Is your router address 192.168.0.140 and your desired rpi address 192.168.0.199?
You don’t need to shutdown or unplug rpi for this action.

  1. Go to hass.io -> system. Click hardware and check under disks. There shouldn’t be any.
  2. Put usb in rpi.
  3. Refresh page. Go to hass.io -> system again. Click hardware and check if there are any new disks. If yes, go to next step.
  4. Hass.io -> system -> import from usb
  5. Refresh logs on the same page. Check if there is a line that mentions syncing configs from usb. If yes, go to next step
  6. Hass.io -> system. Click reboot
  7. wait for the rpi to come online and check which address it got on your router.

yes, my setup looks like this. I have a router/modem from my provider and I also have some apple routers.
At first I had a double nat network . Currently I moved the the modem/router to the “applenetwork”. So the 192.168.0.140 is the gateway (provider modem) and my apple time capsule does the dhcp reservation (192.168.0.1).

Did you remove reserved address from router?

Yes I did that, and because of the pi got another ip but not 199 (not already taken).

I can confirm that there isn’t anything

after putting the usb stick in, I get this

disk:

* /dev/sda
* /dev/sda1

looks fine

19-01-17 18:39:50 INFO (MainThread) [hassio.hassos] Syncing configuration from USB with HassOS.
19-01-17 18:39:50 INFO (MainThread) [hassio.host.services] Restart local service hassos-config.service
19-01-17 18:39:50 INFO (MainThread) [hassio.utils.gdbus] Call org.freedesktop.systemd1.Manager.RestartUnit on /org/freedesktop/systemd1

My next try was to format the stick and rewrite the file.

Also I did this on a windows pc (before on a mac) just to be sure der isn’t something wrong about the format.

Unfortunately this also didn’t work.

It isn’t that hard and I already used this to set up wifi before I switched to ethernet. I don’t get what I’m doing wrong.

Stick should be formatted as fat32, stick name must be CONFIG when you are formatting.
On empty stick, you should add folder network.
Inside that folder create a file my-network.

This is my config file adjusted for your network:

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

[ethernet]
mac-address-blacklist=

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

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

Does your dhcp have 192.168.0.199 in its range at all? Some dhcps don’t have range of the subnet in their pool by default, mine for example is 192.168.1.2-192.168.1.99, subnet 255.255.255.0 when on factory settings.

yes, I did it exaclty like that since the first try.

I will try it again with your settings.

After deleting the dhcp reservation the ha device gehts ip around 100-130.
So know I set the static ip to the one I want in the end, if it gets that ip after rebooting it should be fine.
Thr default dhcp range of my router is XXXXXX:100-200

Did not work.

The next thing I’ll try is to set the wifi settings I had before I switched to ethernet.
This would proof that it loads the file.

EDIT: Ok, so I also fail to load the wifi settings. As I said I already used this file before and I didn’t change it. I also use the same usb stick.
So the issue seems to be that the rpi doesn’t load the file, although the lines above show that the usb stick is mounted.
Any further suggestions.
My next try would be to use another stick.

I found the issue. After copying the UUID I changed it randomly. Doing this I did not notice that it has something to do with the hexadecimal system and used random keys.

So I also had letters like k in it.

Hopefully now the pihole addon will work as expected.

Thanks for your help!

@corunir and @Vlad Thanks again for your help.

It looks like you both are experienced enough to answer me that last question I have (for now) regarding network and port forwarding.

I tried to find my answer here, but no one answered yet. Maybe you could help.

It’s this posting:

Thank you very much guys!

Port Forwarding:
You will just forward HTTPS TCP Any -> 443 to your PI (HASSIO statc IP) 192.168.0.199:8123