不管你是为了好玩,还是真的想知道答案,你是如何找到一个网站的IP地址的?今天的超级用户问答帖子将讨论答案,以及如何知道是否有多个网站绑定到同一IP地址。
今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。
超级用户读者JqueryLearner想知道如何找出网站的IP地址:
If I want to know the IP address of a website, then one way is to ping the website. For example, if I want to know the IP address of google.com, then I can ping it via the command prompt.
So 74.125.236.195 is the IP address for Google. But suppose I want to know the IP address of superuser.com, and if I use the same method, then I get 198.252.206.16 as the IP address. If I put this IP address in the browser as an URL, then my browser does not take me to superuser.com.
Can anyone tell me how to get the correct IP address?
那么JqueryLearner需要做什么才能找到网站的正确IP地址呢?
超级用户贡献者Paul和lesca为我们提供了答案。首先,保罗:
Your starting assumption is that all websites can be accessed via their IP address directly. This is not the case.
In many cases (I’d venture most cases), the website that is presented at an IP address is dependent on the website name you are requesting. For example, if you request superuser.com, you will first resolve this to an IP address, then make a request to the IP address for a specific webpage. It looks like this:
The first part says “get the first page of the site”, and the second says “for the website superuser.com”.
This is why a single web server can host multiple websites using a single IP address. In the case of the Stack Exchange sites, any or all of them can be on each of their servers, and you’ll get the one you ask for. If you just put in an IP address, you won’t get any of them, because you are not telling the web server which of the many websites you are after. In these cases, it may have a “default” website defined, or just return an error.
If you are trying to work around an issue with your DNS provider, then one option you have is to modify your hosts file so that you are resolving addresses yourself, rather than have an external party do it for you.
So for example, if you edit:
You can enter:
This way, if you type superuser.com into your browser, it will look in the hosts file, and resolve the IP address, but then still pass through the name of the website to the server it connects to.
接着是莱斯卡的回答:
To get the IP address of a website, the best way is to use the nslookup command. For example:
If you wonder why you cannot visit SuperUser directly using the IP address (198.252.206.16), it is because of the settings for the web server. The SuperUser site disallows user visits via IP address. Probably it is because the IP address is binding to other web sites (say stackoverflow.com). If you use “IP reverse lookup” tool, you can find its binding sites.
One more lookup proves I am right:
有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。
...P地址的全名是“Internet协议地址”。它的全名说明了它是如何工作的;它是计算机发送和接收数据的地址。 ...
需要找到你的移动IP地址吗?你可能知道如何在你的Mac或Windows电脑上找到你的IP地址,但在你的**上呢? ...
...生成的积木世界吗?别再看了,这里有你需要知道的关于如何加入Minecraft服务器的所有信息。 ...
...它们允许ISP更容易地进行维护和资源调配。 相关:IP地址如何工作? 网站保留日志 大多数网站都会保留关于访问者的详细日志,这是有充分理由的。如果你知道如何阅读这些,你可以了解你的网站是如何被外部第三方使用。 现...
...许多人来说,要么被监视,要么没有互联网。 那么我该如何隐藏我的ip地址呢? 隐藏IP地址的两种主要方法是使用代理服务器或虚拟专用网(VPN)。(还有Tor,它非常适合于极端匿名化,但是它非常慢,对于大多数人来说是不必...