查找所有计算机ip_查找计算机的公共IP地址的步骤是什么?
查找所有计算机ip
Being able to access a service to learn your public IP address can be very helpful, but how does the process work? Today’s SuperUser Q&A post has the answer to a curious reader’s question.
能够访问服务以学习您的公共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网站分组。
Screenshot courtesy of Douglas Porter (Flickr).
屏幕截图由Douglas Porter(Flickr)提供 。
问题 (The Question)
SuperUser reader Harry wants to know what the steps for finding the public IP address of a computer are:
超级用户读者Harry想知道查找计算机的公共IP地址的步骤是:
I am aware of services like What Is My IP Address that allows a user to find their public IP address, but what I would like to know is how does such a service get written from scratch? I do not need the code itself, I just want to know the concepts and the steps involved (pseudo code if you will).
我知道诸如“我的IP地址是什么”之类的服务,该服务允许用户查找其公共IP地址,但我想知道的是如何从头开始编写此类服务? 我不需要代码本身,我只想知道所涉及的概念和步骤(如果需要,可以使用伪代码)。
This is what I already know about creating such a service:
这是我对创建这样的服务所了解的:
- I would set up a web application on the Internet that listens to/for port 80. 我会在Internet上设置一个侦听/侦听端口80的Web应用程序。
- When a request comes in, I would examine its source IP address and then package that in a nicely formatted HTML response for the user to see. 收到请求时,我将检查其源IP地址,然后将其打包成格式正确HTML响应,以供用户查看。
Is that it, or is there something else involved here as well?
是这样吗,还是这里还涉及其他内容?
What are the steps to finding the public IP address of a computer?
查找计算机的公共IP地址的步骤是什么?
答案 (The Answer)
SuperUser contributor Scott Chamberlain has the answer for us:
超级用户贡献者Scott Chamberlain为我们提供了答案:
For the most part, what you have listed is all that you need to do for basic functionality.
在大多数情况下,您列出的是基本功能所需要做的一切。
There is, however, one more thing you could do. You could check the X-Forwarded-For header added by some proxies (the kind used for caching) and/or load balancers and report that address instead because the address you get from the source address will be the proxy’s address, not the user’s.
但是,您还可以做另一件事。 您可以检查某些代理(用于缓存的类型)和/或负载平衡器添加的X-Forwarded-For标头,然后报告该地址,因为从源地址获得的地址将是代理的地址,而不是用户的地址。
However, that header is user provided, so there is no way to prove that the address listed in X-Forwarded-For is the real source address of the user.
但是,该标头是用户提供的,因此无法证明X-Forwarded-For中列出的地址是用户的真实源地址。
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/215208/what-are-the-steps-to-finding-the-public-ip-address-of-a-computer/
查找所有计算机ip