我的 Mac(Mojave 10.14)无法访问任何具有.dev域名的网站,例如get.dev。我尝试运行$ ping get.dev
并得到以下输出:
PING get.dev (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.044 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.161 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.070 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.166 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.189 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.056 ms
^C
--- get.dev ping statistics ---
6 packets transmitted, 6 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.044/0.114/0.189/0.059 ms
我知道重新映射.dev
到 localhost 很流行,我想我可能在过去的某个时候做过,然后忘记了。但是,当我运行时$ cat /etc/hosts
:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
我不确定在哪里继续解决这个问题。是否有任何其他hosts
文件可能会添加额外的条目?
编辑:根据他们的说明,我的 DNS 设置为使用 1.1.1.1 。
编辑:下面有更多故障排除。
$ dig get.dev
:
; <<>> DiG 9.10.6 <<>> get.dev
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58743
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;get.dev. IN A
;; ANSWER SECTION:
get.dev. 300 IN A 216.239.32.29
;; Query time: 44 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Wed May 15 14:35:46 CEST 2019
;; MSG SIZE rcvd: 52
curl -v get.dev
:
* Rebuilt URL to: get.dev/
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connection failed
* connect to 127.0.0.1 port 80 failed: Connection refused
* Failed to connect to get.dev port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to get.dev port 80: Connection refused
为什么要在返回 216.239.32.29curl
时尝试 127.0.0.1 ?dig