9

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.

ctrl-alt-delor
  • 27,473
  • 9
  • 58
  • 102
FilipK
  • 131
  • 2
  • 11
  • 12
    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]: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names – Dirk Krijgsman Nov 09 '18 at 08: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 09 '18 at 08:06
  • Both of you are correct – FilipK Nov 09 '18 at 08:11
  • 1
    IF your phone requests a hostname via DHCP (Check the DHCPd logs), your can use [Option 012](http://www.networksorcery.com/enp/protocol/bootp/option012.htm) to supply a hostname – Alex Stragies Nov 09 '18 at 08:12
  • @AlexStragies no such luck – FilipK Nov 09 '18 at 08:32
  • As you said, check-names. I also dealt with a huge infra-structure in the past, and had to use it for several reasons. – Rui F Ribeiro Nov 09 '18 at 09:18
  • What DNS / DHCP server are you using? and logs of which service? – ctrl-alt-delor Nov 09 '18 at 10:09
  • DNS - bind 9.9.9P1-53.1, dhcp-server 4.3.3-11.6.1 and rsyslog (8.23.0-2.7.1) which sends logs to graylog – FilipK Nov 09 '18 at 10:52

1 Answers1

1

DHCP configuration with set hostname sample:

host SAMPLE_PHONE_1 {  

    hardware ethernet 00:00:00:00:00:00;  
    fixed-address 192.168.0.10;  
    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.

Barmar
  • 9,648
  • 1
  • 19
  • 28