找到特定ip地址 修改ip
Whether you are in it just for a bit of geeky fun, or are seriously wanting to know the answer, how do you find out the IP address for a website? Today’s SuperUser Q&A post looks at the answer, and how to know if more than one website is bound to the same IP address.
无论您是只是出于一个怪异的乐趣,还是正想知道答案,如何找到网站的IP地址? 今天的SuperUser Q&A帖子着眼于答案,以及如何知道是否有多个网站绑定到相同的IP地址。
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.
今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。
问题 (The Question)
SuperUser reader JqueryLearner wants to know how to find out what the IP address of a website is:
超级用户阅读器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.
如果我想知道网站的IP地址,那么一种方法是ping网站。 例如,如果我想知道google.com的IP地址,则可以通过命令提示符ping它。
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.
因此74.125.236.195是Google的IP地址。 但是假设我想知道superuser.com的IP地址,并且如果使用相同的方法,那么我将获得198.252.206.16作为IP地址。 如果我将此IP地址作为URL放置在浏览器中,则浏览器不会将我带到superuser.com。
Can anyone tell me how to get the correct IP address?
谁能告诉我如何获取正确的IP地址?
So what does JqueryLearner need to do in order to find out the correct IP addresses for websites?
那么,JqueryLearner需要做什么才能为网站找到正确的IP地址?
答案 (The Answer)
SuperUser contributors Paul and lesca have the answer for us. First up, Paul:
超级用户贡献者Paul和lesca为我们提供了答案。 首先,保罗:
Your starting assumption is that all websites can be accessed via their IP address directly. This is not the case.
最初的假设是,可以直接通过其IP地址访问所有网站。 不是这种情况。
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:
在很多情况下(大多数情况下我都会冒险),以IP地址显示的网站取决于您所请求的网站名称。 例如,如果您请求superuser.com,则将首先将其解析为IP地址,然后再请求特定网页的IP地址。 看起来像这样:
The first part says “get the first page of the site”, and the second says “for the website superuser.com”.
第一部分说“获取网站的首页”,第二部分说“针对网站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.
这就是为什么单个Web服务器可以使用单个IP地址托管多个网站的原因。 对于Stack Exchange网站,它们中的任何一个或全部都可以位于它们的每台服务器上,您将得到自己想要的一个。 如果仅输入IP地址,则不会获得任何IP地址,因为您没有告诉Web服务器要访问的网站是哪个。 在这些情况下,它可能定义了“默认”网站,或者仅返回错误。
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.
如果您想解决DNS提供商的问题,那么您必须采取的一种方法是修改主机文件,以便您自己解析地址,而不是由外部方为您解决。
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.
这样,如果您在浏览器中键入superuser.com,它将在hosts文件中查找并解析IP地址,但是仍然将网站名称传递给它所连接的服务器。
Followed by the answer from lesca:
随后是lesca的回答:
To get the IP address of a website, the best way is to use the nslookup command. For example:
要获取网站的IP地址,最好的方法是使用nslookup命令。 例如:
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.
如果您想知道为什么无法使用IP地址(198.252.206.16)直接访问SuperUser,那是因为Web服务器的设置。 SuperUser网站不允许用户通过IP地址访问。 可能是因为IP地址绑定到其他网站(例如stackoverflow.com)。 如果使用“ IP反向查找”工具,则可以找到其绑定站点。
One more lookup proves I am right:
再次查找证明我是对的:
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.
有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程。
翻译自: https://www.howtogeek.com/182468/how-do-you-find-out-the-ip-address-for-a-website/
找到特定ip地址 修改ip