¿Resolver el host local sin ningún servidor DNS?

¿Resolver el host local sin ningún servidor DNS?

¿Hay alguna forma de resolver el host local sin ningún servidor DNS?

A continuación se muestra mi configuración.

# ifconfig
eth4      Link encap:Ethernet  HWaddr 00:50:56:9C:4D:2F
          inet6 addr: 2004:c0a8:5b01:1:250:56ff:fe9c:4d2f/64 Scope:Global
          inet6 addr: fe80::250:56ff:fe9c:4d2f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:196832 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12558 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:16362576 (15.6 MiB)  TX bytes:2467903 (2.3 MiB)

/etc/hostsTambién agregué el nombre en el archivo.

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
2004:c0a8:5b01:1:250:56ff:fe9c:4d2f  saravana69rhel83 
2004:c0a8:5b01:1:250:56ff:fe9c:4d2f         localhost localhost.localdomain localhost6 localhost6.localdomain6
::1  saravana69rhel83 

Cuando intento hacer una búsqueda de DNS, no se resuelve en absoluto:

# dig saravana69rhel83  AAAA

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.62.rc1.el6_9.4 <<>> saravana69rhel83  AAAA
;; global options: +cmd
;; connection timed out; no servers could be reached

EDITAR

[root@saravana69rhel83 ~]# ping saravana69rhel83 
ping: unknown host saravana69rhel83 
[root@saravana69rhel83 ~]# ping6 saravana69rhel83 
PING saravana69rhel83 (saravana69rhel83 ) 56 data bytes
64 bytes from saravana69rhel83 : icmp_seq=1 ttl=64 time=0.030 ms
^C
--- saravana69rhel83  ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 855ms
rtt min/avg/max/mdev = 0.030/0.030/0.030/0.000 ms
[root@saravana69rhel83 ~]#


[root@saravana69rhel83 ~]# nslookup -query=AAAA saravana69rhel83 
;; connection timed out; trying next origin
;; connection timed out; no servers could be reached

[root@saravana69rhel83 ~]#

Respuesta1

Estás usando /etc/hostscorrectamente pero nslookupignoras el archivo de hosts. Se trata de realizar una búsqueda de DNS, no una búsqueda de cómo se resuelve el nombre de host en su entorno configurado. Pruebe pingcon el nombre de host, ya que incluirá el archivo de hosts.

Ver¿Por qué no se consulta mi archivo /etc/hosts cuando...?

información relacionada