Android no dhcp wifi

DHCP failure on Android WiFi (stuck on obtaining IP address) – How I solved it

This evening my phone wouldn’t connect to my WiFi network anymore after a SIM change + reboot (maybe unrelated?).

Anyway, it seems that many people are affected by this issue, but it took me a while to find a workaround, because I found a lot of incomplete and fragmented information. I’ll try to put everything in this post so people with the same problem can hopefully spend less time to solve it.

My configuration: Sony Ericsson Live with Cyanogen mod 9 (Android 4.0.4).

Problem description

Wireless card will not connect to WiFi network when using DHCP (in my case the AP is a CISCO router flashed with DD-WRT and secured with WPA2). In the Android WiFi settings, you will see the connection status looping between the same states over and over (the most noticeable is “obtaining an IP address” as that string remains on the screen longer).

To investigate a bit on the cause of the issue, I had a look at the ERROR logs, that revealed the failure of DHCP:

E/DhcpStateMachine( 218): DHCP failed on wlan0: DHCP result was failed E/WifiStateMachine( 218): IP configuration failed E/LanLinkProvider( 471): Sending udp identity package failed E/LanLinkProvider( 471): Sending udp identity package failed E/LanLinkProvider( 471): Sending udp identity package failed E/LanLinkProvider( 471): Sending udp identity package failed E/DhcpStateMachine( 218): DHCP failed on wlan0: DHCP result was failed E/WifiStateMachine( 218): IP configuration failed E/LanLinkProvider( 471): Sending udp identity package failed E/LanLinkProvider( 471): Sending udp identity package failed E/DhcpStateMachine( 218): DHCP failed on wlan0: DHCP result was failed E/WifiStateMachine( 218): IP configuration failed E/LanLinkProvider( 471): Sending udp identity package failed E/LanLinkProvider( 471): Sending udp identity package failed E/DhcpStateMachine( 218): DHCP failed on wlan0: DHCP result was failed E/WifiStateMachine( 218): IP configuration failed E/LanLinkProvider( 471): Sending udp identity package failed E/LanLinkProvider( 471): Sending udp identity package failed

Solution

What worked for me (and hopefully for someone else too), was to delete every files in

Читайте также:  Настроить вай фай вручную

In my case, I had the following two files:

dhcpcd-wlan0.lease dhcpcd-wlan0.pid

So, if you can access the adb shell, you can try the following (please, see which files you have there with “ls”, so you will correctly remove what you need):

$ adb shell # cd /data/misc/dhcp # rm dhcpcd-wlan0.lease dhcpcd-wlan0.pid

Or, if you cannot use the adb shell, try to remove those files with a file explorer directly from the device.

After this, I had to reboot before I could get my WiFi connection work properly with DHCP.

Источник

Android no dhcp wifi

Обнаружена блокировка рекламы: Наш сайт существует благодаря показу онлайн-рекламы нашим посетителям. Пожалуйста, подумайте о поддержке нас, отключив блокировщик рекламы на нашем веб-сайте.

Android не получает DHCP IP по Wi-Fi

Друзья,
Столкнулся с проблемой на клиентском свиче CRS109-8G-1S-2HnD.
Не подключаются по Wi-Fi телефоны samsung (последние модели типа S11) и планшет ASUS — короче Android,
а именно не получают IP от DHCP роутера. Подключатся, если только в телефоне прописать статический IP.

При этом мой старенький Iphone SE и компьютеры подключается без проблем и получает IP от роутера.

Пробовал dhcp relay на клиентском свиче — не помогает.
И еще, если на клиентском свиче сделать свою подсеть со своим DHCP, то устройства android получают IP.

Схема подключения (на всех стоит Router OS 6.48.2):
(Роутер CCR-1009-7G-1C-1S+) —> (Свич CRS328-24P-4S+) —> (Клиентский Свич CRS109-8G-1S-2HnD)

логи клиентского свича
70:8B:CD:95:63:87@wlan1: disconnected, received deauth: sending station leaving (3)

логи роутера
DNS_SERVER_HOLE offering lease 192.168.33.121 for 70:8B:CD:95:63:87 without success

настройка роутера
# apr/29/2021 17:42:25 by RouterOS 6.48.2
# software > #
# model = CCR1009-7G-1C-1S+
# serial number =
/interface ethernet
set [ find default-name=ether1 ] name=ether1-DSL-LAN-INTERNET
set [ find default-name=ether6 ] name=ether6-WAN2
/interface list
add name=WAN
add name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=DNS_HOLE ranges=192.168.33.110-192.168.33.130
/ip dhcp-server
add address-pool=DNS_HOLE disabled=no interface=sfp-sfpplus1 lease-time=1d \
name=DNS_SERVER_HOLE
/interface list member
add interface=sfp-sfpplus1 list=WAN
add list=LAN
/ip address
add address=192.168.33.254/24 interface=sfp-sfpplus1 network=192.168.33.0
/ip arp
add address=192.168.33.193 disabled=yes interface=sfp-sfpplus1 mac-address=\
2C:F0:5D:CF:91:ED
/ip dhcp-client
add disabled=no interface=ether1-DSL-LAN-INTERNET
/ip dhcp-server network
add address=192.168.33.0/24 dns-server=192.168.33.254 gateway=192.168.33.254 \
netmask=24
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip dns static
add address=192.168.33.90 name=atc.rpm
add address=192.168.33.100 name=atc2.rpm
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1-DSL-LAN-INTERNET
/lcd
set color-scheme=dark
/system clock
set time-zone-name=Europe/Athens
/system ntp client
set enabled=yes server-dns-names=ru.pool.ntp.org
=========================================================================

Читайте также:  Вай фай шереметьево авторизация

настройки свича
# apr/29/2021 17:45:15 by RouterOS 6.48.2
# software > #
# model = CRS328-24P-4S+
# serial number =
/interface bridge
add admin-mac=08:55:31:4A:6C:AD auto-mac=no comment=defconf name=bridge
/interface ethernet
set [ find default-name=ether17 ] name=ether17-Server1
set [ find default-name=ether19 ] name=ether19-Server2
set [ find default-name=sfp-sfpplus4 ] name=sfp-sfpplus4-ROUTER
/interface list
add name=WAN
add name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/interface bridge port
add bridge=bridge comment=defconf interface=ether1
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=ether6
add bridge=bridge comment=defconf interface=ether7
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=ether9
add bridge=bridge comment=defconf interface=ether10
add bridge=bridge comment=defconf interface=ether11
add bridge=bridge comment=defconf interface=ether12
add bridge=bridge comment=defconf interface=ether13
add bridge=bridge comment=defconf interface=ether14
add bridge=bridge comment=defconf interface=ether15
add bridge=bridge comment=defconf interface=ether16
add bridge=bridge comment=defconf interface=ether17-Server1
add bridge=bridge comment=defconf interface=ether18
add bridge=bridge comment=defconf interface=ether19-Server2
add bridge=bridge comment=defconf interface=ether20
add bridge=bridge comment=defconf interface=ether21
add bridge=bridge comment=defconf interface=ether22
add bridge=bridge comment=defconf interface=ether23
add bridge=bridge comment=defconf interface=ether24
add bridge=bridge comment=defconf interface=sfp-sfpplus1
add bridge=bridge comment=defconf interface=sfp-sfpplus2
add bridge=bridge comment=defconf interface=sfp-sfpplus3
add bridge=bridge comment=defconf interface=sfp-sfpplus4-ROUTER
/interface list member
add interface=ether1 list=WAN
add interface=ether2 list=LAN
add interface=ether3 list=LAN
add interface=ether4 list=LAN
add interface=ether5 list=LAN
add interface=ether6 list=LAN
add interface=ether7 list=LAN
add interface=ether8 list=LAN
add interface=ether9 list=LAN
add interface=ether10 list=LAN
add interface=ether11 list=LAN
add interface=ether12 list=LAN
add interface=ether13 list=LAN
add interface=ether14 list=LAN
add interface=ether15 list=LAN
add interface=ether16 list=LAN
add interface=ether17-Server1 list=LAN
add interface=ether18 list=LAN
add interface=ether19-Server2 list=LAN
add interface=ether20 list=LAN
add interface=ether21 list=LAN
add interface=ether22 list=LAN
add interface=ether23 list=LAN
add interface=ether24 list=LAN
add interface=sfp-sfpplus1 list=LAN
add interface=sfp-sfpplus2 list=LAN
add interface=sfp-sfpplus3 list=LAN
add interface=sfp-sfpplus4-ROUTER list=LAN
/ip address
add address=192.168.33.253/24 interface=sfp-sfpplus2 network=192.168.33.0
/ip dhcp-client
add interface=bridge
/ip dns
set servers=8.8.8.8,8.8.4.4
/ip route
add distance=1 gateway=192.168.33.254
/system clock
set time-zone-name=Europe/Athens
/system identity
set name=»Main Switch»
/system ntp client
set enabled=yes server-dns-names=ru.pool.ntp.org
/system routerboard settings
set boot-os=router-os
======================================================================

настройки клиентского свича

# apr/29/2021 17:46:06 by RouterOS 6.48.2
# software > #
# model = CRS109-8G-1S-2HnD
# serial number =
/interface bridge
add name=bridge1
/interface list
add name=WAN
add name=LAN
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa-psk,wpa2-psk mode=\
dynamic-keys supplicant-identity=MikroTik wpa-pre-shared-key=000000007 \
wpa2-pre-shared-key=000000007
add eap-methods=»» name=guest supplicant-identity=»»
add authentication-types=wpa2-psk eap-methods=»» mode=dynamic-keys name=rpm \
supplicant-identity=»» wpa2-pre-shared-key=»blagoslovenie»
/interface wireless
set [ find default-name=wlan1 ] adaptive-noise-immunity=ap-and-client-mode \
band=2ghz-b/g/n channel-width=20/40mhz-Ce country=russia disabled=no \
frequency=auto hw-protection-mode=cts-to-self installation=indoor mode=\
ap-bridge name=wlan1-rpm security-profile=rpm ssid=rpm wireless-protocol=\
802.11 wmm-support=enabled wps-mode=disabled
/interface bridge port
add bridge=bridge1 interface=ether2
add bridge=bridge1 interface=ether3
add bridge=bridge1 interface=ether4
add bridge=bridge1 interface=ether5
add bridge=bridge1 interface=ether6
add bridge=bridge1 interface=ether7
add bridge=bridge1 interface=ether8
add bridge=bridge1 interface=ether1
add bridge=bridge1 interface=wlan1-rpm
/interface list member
add interface=ether1 list=WAN
add interface=bridge1 list=LAN
/ip address
add address=192.168.33.170/24 interface=bridge1 network=192.168.33.0
/ip dns
set servers=8.8.8.8,8.8.4.4
/ip route
add distance=1 gateway=192.168.33.254
/system clock
set time-zone-name=Europe/Athens
/system ntp client
set enabled=yes server-dns-names=ru.pool.ntp.org

Читайте также:  Изменить имя вай фай билайн

Источник

WiFi / DHCP network not working with your Android phone?

Tweet

Android refuses to route Internet traffic if your wireless router sends it classless static routes in its DHCP reply. Here is a fix.

The day I got my Android phone, I discovered that the address given to it by my DHCP server in my wireless network was correct, but the phone still would not access the Internet. The only way I could access the Internet is if I set the IP configuration statically in the phone, which was a pain because I’d have to enable and disable static configuration every time I came home / went away.

Digging a little deeper — using The Google a lot — I discovered the problem was the phone itself — if the phone requests an address via DHCP, and the reply contains a classless route definition (DHCP option 121), then the phone sets that up as the routes but never sets the static route correctly, and as a consequence the phone simply fails to route traffic outside the LAN. This is a known bug in Android, that hasn’t been addressed in years.

Disabling this behavior was a two-step process with dnsmasq (my DHCP server of choice):

# Identify android devices dhcp-mac=android,AA:24:59:77:42:* # Disable classless static routes for Android dhcp-option=android,121,0.0.0.0/0,10.254.102.1 

The first option in the configuration file lets me identify the Android phone as tag android. The second option sends an explicit «default route» using classless routing, effectively overriding the more general classless routing I am sending to the other machines.

This solved my problem. I can now browse the Web without having to set up my phone as static IP.

Источник

Оцените статью
Adblock
detector