如何将流量定向到/ etc/hosts中的子域?

Léo*_* 준영 1 unix subdomain dns

我试着把这行放到/ etc/hosts:

IP math.com mathworld.com

IP应该是http://mathworld.wolfram.com/classroom/的IP .我ping了网站,我意识到我必须使用其他一些工具来引导流量:

ping mathworld.wolfram.com/

ping:无法解析mathworld.wolfram.com/:未知主机

所以问题出现了:

如何将流量定向到子域,类似于上述子域?

Art*_*ius 6

您似乎对网络术语感到困惑.

http://mathworld.wolfram.com/classroom/是一个URL,而不是域名.它没有IP地址.mathworld.wolfram.com 域名并具有IP地址.

此外,mathworld.wolfram.com其子wolfram.com域是com顶级域的子域.

mathworld.wolfram.com 不是 mathworld.com 的子域名

/etc/hosts功能不够强大到域的所有子域映射到同一个地方.您需要全部输入,进入正确的DNS服务器配置(例如named.conf).