Re: Default DNS lookup command?

2023-11-12 Thread Richard Hector

On 31/10/23 16:27, Max Nikulin wrote:

On 30/10/2023 14:03, Richard Hector wrote:

On 24/10/23 06:01, Max Nikulin wrote:

getent -s dns hosts zircon

Ah, thanks. But I don't feel too bad about not finding that ... 
'service' is not defined in that file, 'dns' doesn't occur, and 
searching for 'hosts' doesn't give anything useful either. I guess 
reading nsswitch.conf(5) is required.


Do you mean that "hosts" entry in your /etc/nsswitch.conf lacks "dns"? 
Even systemd nss plugins recommend to keep it as a fallback. If you get 
no results then your resolver or DNS server may not be configured to 
resolve single-label names. Try some full name


     getent -s dns ahosts debian.org


Sorry for the confusion (and delay) - I think I was referring to the 
getent man page, rather than the config file.


Richard



Re: Default DNS lookup command?

2023-10-30 Thread Max Nikulin

On 30/10/2023 14:03, Richard Hector wrote:

On 24/10/23 06:01, Max Nikulin wrote:

getent -s dns hosts zircon

Ah, thanks. But I don't feel too bad about not finding that ... 
'service' is not defined in that file, 'dns' doesn't occur, and 
searching for 'hosts' doesn't give anything useful either. I guess 
reading nsswitch.conf(5) is required.


Do you mean that "hosts" entry in your /etc/nsswitch.conf lacks "dns"? 
Even systemd nss plugins recommend to keep it as a fallback. If you get 
no results then your resolver or DNS server may not be configured to 
resolve single-label names. Try some full name


getent -s dns ahosts debian.org





Re: Default DNS lookup command?

2023-10-30 Thread Richard Hector

On 24/10/23 06:01, Max Nikulin wrote:

On 22/10/2023 18:39, Richard Hector wrote:

But not strictly a DNS lookup tool:

richard@zircon:~$ getent hosts zircon
127.0.1.1   zircon.lan.walnut.gen.nz zircon

That's from my /etc/hosts file, and overrides DNS. I didn't see an 
option in the manpage to ignore /etc/hosts.


getent -s dns hosts zircon

However /etc/resolv.conf may point to local systemd-resolved server or 
to dnsmasq started by NetworkManager and they read /etc/hosts by default.


Ah, thanks. But I don't feel too bad about not finding that ... 
'service' is not defined in that file, 'dns' doesn't occur, and 
searching for 'hosts' doesn't give anything useful either. I guess 
reading nsswitch.conf(5) is required.


Thanks,
Richard



Re: Default DNS lookup command?

2023-10-23 Thread Max Nikulin

On 22/10/2023 18:39, Richard Hector wrote:

But not strictly a DNS lookup tool:

richard@zircon:~$ getent hosts zircon
127.0.1.1   zircon.lan.walnut.gen.nz zircon

That's from my /etc/hosts file, and overrides DNS. I didn't see an 
option in the manpage to ignore /etc/hosts.


getent -s dns hosts zircon

However /etc/resolv.conf may point to local systemd-resolved server or 
to dnsmasq started by NetworkManager and they read /etc/hosts by default.


I haven't found a way to get just DNS results, without pulling in extra 
software.


Usual task for application is to resolve hostname and enough methods 
besides DNS may be used: multicast DNS, LLMNR, etc. If you need a debug 
tool then you should install it. On the other hand it is desperate when 
a feature is implemented, but not exposed to users.





Re: Default DNS lookup command?

2023-10-23 Thread Max Nikulin

On 23/10/2023 20:52, David Wright wrote:
AFAICT, if you don't have busybox installed, then I think it's likely 
that you removed it yourself.


Or it is a LXC container installed using the "download" template. It 
uses systemd-networkd and systemd-resolved. I have never tried qemu with 
kernel and initrd loaded from host, so related tools are not necessary 
inside VM.


So for original requirement "on any Debian Bullseye or Bookworm install" 
I would not neglect resolvectl when systemd-resolved is active.




Re: Default DNS lookup command?

2023-10-23 Thread David Wright
On Sun 22 Oct 2023 at 11:07:05 (+0700), Max Nikulin wrote:
> On 21/10/2023 22:58, David Wright wrote:
> > On Sat 21 Oct 2023 at 17:35:21 (+0200), Reiner Buehl wrote:
> > > is there a DNS lookup command that is installed by default on any
> > > Debian Bullseye or Bookworm install?
> > 
> > nslookup is in busybox.
> 
> busybox is an optional package, so it may be absent. "getent hosts"
> from Greg's message is better in this sense. If systemd-resolved is
> configured on a particular instance then
> 
> resolvectl query debian.org
> 
> may be an option.

AFAICT, if you don't have busybox installed, then I think it's likely
that you removed it yourself. The d-i initrd has busybox already installed,
and most people will see something like this in its log:

  # head -n2 /var/log/installer/syslog
  Jul 26 19:17:07 syslogd started: BusyBox v1.35.0
  Jul 26 19:17:07 kernel: klogd started: BusyBox v1.35.0 (Debian 1:1.35.0-4+b3)
  #

If the following file is still available (the one with the highest
generation number), you can see that busybox is typically the third
package to be installed by APT. (If the file has been rotated away,
just search for "busybox" in the file above.)

  # zcat /var/log/apt/history.log.2.gz | head

  Start-Date: 2023-07-26  19:30:49
  Commandline: apt-get -o APT::Status-Fd=4 -o APT::Keep-Fds::=5 -o 
APT::Keep-Fds::=6 -q -y --no-remove install locales
  Install: locales:i386 (2.36-9), libc-l10n:i386 (2.36-9, automatic)
  End-Date: 2023-07-26  19:30:56

  Start-Date: 2023-07-26  14:31:14
  Commandline: apt-get -o APT::Status-Fd=4 -o APT::Keep-Fds::=5 -o 
APT::Keep-Fds::=6 -q -y --no-remove install busybox
  Install: busybox:i386 (1:1.35.0-4+b3)
  End-Date: 2023-07-26  14:31:16
  # 

I suppose preseed experts might be able to prevent that from
happening, though to what purpose, IDK.

I can only assume that its Priority is set to Optional so that
it's easily removable if not required.

I don't see many reasons that systemd-resolved would get installed
unless you specifically asked for it, so I'd hardly call it
"installed by default".

Cheers,
David.



Re: Default DNS lookup command?

2023-10-22 Thread Richard Hector

On 22/10/23 04:56, Greg Wooledge wrote:

On Sat, Oct 21, 2023 at 05:35:21PM +0200, Reiner Buehl wrote:

is there a DNS lookup command that is installed by default on any Debian


getent hosts NAME
getent ahostsv4 NAME

That said, you get much finer control from dedicated tools.



That is a useful tool I should remember.

But not strictly a DNS lookup tool:

richard@zircon:~$ getent hosts zircon
127.0.1.1   zircon.lan.walnut.gen.nz zircon

That's from my /etc/hosts file, and overrides DNS. I didn't see an 
option in the manpage to ignore /etc/hosts.


I haven't found a way to get just DNS results, without pulling in extra 
software.


Richard



Re: Default DNS lookup command?

2023-10-21 Thread Max Nikulin

On 21/10/2023 22:58, David Wright wrote:

On Sat 21 Oct 2023 at 17:35:21 (+0200), Reiner Buehl wrote:

is there a DNS lookup command that is installed by default on any
Debian Bullseye or Bookworm install?


nslookup is in busybox.


busybox is an optional package, so it may be absent. "getent hosts" from 
Greg's message is better in this sense. If systemd-resolved is 
configured on a particular instance then


resolvectl query debian.org

may be an option.




Re: Default DNS lookup command?

2023-10-21 Thread reiner . buehl

Perfect! Then I just need to add an alias to my profile and can use nslookup :-)

On 21.10.23 17:58, David Wright  wrote:

On Sat 21 Oct 2023 at 17:35:21 (+0200), Reiner Buehl wrote:
> is there a DNS lookup command that is installed by default on any
> Debian Bullseye or Bookworm install? Something that doesn't require as
> much dependencies as bind9-utils (which provides dig and nslookup) or
> bind9-host?

nslookup is in busybox. Type:

$ busybox nslookup
$ busybox nslookup debian.org

Cheers,
David.






Re: Default DNS lookup command?

2023-10-21 Thread Juri Grabowski
Hello,

it's not really answer to your question, but for simple things like
IP-Addresses you can use getent ahosts, getent hosts or ping directly.

Best Regards,
Juri Grabowski



Re: Default DNS lookup command?

2023-10-21 Thread David Wright
On Sat 21 Oct 2023 at 17:35:21 (+0200), Reiner Buehl wrote:
> is there a DNS lookup command that is installed by default on any
> Debian Bullseye or Bookworm install? Something that doesn't require as
> much dependencies as bind9-utils (which provides dig and nslookup) or
> bind9-host?

nslookup is in busybox. Type:

$ busybox nslookup
$ busybox nslookup debian.org

Cheers,
David.



Re: Default DNS lookup command?

2023-10-21 Thread Greg Wooledge
On Sat, Oct 21, 2023 at 05:35:21PM +0200, Reiner Buehl wrote:
> is there a DNS lookup command that is installed by default on any Debian

getent hosts NAME
getent ahostsv4 NAME

That said, you get much finer control from dedicated tools.