Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
/etc/hosts(或其他操作系统上的等效项)用于将主机名解析为某个 IP,而无需询问 dns 服务器。
/etc/hosts
您可以在您的/etc/hosts中使用:
127.0.0.1 myserver.com
然后打开http://myserver. com:3333 在浏览器中,它将连接到 127.0.0.1 到 3333 端口。
http://myserver. com:3333
127.0.0.1
3333
您不能使用 /etc/hosts 映射 IP 地址。
您可以为此使用 iptables。但这是另一个问题了。
/etc/hosts (or it's equivalents on other OS's) is used to resolve hostnames to some ip without asking to dns servers.
You can use in your /etc/hosts:
And then open http://myserver.com:3333 in your browser and it will connect to 127.0.0.1 to 3333 port.
http://myserver.com:3333
You can NOT map ip addresses with /etc/hosts.
You can use iptables for this. But that's another question.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
/etc/hosts
(或其他操作系统上的等效项)用于将主机名解析为某个 IP,而无需询问 dns 服务器。您可以在您的
/etc/hosts
中使用:然后打开
http://myserver. com:3333
在浏览器中,它将连接到127.0.0.1
到3333
端口。您不能使用
/etc/hosts
映射 IP 地址。您可以为此使用 iptables。但这是另一个问题了。
/etc/hosts
(or it's equivalents on other OS's) is used to resolve hostnames to some ip without asking to dns servers.You can use in your
/etc/hosts
:And then open
http://myserver.com:3333
in your browser and it will connect to127.0.0.1
to3333
port.You can NOT map ip addresses with
/etc/hosts
.You can use iptables for this. But that's another question.