本地主机与真实 IP 地址 [英] localhost vs real ip address
问题描述
localhost和真实ip地址有什么区别?
What is the difference between the localhost and the real ip address?
如果我使用 http://localhost:8080/index.html
和 http://192.123.456.001:8080/index.html
(比如192.123.456.001就是主机的真实ip),有什么区别?
If I access an application by using http://localhost:8080/index.html
and http://192.123.456.001:8080/index.html
(for example, 192.123.456.001 is the real ip address of the host computer), what is the difference?
推荐答案
当你访问 localhost
时,你的 /etc/hosts
文件会告诉你的电脑不要看任何进一步并将您重定向到您自己的计算机.当您访问本地IP地址时,您的计算机会要求路由器获取数据,然后您的路由器将指向您的计算机.
When you access localhost
, your /etc/hosts
file will tell your computer not to look any further and redirects you to your own computer. When you access the local IP adress, your computer will ask the router to fetch the data, and your router will then point back to your computer.
这篇关于本地主机与真实 IP 地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!