$ dig @127.0.0.1 localhost
$ dig @127.0.0.1 localhost.
;localhost. IN A
;; ANSWER SECTION:
localhost. 604800 IN A 127.0.0.1
;; AUTHORITY SECTION:
localhost. 604800 IN NS localhost.
;; ADDITIONAL SECTION:
localhost. 604800 IN AAAA ::1
ping localhost.
$ ping localhost.
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.058 ms
and:
$ ping localhost
PING localhost.pl (46.105.234.97) 56(84) bytes of data.
$ whois localhost
No whois server is known for this kind of object.
$ whois localhost.pl
DOMAIN NAME: localhost.pl
registrant type: organization
nameservers: ns1.goo.pl. [178.33.152.98]
ns2.goo.pl. [94.23.111.174]
$ cat /etc/hosts
127.0.0.1 localhost
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
$ cat /etc/host.conf
# The "order" line is only used by old versions of the C library.
order bind,hosts
multi on
why my INTERNAL network is resolving localhost to public ip ???
edit:
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat
group: compat
shadow: compat
#hosts: dns files
#networks: files
hosts: files dns
networks: files dns
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
why setting dns over files makes this difference especially when i set localhost zone and resolving to loop-back (127.0.0.1) ?
$ ping localhost # hosts: files dns
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.075 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=2 ttl=64 time=0.149 ms
how i can get rid of using /etc/hosts ? and use only named service ? or its existence is highly linked to the server functioning???
- BIND 9.10.3-P2-Ubuntu
- Ubuntu Server 15.10
To help us understand why your problem exists in the first place, can you possibly explain your incentive to not use local files for localhost resolution? - SmallLoanOf1M
background:
i set a host on nginx "host.domain.tld" one of many but one acting as a proxy to "webmin" with below definition
location / {
proxy_redirect http://host.domain.tld:10000/ https://host.domain.tld/;
proxy_pass http://localhost:10000/;
proxy_set_header Host $host;
}
webmin bind to 127.0.0.1:10000
one day I visit the page and i get 504 - gateway timeout so i start digging through logs what is wrong why i dont see my page :D
in logs i saw upstream connect "some weird public ip" - it was looking like man in middle attack :D
more testing did show that ping is directing to this public ip "localhost".pl so i was searching how and why my server is cheating me :D