I got DNS set up on my company's server and it works just fine, except I got problem with some phones. For example one of the phones is “Huawei P9 lite”, and it's hostname (set on the phone, no chance to change that without root) is “HUAWEI_P9_lite”, which causes my logs to flood with errors.

Is there any way to deal with underscores in hostnames? I know I can set an option to ignore check-names, but I would rather not. Maybe I can somehow force a hostname, for certain devices (based on MAC address)?

On the same server there is also a DHCP server.

  • 11
    A hostname is not allowed to have underscore (_) characters. I don't understand why Huawei doesn't follow this standard. See this [Wikipedia][1] article. As Huawai are in fault, you will have to find a way to work around it. [1]: en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names – Dirk Krijgsman Nov 9 '18 at 8:01
  • 3
    But this means you can't have more than one Huawei P9 phone on your network, because otherwise there'll be a hostname conflict? – dr_ Nov 9 '18 at 8:06
  • Both of you are correct – FilipK Nov 9 '18 at 8:11
  • 1
    IF your phone requests a hostname via DHCP (Check the DHCPd logs), your can use Option 012 to supply a hostname – Alex Stragies Nov 9 '18 at 8:12
  • @AlexStragies no such luck – FilipK Nov 9 '18 at 8:32

DHCP configuration with set hostname sample:

host SAMPLE_PHONE_1 {  

    hardware ethernet 00:00:00:00:00:00;  
    option host-name "SAMPLE_PHONE_1";  

But... Android DHCP don't have option to receive hostname from DHCP enabled.... You will have to get your phone rooted to solve it... If do you have root of your phone you can download 'Device ID Changer' from Play Store and change it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.