Hotspot DHCP issues without mobile data (dhcp4 request timed out)



  • By default, does the Android "hotspot" functionality provide a DHCP server to its clients? Or does it just pass DHCP info on from the network that it's connected to?

    I'm trying to create a hotspot for LAN-only communication between my laptop and my phone. I do not have a SIM card, so "Mobile Data" is disabled." I also don't have access to another WiFI network, so "WiFi" is disabled.

    I created a hotspot and try to connect to it from my laptop, but I get this error from NetworkManager's logs (I'm using GNU/Debian 11 Linux):

    [user@sys-net ~]$ sudo journalctl -u NetworkManager -f
    ...
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.7570] device (wls6): Activation: starting connection '' (501ce9ff-854f-472a-81cd-5eb447c47379)
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.7585] device (wls6): supplicant interface state: disconnected -> interface_disabled
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.7585] device (p2p-dev-wls6): supplicant management interface state: disconnected -> interface_disabled
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.7654] device (wls6): supplicant interface state: interface_disabled -> disconnected
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.7655] device (p2p-dev-wls6): supplicant management interface state: interface_disabled -> disconnected
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.7667] device (wls6): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.7675] manager: NetworkManager state is now CONNECTING
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.7840] device (wls6): set-hw-addr: set-cloned MAC address to  (stable)
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8065] device (wls6): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8087] device (wls6): Activation: (wifi) access point '' has security, but secrets are required.
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8087] device (wls6): state change: config -> need-auth (reason 'none', sys-iface-state: 'managed')
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8248] device (wls6): supplicant interface state: disconnected -> interface_disabled
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8248] device (p2p-dev-wls6): supplicant management interface state: disconnected -> interface_disabled
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8250] device (wls6): supplicant interface state: interface_disabled -> disconnected
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8250] device (p2p-dev-wls6): supplicant management interface state: interface_disabled -> disconnected
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8405] device (wls6): state change: need-auth -> prepare (reason 'none', sys-iface-state: 'managed')
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8412] device (wls6): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8461] device (wls6): Activation: (wifi) connection '' has security, and secrets exist.  No new secrets needed.
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8473] Config: added 'ssid' value ''
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8474] Config: added 'scan_ssid' value '1'
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8474] Config: added 'bgscan' value 'simple:30:-70:86400'
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8474] Config: added 'key_mgmt' value 'WPA-PSK WPA-PSK-SHA256 FT-PSK SAE FT-SAE'
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8474] Config: added 'auth_alg' value 'OPEN'
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.8475] Config: added 'psk' value ''
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9055] device (wls6): supplicant interface state: disconnected -> authenticating
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9059] device (p2p-dev-wls6): supplicant management interface state: disconnected -> authenticating
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9109] device (wls6): supplicant interface state: authenticating -> associating
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9110] device (p2p-dev-wls6): supplicant management interface state: authenticating -> associating
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9365] device (wls6): supplicant interface state: associating -> 4way_handshake
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9365] device (p2p-dev-wls6): supplicant management interface state: associating -> 4way_handshake
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9611] device (wls6): supplicant interface state: 4way_handshake -> completed
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9611] device (wls6): Activation: (wifi) Stage 2 of 5 (Device Configure) successful. Connected to wireless network ""
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9611] device (p2p-dev-wls6): supplicant management interface state: 4way_handshake -> completed
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9616] device (wls6): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
    Apr 07 16:15:24 sys-net NetworkManager[1446]:   [1649340924.9621] dhcp4 (wls6): activation: beginning transaction (timeout in 45 seconds)
    ...
    ... 
    ...
    Apr 07 16:16:10 sys-net NetworkManager[1446]:   [1649340970.5783] dhcp4 (wls6): request timed out
    Apr 07 16:16:10 sys-net NetworkManager[1446]:   [1649340970.5783] dhcp4 (wls6): state changed unknown -> timeout
    Apr 07 16:16:10 sys-net NetworkManager[1446]:   [1649340970.5784] device (wls6): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
    Apr 07 16:16:10 sys-net NetworkManager[1446]:   [1649340970.5799] manager: NetworkManager state is now DISCONNECTED
    

    Why is my android device failing to provide my laptop with an IP Address? Is it because my android isn't already connected to another network running a DHCP server? How can I make my android hotpsot provide a DHCP IP address to my laptop when I connect to my android's hotspot?



  • This issue was caused by my firewall and due to complexity between multiple user profiles.

    I was able to fix all issues by entirely disabling the firewall setup by the afwall app.

    However, as a slightly better option, I was able to fix this issue as follows:

    1. As the 'Owner' profile, enable Airplane mode. Make sure WiFi and Mobile Data are off if you want to use the phone's own internal DHCP server. Then enable Hotspot

    2. In the user's account where afwall is configured, check the box to give "wifi" access to the row named (any app) - Same as selecting all apps - !! WARNING !!

    Note: I did try to isolate the wifi permissions to a single app, but I found that if every app's "wifi" setting was enabled (except the entry for (any app) of course), then it wouldn't work. But if the "wifi" setting was enabled for the (any app) row, then it worked.

    So it appears that there is, in fact, a distinction between selecting all apps or selecting the (any app) entry. My guess is this distinction is most relevant when using multiple user profiles.

    On another handset, I was able to resolve this issue and get an IP address when only enabling the "wifi" permission for the (root) - Apps running as root entry (as opposed to the (any app) entry). YMMV device-to-device, version-to-version, ROM-to-ROM.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2