Arikania
Posts: 15
Joined: Tue Sep 11, 2018 6:44 am

Re: Hostname on DHCP - is there a definitive answer?

Mon Jun 17, 2019 6:30 pm

In order to be able to ping by hostname, add this to your /etc/hosts file:

Code: Select all

127.0.1.1	your-hostname

No Samba required. Works on wi-fi as well, but does not present the hostname to the router. So the pie still shows up as "unknown".


A.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22693
Joined: Sat Jul 30, 2011 7:41 pm

Re: Hostname on DHCP - is there a definitive answer?

Mon Jun 17, 2019 10:19 pm

Arikania wrote:
Mon Jun 17, 2019 6:30 pm
In order to be able to ping by hostname, add this to your /etc/hosts file:

Code: Select all

127.0.1.1	your-hostname

No Samba required. Works on wi-fi as well, but does not present the hostname to the router. So the pie still shows up as "unknown".


A.
No need to resurrect a old thread, this stuff is already in Raspbian.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Return to “Beginners”