2

I've set computer hostname in /etc/hostname a while ago (also there are record in /etc/hosts). Everything worked fine, but recently I've noticed that value of hostname (and /proc/sys/kernel/hostname) changed (to hostname of neighbour computer), although I haven't touched anything related. Value of /etc/hostname remains correct. Which mechanism may cause such change?

There are similar problem description, but it doesn't contains any solution.

4
  • 1
    What Linux distribution and version are you running?
    – Banjer
    Nov 22 '13 at 14:50
  • In addition. Are there naming services running?
    – Karlson
    Nov 22 '13 at 16:35
  • @Banjer Debian stable
    – valodzka
    Nov 23 '13 at 4:11
  • @Karlson No, I don't use any
    – valodzka
    Nov 23 '13 at 4:11
0

It's possible your kernel has autoconfiguration enabled and the DHCP server on your network is supplying this hostname.

Usually the DHCP hostname is ignored if /etc/hostname is present (systemd-networkd does this, for example) but given the age of your question I would guess that whatever was handling network configuration at the time was taking the hostname from the DHCP response in preference to the one configured manually.

If you want to check this, run a program such as Wireshark and have it listen to your network traffic. Type in a filter of dhcp and then unplug and replug your network cable. You should see the DHCP responses appear and you can examine them in the Wireshark window to see what hostname the server is sending you. If it matches the one you are seeing, that confirms where it's coming from. The solution will then be to configure your system to ignore host names specified in DHCP response messages.

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.