pi zero w web server / access point - Failed to obtain IP address on android

16
February 12, 2019, at 00:30 AM

After a month of trying, i now have a pi zero w as a standalone web server running nginx. Apple devices can join the AP Wifi (no internet) and using .local, e.g. books.local, access the root html file.

However, Android devices come up with Failed to obtain IP Address and won't connect. THis is my first pi project and the aim is to have a little pop-up book club web server to dsitribute pdf files when there is not local wifi.

Booting shows no errors, but i've tried everything from tutorials to fix this, but no luck so far. Stable and reliable on Apple, nothing on Android.

The image is raspbian stretch-lite

Setup as follows

sudo apt-get update sudo apt-get upgrade

Install the modules.

sudo apt-get install dnsmasq hostapd

EDIT /etc/rc.local and add this above "exit 0". Note that is two underscores on __ap.

sudo nano /etc/rc.local

service hostapd stop
service dnsmasq stop
iw dev wlan0 interface add uap0 type __ap
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
ifdown wlan0
ip link set uap0 up
ip addr add 192.168.4.1/24 broadcast 192.168.4.255 dev uap0
service hostapd start
ifup wlan0
service dnsmasq start
EDIT The /etc/dnsmasq.conf file

sudo nano /etc/dnsmasq.conf

interface=uap0

dhcp-range=192.168.4.20,192.168.4.100,255.255.255.0,12h

EDTI /etc/network/interfaces

sudo nano /etc/network/interfaces

auto lo

iface lo inet loopback

auto eth0 iface eth0 inet manual

allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /wpa_supplicant/wpa_supplicant.conf

allow-hotplug uap0 iface uap0 inet manual

REBOOT

EDIT The /etc/hostapd/hostapd.conf file.

sudo nano /etc/hostapd/hostapd.conf

interface=uap0
driver=nl80211
ssid=BookCLub
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=booksbooks
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
EDIT /etc/default/hostapd, uncomment and change this:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
EDIT /etc/sysctl.conf and uncomment

sudo nano /etc/sysctl.conf

net.ipv4.ip_forward=1

I then install nginx which is fine locally on the ethernet connection and apple devices.

Any suggestion regarding the android issue welcome...

READ ALSO
android : How is the default value assigned during insert in room

android : How is the default value assigned during insert in room

I am using Room in my app and while testing migrations i did a direct insert ( not using the Entity class )

35
How to start new activity from recyclerview?

How to start new activity from recyclerview?

I want to start new activity and also passing JSON data to the new activity when i click an item on the recyclerviewi followed a video in youtube: https://www

49
Drawing rectangles that fill up with gradient depending on the value

Drawing rectangles that fill up with gradient depending on the value

I want to have three separate rectangles that would fill up with gradientDepending on the value X the gradient would be placed differently

52
Android Studio an generates error when creating an apk

Android Studio an generates error when creating an apk

I got the error specified below when I tried to generate the apk of my app in Android Studio ,please help

30