
找到特定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