On Thu, May 23, 2024 at 07:53:31AM -0400, Paul M Foster wrote:
> Nslookup fails. However, yosemite.mars.lan is in the hosts file and you
> can successfully ping it. It has a fixed (local) IP, which was set in the
> router. I don't understand why nslookup fails when buckaroo knows who
> yosemite is.

nslookup looks *only* in DNS.

If you want a tool that follows the same hostname lookup policies
that programs like "ping" use, there's getent(1).

hobbit:~$ nslookup hobbit
Server:     127.0.0.1
Address:    127.0.0.1#53

** server can't find hobbit: NXDOMAIN

hobbit:~$ getent hosts hobbit
127.0.1.1       hobbit.wooledge.org hobbit
hobbit:~$ getent hosts www.debian.org
2603:400a:ffff:bb8::801f:3e www.debian.org

Of course, a lot of people just use "ping" for this same purpose.  It's
not ideal, but it works.

hobbit:~$ ping -c1 hobbit
PING hobbit.wooledge.org (127.0.1.1) 56(84) bytes of data.
64 bytes from hobbit.wooledge.org (127.0.1.1): icmp_seq=1 ttl=64 time=0.015 ms

--- hobbit.wooledge.org ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.015/0.015/0.015/0.000 ms

Reply via email to