PDA

View Full Version : Zero W & fixed IP?



Rnee
2019-03-26, 09:43
Hi all

Is it possible to assign a fixed IP to a Zero W?
I have tried this multiple times but somehow I end up having to restart from a fresh image every time because of not being able to access it anymore.

In the wpa_supplicant.conf, I put the right country code, WIFI settings so the Zero gets an IP from my DHCP; fine until here.
When assigning fixed IP information in PCP, it goes wrong: the device is not accessible.
I leave the line "# Maintained by piCorePlayer" untouched but 2 things are not clear to me:
1) is this line taken into consideration since it's commented out?
2) what's the difference with "# Maintained by user" since the rest is exactly the same

Is this just not possible with a Zero or am I doing something wrong?

TIA
R

Paul Webster
2019-03-26, 11:17
I don't know if this limitation is still in place ... but pCP docs say that static IP is only for Ethernet (in their set-up).
https://www.picoreplayer.org/how_to_setup_wifi_on_pcp_without_ethernet.shtml

Another way to do it would be to configure your DHCP server to allocate the IP address for this MAC address.

paul-
2019-03-26, 12:32
wpa_supplicant has nothing to do with assigning IP addresses. And yes we have never really got static working with WIFI.

The best thing is to setup a static hdcp mapping in your router.

To answer the question
# Maintained by user

is commented out so WPA supplicant ignores the line, however the rest of pCP finds this line, and tell the web interface not to allow any changes to the file.

Greg Erskine
2019-03-26, 14:47
Out of curiosity, why do you use static IPs?

As recommended by the Paul's, it is best to assign a static IP with your DHCP server which is usually on your router, map MAC address -> IP address.

As mentioned by Paul Webster, the CLI "setup" only works for wired ethernet.

I thought the web interface static IP worked for wifi as well but I just tested it and it didn't. :mad:

99% of users should use "Maintained by piCorePlayer". piCorePlayer then reads the wpa_supplicant.conf file, pulls out relevant settings and creates a new, freshly formatted wpa_supplicant.conf. So if the user misses a setting, makes a typo, forgets a bracket etc, piCorePlayer will probably fix it. This is the default process.

The other 1% of *advanced* users want a unique wpa_supplicant.conf for, say multiple networks, using a complex security setup, etc then "Maintained by user" should be used. piCorePayer will assume the user knows what they are doing and use the wpa_supplicant.conf file as is. Editting wpa_supplicant.conf file via the web interface will be disabled.

Rnee
2019-03-27, 14:39
Hi guys, thanks for helping out!

The reason for wanting to assign a fixed IP that I have quite a few devices and I prefer to have more control over used IP's.
I use as much fixed IP's as possible to avoid problems when the DHCP server is not accessible for some reason.
Recently I shifted my DHCP server from my router to a Pi-hole but since I did not create a static lease upfront, the Zero kept using a dynamic IP.
Now I found a way to remove that lease from command line since this is not possible through the web interface of the Pi-hole.

Tnx!
R.

Greg Erskine
2019-03-27, 15:33
hi Rnee,

I was an IT manager and I used to do the same thing, static IPs for everything, but 20 years ago I found DHCP was very reliable and easy to use. :)

Especially in a home environment there is no competition for IP address so with a reasonable lease time your IPs rarely change. The only time my IPs change is when I have an extended power blackout. :(

I don't even set a static IP on my LMS. So for me its not a problem but I guess there are cases where fixed IPs are required.

regards
Greg

edwin2006
2019-03-28, 08:51
When using ip bind in a draytek router you're even allowed to export the list so you could import it again when necessary.
IP bind is eve allowed outside the dhcp scope so for instance scope is starting at 10 and max 200 (so dhcp for 10-210) you could bind ip 211 outside the scope to a device.

Greg Erskine
2019-03-29, 17:50
hi Rnee,

I can confirm a static IP wifi issue with the Raspberry Pi Zero. Thanks for reporting.

It looks like I only tested on Raspberry Pi's that had LAN eth0 (unused) as well as a wifi wlan0.

regards
Greg

Rnee
2019-03-31, 02:57
U R welcome!

Since I have another RPi with WIFI (although it has a LAN port but using USB WIFI dongle that I had laying around) where it was possible to assign a fixed IP I assumed that with the Zero this also should be possible.
So as already mentioned before why, I tried to do this and it is more out of interest/curiosity how to achieve this and wondering if/(what) I was doing (something) wrong that I started this thread.

Greg Erskine
2019-03-31, 13:41
hi Rnee,

The current static IP web page may actually work if you make sure the [wlan0] tab has been selected. It needs to be black.

Initially,

[wlan0] <- grey, not highlighted
Set static IP for eth0 <- defaulted to eth0

click on [wlan0]

[wlan0] <- black, highlighted
Set static IP for wlan0 <- changed to wlan0

I haven't tested it.

regards
Greg

Rnee
2019-04-01, 02:46
Tnx Greg, will try this and post back.

Rnee
2019-04-02, 02:17
The current static IP web page may actually work if you make sure the [wlan0] tab has been selected. It needs to be black.

Initially,

[wlan0] <- grey, not highlighted
Set static IP for eth0 <- defaulted to eth0

click on [wlan0]

[wlan0] <- black, highlighted
Set static IP for wlan0 <- changed to wlan0

I haven't tested it.

SUPER Greg, I can confirm that this works!

d6jg
2019-04-02, 08:32
As a general statement it is not really a very good idea to assign a true fixed IP to a wireless interface. Troubleshooting a failed WiFi connection becomes very difficult. If you must give a player a known address then as others have said use a DHCP server reservation.

Personally I would never use anything but a wired connection for an LMS server (a server should always be a static or reserved IP). Technically LMS can be wireless but in my experience a wireless server always has issues of one kind or another that simply do not manifest themselves when the server is wired.

Remember that if you have a Wireless-G capable router it dishes out a maximum bandwidth of 54mbps which is shared amongst all its active clients. Wireless-N is a maximum of 900mbps but you never actually achieve that and again its shared out. A 1GB wired connection on the other hand ...... OK I know the Pi is limited to 100mbps but actually that and the fact that the LAN port has a shared bus with the USB is a reason why I run LMS on a full spec bit of hardware.

As to remembering IP addresses of connected piCorePlayers - Settings / Information is not exactly difficult to find and conveniently lists everything for you.