34/34 Từ Enter đến trang web Các chương

Điều gì xảy ra khi bạn mở một website?

Từ lúc nhấn Enter đến khi trang web xuất hiện, điều gì đã xảy ra?

Bạn gõ https://example.com, nhấn Enter, và một lát sau trang web xuất hiện.

Nhưng giữa hai thời điểm đó, máy tính phải tìm đúng máy chủ, đưa dữ liệu qua nhiều mạng khác nhau, thiết lập kết nối an toàn, gửi yêu cầu và nhận kết quả.

Những việc này không do một hệ thống duy nhất điều khiển. DNS, router, TCP, TLS, HTTP và máy chủ phối hợp với nhau, mỗi thành phần giải quyết một vấn đề riêng.

Thử nhấn Enter để xem toàn bộ hành trình.

Một lần mở website

https://example.com/

✓ Đã tải

Example Domain

Trang này dùng làm ví dụ trong tài liệu.

Xem thêm…

Internet Laptop 192.168.1.23 Router nhà 192.168.1.1 ISP CDN 93.184.216.34 Resolver DNS Máy chủ gốc Internet Laptop 192.168.1.23 Router nhà 192.168.1.1 ISP CDN 93.184.216.34 Resolver DNS Máy chủ gốc

Trang đã hiện ra

Một lần Enter: DNS tìm địa chỉ, router đưa gói tin ra Internet, TCP và TLS mở kết nối an toàn, HTTP lấy HTML, trình duyệt dựng trang.

URL → DNS → NAT → Internet → TCP → TLS → HTTP → HTML → trang

8/8

Từ tên miền tới máy chủ

Trước khi bạn nhấn Enter, laptop đã có sẵn ba thứ: địa chỉ IP của chính nó 192.168.1.23, cổng mặc định 192.168.1.1 và địa chỉ của DNS resolver. Thường là DHCP cấp cho nó lúc vào Wi-Fi. DHCP không chạy lại mỗi lần mở trang.

Nhấn Enter, trình duyệt tách URL thành giao thức HTTPS, tên máy example.com và tài nguyên /.

Nhưng Internet không chuyển gói tin theo tên. Nó cần địa chỉ IP.

DNS đổi tên đó thành địa chỉ, trong ví dụ là 93.184.216.34.

Địa chỉ này không thuộc mạng 192.168.1.0/24, nên laptop không gửi thẳng được. Nó giao gói tin cho router nhà, chính là cổng mặc định.

Router dùng NAT đổi địa chỉ riêng 192.168.1.23 thành địa chỉ công cộng 203.0.113.20, và ghi nhớ cách đổi ngược. Đây là cách thường gặp ở mạng gia đình dùng IPv4.

Từ đó gói tin vào mạng của ISP, rồi đi qua nhiều mạng độc lập khác. Mỗi router chỉ chọn chặng kế tiếp, cho tới khi gói tới máy chủ, hoặc tới một máy CDN đứng trước máy chủ.

Các địa chỉ trong bài và trong mô phỏng đều là địa chỉ minh hoạ, không phải địa chỉ thật của website.

Từ kết nối tới phản hồi HTTP

Tìm được máy chủ rồi, trình duyệt vẫn chưa gửi yêu cầu.

Trước hết hai bên bắt tay ba bước TCP: SYN, SYN-ACK, ACK. Trong ví dụ này trang chạy HTTP/2 trên TCP, nên TCP lo cho trình duyệt một luồng byte tin cậy. Với HTTP/3, việc đó do QUIC chạy trên UDP đảm nhận.

Sau đó TLS kiểm tra chứng chỉ của máy chủ, rồi hai bên cùng tạo khoá phiên. Từ đây router trên đường vẫn thấy gói tin đi qua, nhưng không đọc được nội dung bên trong.

Giờ trình duyệt mới gửi yêu cầu HTTP đầu tiên: GET /.

Nếu yêu cầu tới một CDN, CDN xem mình đã có bản sao chưa. Chưa có (cache miss) thì nó hỏi máy chủ gốc. Máy chủ gốc trả HTML, CDN chuyển về.

Phản hồi đi ngược qua Internet tới router nhà. Bảng NAT cho router biết phải chuyển nó cho thiết bị nào.

Trình duyệt đọc HTML ngay khi những byte đầu tiên tới. Nó thấy trang cần thêm CSS, JavaScript và ảnh, và tải chúng trên kết nối đang có. Chữ, bố cục, màu rồi ảnh lần lượt hiện ra.

Vì sao lần mở sau thường nhanh hơn?

Không phải lần mở website nào cũng chạy đủ các bước trên.

Lần sau, địa chỉ của example.com có thể còn trong cache DNS. Kết nối TCP và TLS có thể vẫn mở, nên không phải bắt tay lại. CDN có thể đã giữ bản sao, nên không phải hỏi máy chủ gốc. CSS, JavaScript và ảnh có thể đã nằm trong cache của trình duyệt.

Chọn Lần sau trong mô phỏng để so với lần đầu.

Cache không làm đường truyền nhanh hơn. Nó giúp bỏ qua những việc hệ thống đã làm xong.

Không ai điều khiển cả hành trình

Trong cả lần mở trang đó, không có máy nào nắm toàn bộ hành trình.

DNS tìm địa chỉ.

Router chọn chặng kế tiếp.

TCP hoặc QUIC vận chuyển dữ liệu.

TLS bảo vệ dữ liệu.

HTTP diễn đạt yêu cầu và phản hồi.

Máy chủ trả nội dung.

Trình duyệt dựng trang.

Mỗi phần có thể do một tổ chức khác làm ra và vận hành: nhà mạng của bạn, các nhà mạng quốc tế, công ty CDN, chủ website, hãng làm trình duyệt. Họ không cần biết nhau. Họ chỉ cần nói cùng những giao thức chung.

Vì vậy một lần nhấn Enter đi qua được thiết bị của nhiều tổ chức không chung một chủ, và trang vẫn hiện ra.

Nguồn tham khảo

  1. RFC 9293 — Transmission Control Protocol (TCP) · IETF
  2. RFC 5681 — TCP Congestion Control · IETF
  3. RFC 6298 — Computing TCP's Retransmission Timer · IETF
  4. RFC 2018 — TCP Selective Acknowledgment Options · IETF
  5. RFC 3168 — The Addition of Explicit Congestion Notification (ECN) to IP · IETF
  6. RFC 768 — User Datagram Protocol · IETF
  7. RFC 9000 — QUIC: A UDP-Based Multiplexed and Secure Transport · IETF
  8. RFC 9114 — HTTP/3 · IETF
  9. RFC 9110 — HTTP Semantics · IETF
  10. RFC 8446 — The Transport Layer Security (TLS) Protocol Version 1.3 · IETF
  11. RFC 9112 — HTTP/1.1 · IETF
  12. RFC 9113 — HTTP/2 · IETF
  13. RFC 7541 — HPACK: Header Compression for HTTP/2 · IETF
  14. RFC 9001 — Using TLS to Secure QUIC · IETF
  15. RFC 9002 — QUIC Loss Detection and Congestion Control · IETF
  16. RFC 5280 — Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile · IETF
  17. RFC 9525 — Service Identity in TLS · IETF
  18. RFC 9849 — TLS Encrypted Client Hello · IETF
  19. RFC 7568 — Deprecating Secure Sockets Layer Version 3.0 · IETF
  20. Let's Encrypt — Chains of Trust · Let's Encrypt
  21. RFC 1034 — Domain Names: Concepts and Facilities · IETF
  22. RFC 2131 — Dynamic Host Configuration Protocol · IETF
  23. RFC 1918 — Address Allocation for Private Internets · IETF
  24. RFC 1122 — Requirements for Internet Hosts: Communication Layers · IETF
  25. RFC 1812 — Requirements for IP Version 4 Routers · IETF
  26. RFC 791 — Internet Protocol · IETF
  27. RFC 826 — An Ethernet Address Resolution Protocol · IETF
  28. RFC 2003 — IP Encapsulation within IP · IETF
  29. Vì sao mạng chậm mà VPN lại nhanh · Znews
  30. RFC 4271 — A Border Gateway Protocol 4 (BGP-4) · IETF
  31. RFC 1930 — Guidelines for creation, selection, and registration of an Autonomous System · IETF
  32. RFC 6335 — IANA Procedures for Service Name and Transport Protocol Port Number Registry · IETF
  33. RFC 3022 — Traditional IP Network Address Translator (Traditional NAT) · IETF
  34. RFC 8200 — Internet Protocol, Version 6 (IPv6) Specification · IETF
  35. RFC 7094 — Architectural Considerations of IP Anycast · IETF
  36. RFC 20 — ASCII format for network interchange · IETF
  37. RFC 3629 — UTF-8, a transformation format of ISO 10646 · IETF
  38. RFC 8085 — UDP Usage Guidelines · IETF
  39. Root Server Technical Operations Association · Root Server System
  40. Revisiting Comparative Performance of DNS Resolvers in the IPv6 and ECS Era · Case Western Reserve University (arXiv)
  41. Performance Benefits · Google Public DNS
  42. Root Servers · IANA
  43. Gigabit Ethernet over Category 5 (IEEE 802.3ab tutorial) · IEEE 802.3 Working Group
  44. Guidelines for Use of Extended Unique Identifier (EUI), OUI · IEEE Registration Authority
  45. An Introduction to Computer Networks (Peter L. Dordal) · Loyola University Chicago
  46. Brief History of the Internet · Internet Society
  47. Paul Baran and the Origins of the Internet · RAND Corporation
  48. How browsers work · MDN Web Docs
  49. NIST SP 800-41 Rev. 1 — Guidelines on Firewalls and Firewall Policy · NIST
  50. Wireless RF Reference Guide (suy hao qua vật liệu) · Cisco
  51. FCC Opens 6 GHz Band to Wi-Fi and Other Unlicensed Uses (23/04/2020) · FCC
  52. OET Bulletin 70 — Millimeter Wave Propagation: Spectrum Management Implications (1997) · FCC
  53. Introduction to DWDM Technology · Cisco
  54. Digital communications — 2.2 Fibre types · The Open University (OpenLearn)
  55. Optical Fiber · The Fiber Optic Association
  56. Fiber Optic Wavelengths · The Fiber Optic Association
  57. PAM4 for 400G Optical Interfaces and Beyond (Part 1) · Cisco Blogs, 10/05/2018
  58. Submarine Cable FAQs · TeleGeography
  59. Submarine Cable Map (dữ liệu tuyến cáp Việt Nam) · TeleGeography
  60. Using submarine cables for climate monitoring and disaster warning: Engineering feasibility study · ITU-T, 07/2012
  61. About Submarine Telecommunications Cables · International Cable Protection Committee, 10/2011
  62. The FOA Reference For Fiber Optics - Telecommunication Networks · The Fiber Optic Association
  63. The Optical Submarine Repeater and Its Associated Technologies · NEC Technical Journal Vol.5 No.1, 2010
  64. Solar storms and submarine internet cables · Castellanos et al., Google LLC (arXiv:2211.07850), 11/2022
  65. Review of Submarine Cable Landing License Rules and Procedures (FCC 24-119), Technical Appendix · Federal Communications Commission, 22/11/2024
  66. Technology introduction — Optical Submarine Cable Repair Method · KDDI Cableships & Subsea Engineering
  67. Types of orbits · European Space Agency
  68. FCC 21-48 — SpaceX Starlink modification order (độ cao quỹ đạo) · Federal Communications Commission
  69. RFC 3135 — Performance Enhancing Proxies Intended to Mitigate Link-Related Degradations (§5.1.1) · IETF
  70. SpaceX STA Application 0983-EX-ST-2021 — Narrative Description (Starlink terminals) · Federal Communications Commission
  71. Internet connection speed recommendations · Netflix Help Center
  72. Gói Home Internet — cáp quang WiFi · VNPT
  73. FCC DA 26-113 — SpaceX Orbital Data Center System, accepted for filing (liên kết laser giữa vệ tinh) · Federal Communications Commission
  74. Phishing and Malware (certificate không bảo chứng website) · Let's Encrypt
  75. CDN reference architecture · Cloudflare Docs
  76. traceroute(8) — Linux manual page · man7.org
  77. Vietnam National Internet eXchange (VNIX) · Trung tâm Internet Việt Nam (VNNIC)
  78. IPv6 Adoption statistics · Google
  79. Wi-Fi CERTIFIED 6 · Wi-Fi Alliance
  80. CIDR Report — AS Summary · APNIC (Geoff Huston)
  81. An Internet Pioneer Ponders the Next Revolution (phỏng vấn Robert Taylor) · The New York Times
  82. Internet History of 1960s · Computer History Museum
  83. Internet History of 1970s · Computer History Museum
  84. The Day the Infant Internet Uttered its First Words · Leonard Kleinrock, UCLA
  85. Internet Việt Nam: 25 năm phát triển và những bước tiến vượt bậc · VietnamPlus (TTXVN)
  86. 25 năm phát triển Internet Việt Nam · VnExpress
  87. Người "mang" Internet vào Việt Nam · Công an Nhân dân
  88. Revolution: Connecting Over Phone Lines · Computer History Museum
  89. Teletype Model 33ASR (catalog X1557.98) · Computer History Museum
  90. On Distributed Communications: I. Introduction to Distributed Communications Networks (RM-3420, 1964) · RAND Corporation
  91. Packet Switching: The first steps on the road to the information society · National Physical Laboratory
  92. Computer Pioneers: Donald W. Davies · IEEE Computer Society
  93. May 22: Xerox Researcher Proposes "Ethernet" · Computer History Museum
  94. IEEE Milestone: Ethernet Local Area Network (LAN), 1973-1985 · IEEE History Center (ETHW)
  95. IEEE Milestone: Demonstration of the ALOHA Packet Radio Data Network, 1971 · IEEE History Center (ETHW)
  96. An Introduction to Computer Networks — 2 Ethernet (Peter L. Dordal) · Loyola University Chicago
  97. Cisco to Acquire Kalpana, Leading Ethernet Switching Company · Cisco
  98. A Protocol for Packet Network Intercommunication (Cerf & Kahn, IEEE Trans. Comm., 5/1974) · IEEE (bản in lại tại Princeton University)
  99. Internetworking (1977) · SRI International
  100. RFC 951 — Bootstrap Protocol (BOOTP) · IETF
  101. RFC 1531 — Dynamic Host Configuration Protocol · IETF
  102. RFC 5227 — IPv4 Address Conflict Detection · IETF
  103. Internet History of 1980s · Computer History Museum
  104. Interface Message Processor (IMP) Honeywell 516 — X105.82 · Computer History Museum
  105. Internet architect Leonard Kleinrock receives UCLA Medal · UCLA Newsroom
  106. The Design Philosophy of the DARPA Internet Protocols (David D. Clark, SIGCOMM '88) · ACM SIGCOMM
  107. Birth of the Commercial Internet · U.S. National Science Foundation
  108. Retiring the NSFNET Backbone Service: Chronicling the End of an Era · Merit Network
  109. Hành trình từ Internet đến kinh tế Internet và kinh tế số · Bộ Khoa học và Công nghệ
  110. Nạn độc quyền Internet ở Việt Nam (2001) · VnExpress
  111. Lịch sử và những mốc son phát triển Internet Việt Nam · Hiệp hội Internet Việt Nam (VIA)
  112. RFC 1058 — Routing Information Protocol · IETF
  113. RFC 1105 — A Border Gateway Protocol (BGP) · IETF
  114. The Two-Napkin Protocol · Computer History Museum
  115. More details about the October 4 outage · Engineering at Meta
  116. Understanding how Facebook disappeared from the Internet · Cloudflare
  117. RFC 608 — Host Names On-Line · IETF
  118. RFC 952 — DoD Internet Host Table Specification · IETF
  119. RFC 882 — Domain Names: Concepts and Facilities · IETF
  120. RFC 883 — Domain Names: Implementation and Specification · IETF
  121. ISI Timeline · USC Information Sciences Institute
  122. End-to-End Arguments in System Design (Saltzer, Reed, Clark, 1984) · ACM / MIT
  123. IEN 2 — Comments on Internet Protocol and TCP (Jon Postel, 1977) · RFC Editor
  124. TCP Split into TCP/IP · IEEE Communications Society
  125. Oral History of Danny Cohen · Computer History Museum
  126. Oral History of Vinton (Vint) Cerf · Computer History Museum
  127. Experimenting with QUIC · Chromium Blog (Google)
  128. RFC 349 — Proposed Standard Socket Numbers · IETF
  129. RFC 1700 — Assigned Numbers · IETF
  130. RFC 2468 — I Remember IANA · IETF
  131. Information Management: A Proposal (Tim Berners-Lee, CERN, 1989) · W3C
  132. The birth of the Web · CERN
  133. A short history of the Web · CERN
  134. 30 years of a free and open Web · CERN
  135. The Original HTTP as defined in 1991 · W3C
  136. RFC 6176 — Prohibiting Secure Sockets Layer (SSL) Version 2.0 · IETF
  137. RFC 6101 — The Secure Sockets Layer (SSL) Protocol Version 3.0 · IETF
  138. Firesheep (Eric Butler, 24/10/2010) · codebutler.com
  139. Leaving Beta, New Sponsors (12/4/2016) · Let's Encrypt
  140. A secure web is here to stay (8/2/2018) · Chromium Blog
  141. IEEE Milestone: ALOHAnet, 1971 · IEEE / ETHW
  142. FCC 02-328 — Additional Spectrum for Unlicensed Devices (Notice of Inquiry, 2002) · FCC
  143. Early Civil Spread Spectrum History (Michael Marcus) · Marcus Spectrum Solutions
  144. Wireless LAN 802.11 Wi-Fi · IEEE History Center / ETHW
  145. History · Wi-Fi Alliance
  146. The Nobel Prize in Physics 2009 — Press release · NobelPrize.org
  147. How Charles Kao Beat Bell Labs to the Fiber-Optic Revolution (Jeff Hecht) · IEEE Spectrum
  148. IEEE Milestone: World's First Low-Loss Optical Fiber for Telecommunications, 1970 · IEEE / ETHW
  149. IEEE Milestone: Landing of the Transatlantic Cable, 1866 · IEEE / ETHW
  150. 5 tuyến cáp quang biển đứt gần nửa năm chưa sửa xong (16/4/2023) · VnExpress
  151. Kết nối Internet quốc tế hết nghẽn từ đêm 10/2 (10/2/2023) · VnExpress
  152. Tuyến cáp biển thứ 5 gặp sự cố, người dùng Internet bị ảnh hưởng như thế nào? (21/2/2023) · Thanh Niên
  153. Google server assembly (catalog 102662167) · Computer History Museum
  154. Google "Corkboard" Server, 1999 · Smithsonian National Museum of American History
  155. Web Search for a Planet: The Google Cluster Architecture (IEEE Micro, 2003) · Google Research
  156. About Equinix · Equinix
  157. W3C Recommendations Reduce "World Wide Wait" (1999) · W3C
  158. Managing Flash Crowds on the Internet (MASCOTS 2003) · UC Santa Cruz
  159. Company History · Akamai
  160. RFC 790: Assigned Numbers · IETF / RFC Editor (J. Postel), 1981
  161. RFC 1166: Internet Numbers · IETF / RFC Editor, 1990
  162. IANA IPv4 Address Space Registry · IANA
  163. RFC 1380: IESG Deliberations on Routing and Addressing · IETF / RFC Editor, 1992
  164. RFC 1519: Classless Inter-Domain Routing (CIDR) · IETF / RFC Editor, 1993
  165. RFC 4632 — Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan · IETF / RFC Editor, 2006
  166. RFC 1631: The IP Network Address Translator (NAT) · IETF / RFC Editor, 1994
  167. RFC 1752: The Recommendation for the IP Next Generation Protocol · IETF / RFC Editor, 1995
  168. RFC 2460: Internet Protocol, Version 6 (IPv6) Specification · IETF / RFC Editor, 1998
  169. RFC 4213: Basic Transition Mechanisms for IPv6 Hosts and Routers · IETF / RFC Editor, 2005
  170. RFC 2993: Architectural Implications of NAT · IETF / RFC Editor, 2000
  171. RFC 6888: Common Requirements for Carrier-Grade NATs (CGNs) · IETF / RFC Editor, 2013
  172. Morris Worm · FBI (bản lưu Wayback Machine)
  173. RFC 1135: The Helminthiasis of the Internet · IETF / RFC Editor, 1989
  174. Simple and Flexible Datagram Access Controls for Unix-based Gateways (WRL Research Report 89/4) · Digital Equipment Corporation, Western Research Laboratory, 1989 (bản lưu Wayback của HP Labs)
  175. Congestion Avoidance and Control · Van Jacobson & Michael J. Karels, Lawrence Berkeley Laboratory, 1988
  176. Bufferbloat: Dark Buffers in the Internet · ACM Queue, 2011 (bản lưu Wayback)
  177. The Story of the PING Program · Mike Muuss, U.S. Army Research Laboratory
  178. traceroute (mã nguồn và trang man, LBL) · Lawrence Berkeley National Laboratory, Network Research Group
  179. Load Balancing at the Frontend (Site Reliability Engineering, chương 19) · Google
  180. Policy Brief: Internet Exchange Points (IXPs) · Internet Society
  181. Autonomous System (AS) Numbers · IANA
  182. RFC 792: Internet Control Message Protocol · IETF / RFC Editor (J. Postel), 1981
  183. Free Pool of IPv4 Address Space Depleted · Number Resource Organization (NRO), 03/02/2011
  184. APNIC IPv4 Address Pool Reaches Final /8 · APNIC, 15/04/2011