tam94131
Posts: 22
Joined: Thu Aug 08, 2019 11:00 pm

Ping RaspPi using Hostname _without_ .local?

Tue Nov 26, 2019 7:08 pm

Hi all,

At a previous location, I had a network of RaspPis happily talking to each other (during REST calls) using the RaspPi's hostname -- but without ".local" -- and all worked fine. I've now moved to a new location (which has a new network) and I can no longer use just the hostname (e.g., "ping some-hostname"). Instead, I have to append a ".local" to the hostname (e.g., "ping some-hostname.local") or use the IP address.

Is there something I'm doing wrong, or was I supposed to be always using ".local". Some of python programs to change if that's the case....

Insight appreciated!

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Ping RaspPi using Hostname _without_ .local?

Tue Nov 26, 2019 8:23 pm

If you want that you'll need to hard-code IP addresses in /etc/hosts.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

jj_0
Posts: 113
Joined: Wed Jul 11, 2012 7:07 am

Re: Ping RaspPi using Hostname _without_ .local?

Tue Nov 26, 2019 8:43 pm

Add

Code: Select all

search .local
to /etc/resolv.conf, or maybe to a new.conf file in e.g.

Code: Select all

/usr/lib/systemd/resolved.conf.d/
. More info at https://www.freedesktop.org/software/sy ... .conf.html.

epoch1970
Posts: 5022
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Ping RaspPi using Hostname _without_ .local?

Tue Nov 26, 2019 9:07 pm

jj_0 wrote:
Tue Nov 26, 2019 8:43 pm
Add

Code: Select all

search .local
to /etc/resolv.conf
I can't test. Does this work?

According to this I would believe a few extra steps are required.
Not a great idea, anyway.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

tam94131
Posts: 22
Joined: Thu Aug 08, 2019 11:00 pm

Re: Ping RaspPi using Hostname _without_ .local?

Wed Nov 27, 2019 7:45 pm

@dougie, I'm trying not to have hard-coded IP addresses anywhere which is why I'm using hostname. Of that is not working too well.

@jj_0, I add 'search .local' to the config file and it doesn't seem to anything

I guess it doesn't hurt that any time I refer to RaspPi on the intranet that I suffix the hostname with '.local'. It doesn't hurt but I will have to change a bunch of programs....

Return to “Troubleshooting”