I see names of computers in my router's DHCP leasing list. My android galaxy tab is listed under an alphanumeric name. How do I set a friendly name that I like?
On Android 4.4 and lower, you can change the hostname to a less cryptic name in the Developer Options under Settings. Under the "Debugging" section in the Developer Options you will see an option called "Device hostname" which should currently be set to this rather cryptic name. You can change it to any alpha numeric name you like.
adb shell getprop net.hostname setprop net.hostname <new_hostname>
In some Android phones, you may change in
- Top right menu > Advanced
- Wi-Fi Direct
- Top right option Rename device
- Write your new device name and press OK
- Turn off and on your Wi-Fi
- If it has no effect, restart your phone.
Important: Not all Android phones have this option, and not all phones modify their hostname correctly, even after modifying the device name from that option.
Hostname is used to easily identify and remember hosts connected to a network. It's set on boot, e.g. from
/etc/hostname on Linux based systems. Hostname is also a part of
DHCPREQUEST (standardized as code 12 by IETF) which a DHCP client (Android device in our case) makes to DHCP server (WiFi router) to get an IP address assigned. DHCP server stores the hostnames to offer services like DNS. See details in How to ping a local network host by hostname?.
Android - instead of using Linux kernel's hostname service - used property
net.hostname (since Android 2.2) to set a unique host name for every device which was based on
android_id. This hostname property was used for DHCP handshake (as added in Android 2.2 and 4.0). In Android 6
net.hostname continued to be used (1, 2, 3, 4) in new Java DHCP client when native
dhcpcd was abandoned and later service was removed in Android 7. Since Android 8 - when
android_id became unique to apps -
net.hostname is no more set, so a
null is sent in
DHCPREQUEST. See Android 8 Privacy Changes and Security Enhancements:
net.hostnameis now empty and the dhcp client no longer sends a hostname
So the WiFi routers show no host names for Android 8+, neither we can set / unset / change it.
However on rooted devices you can set
net.hostname manually using
setprop command or add in some
.rc file to set on every boot. Or use a third party client like
busybox udhcpc to send desired hostname and other options to router. See Connecting to WiFi via ADB Shell.
Just wanted to reference another related solution I came across using ADB (and requires rooted device): http://nileshgr.com/2012/10/13/how-to-change-wifi-host-name-of-your-android-device. I would however prefer the ADB commands presented here on SO than this link, but it's another method at least.