← index #17401Issue #17977
Duplicate · high · value 2.624
QUERY · ISSUE

[RP2] AP DHCP server ignores ifconfig IP and continues assigning 192.168.4.x subnet

openby TonyReinbergeropened 2025-05-31updated 2025-05-31
bug

Port, board and/or hardware

v1.25.0 RP2 on Pico W and Pico 2 W boards

MicroPython version

MicroPython v1.25.0 on 2025-04-15; Raspberry Pi Pico W with RP2040
MicroPython v1.25.0 on 2025-04-15; Raspberry Pi Pico 2 W with RP2350

Reproduction

import network

ap = network.WLAN(network.AP_IF)
ap.active(True)
ap.ifconfig(("10.10.10.1", "255.255.255.0", "10.10.10.1", "10.10.10.1"))
print("AP:", ap.ifconfig())

Expected behaviour

Clients connecting to the Pico's AP should receive DHCP leases matching the configured AP subnet (10.10.10.x, in this case), or DHCP should be disabled entirely if config does not match.

Observed behaviour

Clients receive 192.168.4.x addresses, regardless of ifconfig().

Additional Information

When using network.WLAN(network.AP_IF) on the RP2040 (Pico W), if you:

  1. Activate AP mode with ap.active(True)
  2. Set a new IP config with ap.ifconfig(("10.10.10.1", "255.255.255.0", "10.10.10.1", "10.10.10.1"))

The Pico W correctly reports the new IP when calling ap.ifconfig(), but any device connecting to the AP still receives a DHCP lease in the default 192.168.4.x range.

This happens even though the AP IP is no longer in that subnet. It appears the DHCP server is not being updated when ifconfig() is called.

In addition I am using STA mode and connecting to the home network. Now devices connected get 192.168.4.x addresses when my router should be giving 192.168.1.x addresses.

This happens with or without a connection with Thonny.

Using ntptime always times out if connected with Thonny. If main.py is run without a connection then ntptime times out on the first attempt but sync's after that.

The application objective is to have an AP which is used to set the STA SSID and password and then reset the board to restart if it changes. You can also see status logs on the AP (typically with a phone) without knowing the STA SSID and password. The STA should be used to set the ntptime upon boot with STA connection and then sync every 24 hours after that. The home network on the STA can see logs and other things. asyncio was used to start the servers. This seems like a basic setup that is not working very well.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Cannot change default exposed IP (for DHCP etc) on Pico W running in AP mode (remains exposing default 192.168.4.x)

openby magnus-0opened 2025-08-22updated 2025-09-23
bugport-rp2

Port, board and/or hardware

Pico W

MicroPython version

MicroPython v1.26.0 on 2025-08-09; Raspberry Pi Pico W with RP2040

Reproduction

  1. Create a WLAN in IF_AP mode and set IP (and subnet, GW, DNS, etc) via WLAN.ifconfig
  2. Confirm that ifconfig() returns the expected parameters
  3. Conclude that the exposed IP address (incl DHCP range etc) when connecting clients to the AP remains the default 192.168.4.1

Expected behaviour

Expected the exposed DHCP gateway address and range to follow the set parameters, instead of the default 192.168.4.1

Observed behaviour

DHCP gateway address and range remain 192.168.4.1

Additional Information

(!) Do ensure ifconfig() is called áfter activating the WLAN, as otherwise it will definitely reset to the default settings, confirmed by printing them. So WLAN.active(true), then WLAN.ifconfig(...)

See also this link
and this link

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied