my-medium.cnf
by Andrea Zanin
由Andrea Zanin
您的手機如何打開medium.com-我將讓門衛和圖書管理員解釋。 (How your phone opens medium.com — I’ll let a doorman and a librarian explain.)
Hey did you notice what just happened? You clicked a link, and now here you are reading this article. But did you think about how your browser knew that the link you clicked referred to this article, and that this article contained these words?
嘿,您注意到發生了什么嗎? 您單擊了一個鏈接,現在您正在這里閱讀本文。 但是您是否考慮過瀏覽器如何知道您單擊的鏈接引用了本文,并且本文包含了這些詞?
It’s something so common that we forget about it, but the mechanism behind it is fascinating. In this article we will explore it using real world analogies.
這是很常見的事情,我們忘記了,但是它背后的機制令人著迷。 在本文中,我們將使用現實世界的類比進行探索。
電腦如何對話 (How computers talk)
When you open a website, your browser is asking some other computer somewhere in the world for the data that will allow it to show you the page (for example, the text you are reading now).
當您打開網站時,瀏覽器正在向世界其他地方的其他計算機詢問數據,以使其能夠顯示頁面(例如,您正在閱讀的文本)。
This act of asking another computer is not unlike sending a piece of mail (physical mail, not an email) to a friend and waiting for his reply.
詢問另一臺計算機的行為與向朋友發送一封郵件(物理郵件,而不是電子郵件)并等待其答復無異。
If John wants to send Brittany some mail, he needs to know her address. In the internet world, instead of having physical addresses we have IP addresses. They work the same way, just with a computer instead of a mailbox.
如果約翰想發送一些郵件給布列塔尼,他需要知道她的地址。 在互聯網世界中,我們沒有IP地址,而是擁有物理地址。 它們的工作方式相同,只是使用計算機而不是郵箱。
告訴我有關此IP的更多信息 (Tell me more about this IP thing)
Before we dive in the details about IP addresses, I want you to imagine that you are staying in a luxurious hotel with hundreds of rooms and a fancy doorman (not bad right?).
在我們深入介紹IP地址的細節之前,我想讓您想象一下,您住在一家豪華酒店,里面有數百個房間和一個看門的門衛(還不錯吧?)。
Now back to IP addresses: your standard IP address looks like this: 102.134.122.234. The first 9 digits are the address of the virtual hotel you are staying in, while the last 3 are your room. While the address of the virtual hotel is fixed, the room you are staying in is chosen by the hotel.
現在回到IP地址:您的標準IP地址如下所示:102.134.122.234。 前9位數字是您所住虛擬酒店的地址,后3位數字是您的房間。 虛擬酒店的地址固定后,酒店將選擇您要入住的房間。
If anyone wants to send you a message, they need to know the address of the hotel and your room number. So they send the message to the hotel and the doorman delivers it directly to you.
如果有人想向您發送消息,他們需要知道酒店的地址和您的房間號。 因此,他們將消息發送給酒店,然后門衛將消息直接傳遞給您。
The virtual hotel is like your home WiFi network. Its address is decided by your internet provider, while your room number is decided by your home router.
虛擬酒店就像您的家庭WiFi網絡。 它的地址由您的互聯網提供商決定,而房間號由家庭路由器決定。
數字很??復雜 (Numbers are complicated)
You may have noticed that if you want to open medium.com you don’t need to know its IP address. This is where the internet becomes smarter than the postal service.
您可能已經注意到,如果要打開medium.com,則無需知道其IP地址。 這是互聯網變得比郵政服務更智能的地方。
On top of IP addresses, there is a system to match easy to remember names to IPs: the Domain Name System.
在IP地址的頂部,有一個將易于記憶的名稱與IP進行匹配的系統:域名系統。
Finally, here is what happens when your phone wants to open medium.com
最后,這是您的手機要打開medium.com時發生的情況
- The phone sends the request to the doorman (router) and asks it to send it to medium.com 電話將請求發送到門衛(路由器),并要求將其發送到medium.com
- the router asks a trusted agency (your internet provider) for the IP of medium.com 路由器向可信代理商(您的互聯網提供商)詢問medium.com的IP
- this trusted agency then refers to a worldwide organization (the Root Server) that recognizes the Top Level Domain (.com, .us, .org, …) 然后,該受信任的代理機構指的是認可頂級域(.com,.us,.org等)的全球組織(根服務器)。
- the Root Server then asks the digital librarian responsible for that TLD 然后,根服務器詢問負責該TLD的數字圖書館員
- finally the librarian opens his master record, looks for the website we requested, and responds with the IP 最后,圖書館管理員打開他的主記錄,查找我們請求的網站,并以IP進行回復
Finally your phone can send the request directly to Medium’s address (IP). All of this in less than a tenth of a second.
最終,您的手機可以將請求直接發送到Medium的地址(IP)。 所有這些都在不到十分之一秒的時間內。
我們會用完地址嗎? (Will we run out of addresses?)
Yes we will run out of IP addresses — and soon. But don’t panic, a solution is already being implemented.
是的,我們很快就會用完IP地址。 但是請不要驚慌,已經在實施一種解決方案。
First we have to take a step back: up until now I talked about IP addresses, but I should have said IP version 4. The solution is IP version 6, and it looks even uglier: 2001:0db8:0000:0042:0000:8a2e:0370:7334
首先,我們必須退后一步:到目前為止,我談到的是IP地址,但我應該說的是IP版本4。解決方案是IP版本6,它看起來更難看:2001:0db8:0000:0042:0000: 8a2e:0370:7334
This alphanumeric monstrosity leads to an astronomical amount of possible IPs, so issue solved ??.
這種字母數字的怪異性導致可能的IP數量達到天文數字,因此問題得以解決。
離開之前 (Before you leave)
In this article we analyzed how your phone understands what medium.com is, but what about the HTTPS part of the link? I wrote another article about it: https explained with carrier pigeons.
在本文中,我們分析了您的手機如何理解media.com,但是該鏈接的HTTPS部分又如何呢? 我寫了另一篇文章: https用信鴿解釋 。
If you liked the article don’t forget that you can ? up to 50 times.
如果您喜歡這篇文章,別忘了可以嗎? 最多50次
翻譯自: https://www.freecodecamp.org/news/how-can-your-phone-open-medium-com-62ec36b1429f/
my-medium.cnf