I have a raspberry pi 4 with raspbian buster installed. I set the hostname using raspi-config to "myrpi". I can connect to it using ssh and it works fine. But after a few hours or so, the hostname changes to "myrpi-3" where 3 can be any number. The greatest number I got so far was 13. I know it changes because I scan my network using Advanced IP Scanner and it still shows the same IP address. I have no idea what is happening. I am running a mqtt broker, a postgresql database and a web server using docker.

I fix this by rebooting and it goes back to "myrpi" but after few hours, it changes to another hostname, example "myrpi-5".

Anyone experienced this before or knows what is happening and how to prevent the frequent change in hostname?

Thank you very much.

  • what is the output of cat /etc/hostname ? – Michael Harvey Nov 28 '19 at 19:44
  • cat /etc/hostname myrpi – user3492268 Nov 29 '19 at 8:38
  • Wifi or ethernet? Have you set up dhcp reservation on your router? – Michael Harvey Nov 29 '19 at 13:27
  • I tried both even at the same time. Using Advanced IP Scanner, they both have the same hostname but different IPs. I didn't touch my router settings because I've had other pi's in my network but didn't have this problem – user3492268 Nov 29 '19 at 23:18
  • "I've had other pi's in my network " - they aren't all called 'myrpi' by any chance? – Michael Harvey Dec 1 '19 at 9:23

Your Answer

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

Browse other questions tagged or ask your own question.