Search code examples
androidiosdnsmasqhostapd

Wireless Access Point Communication with phone works for Android but not receiving any requests from IOS?


I'm trying to set up a computer that will start in wireless access point mode, receive SSID and Password from the user on their android/ios device, then join that network that was received from the user on the form.

So far this is working great on Android devices. However, for some reason attempting this on any ios device results in no communication to the wireless access point. It seems as though ios automatically attempts to find the static ip (in this case 192.168.0.20) through lte/wireless data rather than sending the request to my access point.

Here is the following configuration files:

hostapd.conf:

interface=wlan0
ctrl_interface=/run/hostapd
ctrl_interface_group=0
ssid=my_access_point_ssid
country_code=US
auth_algs=3

dnsmasq.conf:

interface=wlan0
dhcp-range=10.0.0.3,10.0.0.20,12h
port=80

Once the wireless access point is created and the ssid and password form is filled out and POST request sent to the wireless access point, a shell script takes in the information and connects to that access point with the following:

nmcli device wifi connect "$1" password "$2"

Solution

  • Ok I figured it out. In the script that started the access point, I had

    ip addr add 10.0.0.1/24 dev wlan0
    

    For some reason, Android did not care that the "router" ip address was 10.0.0.1, but ios did and would only send requests to the access point through 10.0.0.1/api_endpoint.

    I changed the startup script wireless configuration to

    ip addr add 192.168.0.20/24
    

    Along with this, I had to change the dnsmasq.conf dhcp-range:

    dhcp-range=192.168.0.21,192.168.0.49,12h
    

    I'm not sure if it against best practice to utilize 192.168.0.xx to give to the phone, but it seems to work for this use case where the phone will only have a temporary local access point that it is connected to.