查詢計算機的公共ip地址有哪些步驟?

能夠訪問一個服務來了解您的公共IP地址是非常有幫助的,但是這個過程是如何工作的呢?今天的超級使用者問答帖子回答了一位好奇的讀者的問題。...

查詢計算機的公共ip地址有哪些步驟?

能夠訪問一個服務來了解您的公共IP地址是非常有幫助的,但是這個過程是如何工作的呢?今天的超級使用者問答帖子回答了一位好奇的讀者的問題。

今天的問答環節是由SuperUser提供的,SuperUser是Stack Exchange的一個分支,是一個由社群驅動的問答網站分組。

截圖由道格拉斯波特(Flickr)提供。

問題

超級使用者讀者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).

This is what I already know about creating such a service:

  1. I would set up a web application on the Internet that listens to/for port 80.
  2. When a request comes in, I would examine its source IP address and then package that in a nicely formatted HTML resp***e for the user to see.

Is that it, or is there something else involved here as well?

查詢計算機的公共IP地址有哪些步驟?

答案

超級使用者貢獻者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.

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.


有什麼要補充的解釋嗎?在評論中發出聲音。想從其他精通技術的Stack Exchange使用者那裡瞭解更多答案嗎?在這裡檢視完整的討論主題。

  • 發表於 2021-04-10 21:00
  • 閱讀 ( 45 )
  • 分類:網際網路

你可能感興趣的文章

完整的windows網路故障排除指南

... 您的計算機獲得網路連線並開始查詢DHCP伺服器裝置。 DHCP伺服器將檢查它是否有一個空閒的IP地址,並將其租給客戶端。 使用者將鍵入如下網址谷歌網站在瀏覽器視窗中。 ...

  • 發佈於 2021-03-11 18:35
  • 閲讀 ( 43 )

用堡壘主機保護您的網路只需3個步驟

... 堡壘的字面意思是一個設防的地方。在計算機術語中,它是網路上的一臺機器,可以作為傳入和傳出連線的閘道器守護者。 ...

  • 發佈於 2021-03-12 01:44
  • 閲讀 ( 56 )

網路101:乙太網、區域網及其工作原理

... 在區域網上查詢計算機的IP地址。看看以前的MUO文章,在Windows上使用ipconfig或者在Linux和Mac上使用ifconfig來實現這一點。 現在,去網站什麼是我的IP。這個網站的前提很...

  • 發佈於 2021-03-14 04:20
  • 閲讀 ( 51 )

如何用舊計算機構建linux網路伺服器

... 查詢舊的/不需要的計算機 安裝Linux作業系統 設定應用程式web伺服器軟體(Apache、PHP、MySQL) 從internet訪問伺服器 ...

  • 發佈於 2021-03-17 19:20
  • 閲讀 ( 55 )

如何將imessage與airmessage和mac一起在android上使用

... 首先,您需要記下計算機的IP地址。開啟“首選項”,然後轉到“網路”。在視窗頂部附近,您將看到一條訊息,顯示您所連線的網路。您的IP地址也列在這裡。 ...

  • 發佈於 2021-03-21 16:37
  • 閲讀 ( 44 )

如何找到android或iphone的ip地址

...全域性IP地址和私有IP地址。下面介紹如何在家庭網路上查詢**的專用IP地址。 ...

  • 發佈於 2021-03-22 11:33
  • 閲讀 ( 54 )

如何修復“dns\u probe\u finished\u nxdomain”錯誤

...。當您嘗試訪問某個站點時,瀏覽器首先會檢視此檔案以查詢指定域的IP。 ...

  • 發佈於 2021-03-30 01:04
  • 閲讀 ( 54 )

如何在mac上查詢和更改ip地址

... 查詢未使用的ip地址 ...

  • 發佈於 2021-03-30 19:17
  • 閲讀 ( 53 )

什麼是埠轉發?你需要知道的一切

... 計算機或裝置的IP地址。如何在Windows10中查詢計算機的IP地址。 ...

  • 發佈於 2021-03-31 08:18
  • 閲讀 ( 58 )

如何在ubuntu上設定遠端桌面

需要一臺遠端的Ubuntu-Linux計算機嗎?設定Ubuntu的螢幕共享並在需要時進行遠端控制。您可以連線到任何VNC客戶端的螢幕共享。我們會教你怎麼做。 ubuntu內建的“螢幕共享”是一個vnc伺服器 當您與遠端ubuntulinux計算機建立SSH連線...

  • 發佈於 2021-04-03 07:59
  • 閲讀 ( 60 )
dnmza4481
dnmza4481

0 篇文章

作家榜

  1. admin 0 文章
  2. 孫小欽 0 文章
  3. JVhby0 0 文章
  4. fvpvzrr 0 文章
  5. 0sus8kksc 0 文章
  6. zsfn1903 0 文章
  7. w91395898 0 文章
  8. SuperQueen123 0 文章

相關推薦