i noticed failure with 'nslookup localhost' command on target .
{{
/# nslookup localhost
nslookup: write to '127.0.0.1': Connection refused
Server: 8.8.8.8
Address: 8.8.8.8:53
** server can't find localhost: NXDOMAIN
** server can't find localhost: NXDOMAIN
}}
I referred /etc/resolv.conf and observed domain details as given below.
{{
/# cat /etc/resolv.conf
nameserver 127.0.0.1
nameserver 8.8.8.8
domain
}}
where as 'nslookup google.com' is pinging successfully but still observed 'localhost' connection refusal message
i understood, the error is not critical and of course DNS is running on the device otherwise For example: 'nslookup google.com' also fails if DNS is not running. So DNS server is OK but 'localhost' is not connected hence it's throwing error mentioned in the first comment?
netstat -nlp | grep ':53' and you can verify which process is listening on port 53. if none then remove nameserver 127.0.0.1 from resolv.conf, or adjust according to your setup if for example you are listening on specific IP address.
{{
/# netstat -nlp | grep ':53'
/#
}}
I removed 127.0.0.1 from resolv.conf , still the below error message is seen
with command 'nslookup localhost'.
{{
/# nslookup localhost
Server: 8.8.8.8
Address: 8.8.8.8:53
Post the output of the commands below (copy/paste the entire block and press Enter). Use the preformatted text button (</>) and redact the public IP addresses if any.
it means you don't run local dns server and 8.8.8.8 google dns server will not resolve localhost, which is correct.
if you want localhost to be resolved you'll need a local dns resolver. by default owrt configures one for you, what did you do with that? did you disable it? yeah, pls copy the output @pavelgl suggested.
note: please use preformatted text option while posting, for your console output for better readability.
I just want to ensure 'nslookup locahost' doesn't throw error message mentioned in my first comment. in my host ubuntu machine, 'nslookup localhost' command is OK where as on target device x86-64 , its failing.
my target (x86-64) , doesn't contains dnsmasq service in /etc/ directory to execute the steps mentioned in one of previous comments.
/# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.027 ms
64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.026 ms
64 bytes from 127.0.0.1: seq=2 ttl=64 time=0.031 ms
64 bytes from 127.0.0.1: seq=3 ttl=64 time=0.023 ms
^C
Then yeah what's the issue? Others have already pointed out. Nslokup will ask the nameserver set on the system or specified as argument. Public resolver can but mostly will not resolve localhost. If you have no local resolver which knows about the record localhost or is configured to not resolve that then it will simply never resolve.