Should I be able to see this folder
/etc/NetworkManager/
After successfully configurating the static ip?
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.
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.
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
It removes the need to type port number after your domain.
Port 443 is a standard port for websites that use SSL, and your home assistant will be such a site when you get duckdns addon running. Advantage is that you won’t need to type in port number at all because it will go to 443 by default.
That means if you had to type
https://yourdomain.com:8123
before setting port forward 443->8123, you will be able to go just to
https://yourdomain.com
(without port) after you set it up
But, this will only work from external network if your router does not support NAT loopback. If it does, it is usually an option to enable/disable it for each port forward entry. Enable it, and you will be able to access it without typing port from internal network too.
Thanks for taking your time.
My Router does not support nat loopback, this is the reason why I had to use dnsmasq to be able to use the outside url in my local network.
So there are no security differences between both options, right?
There is no reason for choosing to 443 if I don‘t mind having :8123 after the URL, right?
Would it be possible to use dnsmasq or Pi-hole to do nat loopback (or something equal) to use an url without port in and outside?
Note: The newest iOS App of Homeassistant has an option to set seperate outside and inside urls. But that’s not a global solution for other devices that are not running this App
Most of that is new to me, so I like to have that confirmed from someone who knows better.
Thanks!
Ok so I already have the answer for
But @corunir could you answer the other questions shortly?
Edit:
Ok so tried setting 443 up again. My router doesn’t support nat loopback.
So when my internal port ist different than my external, I cannot use the same url internal and external.
I have to have the same port internal and external to be able to use the same IP.
Could someone confirm that this is because I have no nat loopback?
Also I found a way to use 443 and with that the ability tnot to use a port at my url.
For that I had to change the server_port of home assistant to 443. Also I changed the base_url to XXX:443.
So everythin that was 8123 before is now 443.
And with that I’m able to reach ha internal and external with the url (without the port).
However, I’m not sure If setting 443 as the serverport of homeassistant is a good idea (does it make a difference?), what do you think about that?
maybe @petro ?