Static IP on ethernet


#1

I’m using hassio which is a version of homeassistant for RPi which I believe is based on resin.io.

I’m having problems setting a static IP for my ethernet connection. I’m using a RPi2 connected to a virgin media horizon router (assigning the IP based on MAC doesn’t work on this Router). I’ve had similar problems with another RPi on the same router that I’m using as an AirPrint server. Essentially, the RPi and the DHCP on the router do not work well together and the Pi somehow assigns itself an IP outside the DHCP range. The other Pi is running raspbian jessie, so I set the IP manually in the OS and it now works.

For my hassio setup, I found the connections folder and the resin-sample file. I should mention that I’m using ethernet, not wifi. I couldn’t exactly figure out exactly what file to create or edit, but I made a copy of resin-sample and edited it like this:

[connection]
id=resin-sample
type=wifi

[wifi]
hidden=true
mode=infrastructure
ssid=My_Wifi_Ssid

[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=super_secret_wifi_password

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

[ethernet]
mac-address-blacklist=

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

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

I tried naming the file resin-sample and resin-wifi but neither one seems to have any impact. I still get an IP way outside the DHCP range.
What am I missing? thx


#4

First of all I would suggest removing the wifi-related parts of the the config i.e. everything down to (bit not including):

[connection]
id=my-ethernet
...

Just to make sure NetworkManager doesn’t get confused.

If that still doesn’t work I would be interested to know what address it does get versus what you are expecting.

I am surprised that DHCP (method=auto) doesn’t work as if no DHCP response is received it should result in no networking rather than static address assignment.


#5

Thanks for the reply. I will try removing everything else. I think it’s an issue with this router. I have an another Pi running raspbian and ran into the same problem. It’s something to do with the Pi not getting a DHCP response from the router, then deciding on it’s own IP.

What should the file be called? resin-sample, resin-wifi etc?

Thanks again


#6

Any filename without the .ignore suffix should work.