* .domain.local在我的/ etc / hosts中

我可以在我的本地域中的etc/hosts文件中设置对所有子域的访问吗?

喜欢

 127.0.0.1 localhost *.domain.local 

现在看起来像

 127.0.0.1 localhost domain.local mail.domain.local web.domain.local other.domain.local ... 

不,通配符是DNS查找的东西; 试图在你的/etc/hosts中做同样的事情是行不通的。 抱歉。

不,你不能在你的主机文件中这样做。 你应该可以很容易地设置dnsmasq来做到这一点。 添加

 address=/domain.local/127.0.0.1 

到dnsmasq.conf文件应该做你想要的。