Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Jun 2023 19:47:15 -0700
From:      "Dan Mahoney (Ports)" <freebsd@gushi.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:  <198956D1-6B93-4E35-AAC9-872AC146C538@gushi.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


> On Jun 25, 2023, at 1:51 PM, 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
> 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?

Because you also have to put it in /etc/hosts as its shortname, as the =
two =E2=80=9Clocalhost=E2=80=9D examples above should have suggested.

-Dan




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?198956D1-6B93-4E35-AAC9-872AC146C538>