2

I am working on an embedded Linux system (kernel-5.14), and I am trying to configure the device as a WIFI AP by using hostapd (and using softAP mode).

The main modification of hostapd.conf is as follows to support AP connecting with passphase,

interface=uap0 wpa=2 wpa_passphrase=12345678 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP TKIP wpa_pairwise=TKIP CCMP auth-algs=3 

And I configured udhcpd.conf accordingly.
After hostapd -B /etc/hostapd.conf and udhcpd -c /etc/udhcpd.conf &, I can see the log to save AP ENABLED.

I can connect this AP from my cellphone after entering the passphase, and I can ping my cellphone's IP (got from udhcpd on the AP device) from AP.

Now, I want to connect the AP from my cellphone without entering the passphase. I tried to change hostapd.conf, as follows,

wpa=0 auth_algs=1 #wpa_passphrase=12345678 

Then I restart the hostapd and udhcpd and connect the AP from cellphone.
This time, the udhcpd in the AP reports logs as follows,

Sending IP 192.168.1.33 Sending IP 192.168.1.33 Sending IP 192.168.1.33 Sending IP 192.168.1.33 

And my cellphone is showing getting IP Address for a while, then failed to connect to the AP.

So I am not sure if it is possible to connect to AP (hostapd) without passphase, if it is possible, how to configure the hostapd.conf to do that?

2
  • I did the trick (paswwordless Wifi AP) 1) by removing wpa keys from hostapd.conf 2) usinf dnsmasqd to give IP. Commented Jul 3, 2023 at 12:35
  • OK, good sharing, I will try that today, and update my result here. Commented Jul 4, 2023 at 0:16

2 Answers 2

3

The fact that you are seeing udhcpd responding to requests indicates the cellphone had already successfully connected to your AP's wireless network: making a DHCP request over WiFi is impossible unless the WiFi network is already connected.

But it is likely the cellphone also checks that the IP address it's receiving actually works, by making an internet connection attempt of some sort. If you haven't yet enabled IP routing, it is possible the phone is rejecting the IP address it's received from your udhcpd and retrying because it finds it cannot actually use that IP to communicate with some internet service.

1
  • When the AP says Sending IP xx.xx.xx.xx, the cellphone does NOT exit on success on connecting to the AP. Instead, both the AP and the cellphone are in a loop (to get the IP from the AP, to send the IP to the AP...), and I cannot ping the cellphone from AP. If I configure the hostapd.conf to use passphase, there is NO such loop, and I can ping the cellphone from the AP. So I don't think in the non-passphase, the cellphone connects to the AP correctly..... Commented Jul 3, 2023 at 12:30
0

I found the way to make it work.
In my system, there is a WLAN0 interface, and I want to create a softAP on WLAN0 as uap0, and use uap0 as AP to be connected by cellphone.

To make it work, firstly, there needs to configure /etc/hostapd.conf with followings.

interface=uap0 driver=nl80211 auth_algs=1 hw_mode=g #wpa=2 #wpa_passphrase=abcdef123 

The necessary steps to start AP service in this embedded system are.

ifconfig wlan0 up iw dev wlan0 interface add uap0 type __ap ifconfig uap0 192.168.0.1 hostapd -B /etc/hostapd.conf touch /var/lib/misc/udhcpd.leases udhcpd -f /etc/udhcpd.conf & 

Then, in cellphone, search the AP and connect to it, this time, there is NO need to enter password.
The udhcpd showed the following logs.

udhcpd: sending ACK to 192.168.0.20 udhcpd: sending ACK to 192.168.0.20 udhcpd: sending ACK to 192.168.0.20 udhcpd: sending ACK to 192.168.0.20 

And I can ping the cellphone's IP (192.168.0.20), and got.

PING 192.168.0.20 (192.168.0.20): 56 data bytes 64 bytes from 192.168.0.20: seq=6 ttl=64 time=3.944 ms 64 bytes from 192.168.0.20: seq=7 ttl=64 time=6.440 ms 64 bytes from 192.168.0.20: seq=8 ttl=64 time=2.547 ms ..... 

Testing with WLAN0 directly with above configurations and steps, I got the same result.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.