Date: Mon, 26 Jun 2023 10:58:13 +0200 From: freebsd@vanderzwan.org To: Steven Friedrich <freebsdlouisville@gmail.com> Cc: FreeBSD Questions Mailing List <freebsd-questions@freebsd.org> Subject: Re: Using /etc/hosts, not dns Message-ID: <1ED24C4A-FABF-4096-970D-4017616FC124@vanderzwan.org> In-Reply-To: <846f37ec-c0b3-0b1a-6294-1da6a9260777@Gmail.com> References: <846f37ec-c0b3-0b1a-6294-1da6a9260777@Gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi > On 25 Jun 2023, at 22:51, Steven Friedrich = <freebsdlouisville@gmail.com> wrote: >=20 > I have been using /etc/hosts for decades to identify local hosts. I = don't want the complexity of dns for this simple scenario. >=20 > I issue: host slimline > Host slimline not found: 3(NXDOMAIN) >=20 Man page for host command starts with:=20 NAME host - DNS lookup utility So that means it specifically queries DNS, just like nslookup. To use the normal lookup methods configured in /etc/nsswitch.conf you = should use the getent command: NAME getent - get entries from administrative database SYNOPSIS getent database [key ...] So 'getent hosts slimline=E2=80=99 should give you the result you want. Cheers, Paul > Here's the /etc/hosts: >=20 > # $FreeBSD$ > # > # Host Database > # > # This file should contain the addresses and aliases for local hosts = that > # share this file. Replace 'my.domain' below with the domainname of = your > # machine. > # > # In the presence of the domain name service or NIS, this file may > # not be consulted at all; see /etc/nsswitch.conf for the resolution = order. > # > # > ::1 localhost localhost.Friedrich.org > 127.0.0.1 localhost localhost.Friedrich.org > 127.0.1.1 Slimline.Friedrich.org > # > # Imaginary network. > #10.0.0.2 myname.my.domain myname > #10.0.0.3 myfriend.my.domain myfriend > # > # According to RFC 1918, you can use the following IP networks for > # private nets which will never be connected to the Internet: > # > # 10.0.0.0 - 10.255.255.255 > # 172.16.0.0 - 172.31.255.255 > # 192.168.0.0 - 192.168.255.255 > # > # In case you want to be able to connect to the Internet, you need > # real official assigned numbers. Do not try to invent your own = network > # numbers but instead get one from your network provider (if any) or > # from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or = AfriNIC.) > # > # local additions > 192.168.1.1 Verizon Internet > 192.168.2.1 RAX80 Netgear router > 192.168.2.2 NAS WDMyCloudEX2Ultra > 192.168.2.3 Brother laser > 192.168.2.4 AppleTV > 192.168.2.5 HP-ENVY > 192.168.2.6 PS5 > 192.168.2.7 PS4 > 192.168.2.9 Slimline.Friedrich.org Slimline > 192.168.2.10 Pi4B > 192.168.2.11 Dell Inspiron3668 MATE Cinnamon Neon Xfce PCLinux > 192.168.2.12 iPhone > 192.168.2.15 XPS XPS-9320 laptop >=20 > and /etc/resolv.conf > # Generated by resolvconf > nameserver 192.168.2.1 >=20 > nameserver 127.0.0.1 > options edns0 >=20 > and /etc/nsswitch.conf >=20 > # > # nsswitch.conf(5) - name service switch configuration file > # $FreeBSD$ > # > group: compat > group_compat: nis > hosts: files dns > netgroup: compat > networks: files > passwd: compat > passwd_compat: nis > shells: files > services: compat > services_compat: nis > protocols: files > rpc: files >=20 > Why won't host lookup slimline in /etc/hosts? > --=20 > FreeBSD slimline.friedrich.org 13.2-RELEASE-p1 FreeBSD 13.2-RELEASE-p1 = GENERIC amd64 > SLIMLINE is GENERIC with unnecessary drivers removed > /usr/ports/.git/HEAD > ref: refs/heads/2023Q2 >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1ED24C4A-FABF-4096-970D-4017616FC124>