【发布时间】:2021-09-18 02:22:04
【问题描述】:
我的 Mac 在 localhost:3000 上运行了一个网络服务器,我正在尝试使用 dnsmasq 设置本地 DNS,并能够从本地设备(iPhone / iPad)访问该 DNS 以进行测试。
我关注了之前的帖子: iPhone: add entry to /etc/hosts without jailbreaking
我希望在这里重定向所有 *.localhost
dnsmasq.conf:
/etc/resolver/localhost:
dig google.com:
Mac 网络 DNS 配置:
在我的手机上,在同一网络上,将 Mac 本地 IP 添加为 DNS:
Wi-Fi is connected to xxxxxx and has the IP address 192.168.1.11.
我能够在 Mac 上成功连接到 myapp.localhost:3000,但在 iPhone 上却得到 Server cannot be found。
一定是少了点什么。
编辑 #0:2021/07/08
netstat -anvp tcp | grep '\b192.168.1.11.53\b' 输出:
【问题讨论】:
-
您的路由器应该已经有一个 DNS 服务器(至少,任何在过去十年内出售的服务器都是如此)。无论如何,您都不需要 DNS 服务器来通过 LAN 访问
http://192.168.1.11:3000
标签: macos dns localhost dnsmasq