English Vietnamese
Naming and addressing Cách đặt tên và địa chỉ
The network and the transport layers rely on addresses that are encoded as fixed size bit strings. A network layer address uniquely identifies a host. Several transport layer entities can use the service of the same network layer. For example, a reliable transport protocol and a connectionless transport protocol can coexist on the same host. In this case, the network layer multiplexes the segments produced by these two protocols. This multiplexing is usually achieved by placing in the network packet header a field that indicates which transport protocol should process the segment. Given that there are few different transport protocols, this field does not need to be long. The port numbers play a similar role in the transport layer since they enable it to multiplex data from several application processes. Các tầng giao vận và tầng mạng phụ thuộc vào các địa chỉ đã được mã hoá dưới dạng chuỗi các bit có kích thước cố định. Một địa chỉ của tầng mạng là định danh duy nhất xác định một hệ chủ. Nhiều chủ thể của tầng giao vận có thể sử dụng dịch vụ của cùng một tầng mạng. Ví dụ, một giao thức giao vận an toàn và một giao thức giao vận phi kết nối có thể cùng tồn tại trên một hệ chủ. Trong trường hợp này, tầng mạng sẽ đa truyền (multiplexe) những phần được tạo ra bởi các giao thức này. Sự đa truyền này thường đạt được bằng cách đưa một trường thông tin vào phần đầu của gói tin mạng cho biết rằng giao thức giao vận nào có thể xử lý mẩu tin này. Do chỉ có một số ít các giao thức giao vận, trường thông tin này không cần thiết phải dài. Các số cổng (port number) cũng đóng một vai trò tương tự trong lớp giao vận do chúng cho phép việc đa truyền dữ liệu từ nhiều quá trình ứng dụng.
While addresses are natural for the network and transport layer entities, humans prefer to use names when interacting with network services. Names can be encoded as a character string and a mapping services allows applications to map a name into the corresponding address. Using names is friendlier for humans, but it also provides a level of indirection which is very useful in many situations. Trong khi việc sử dụng các địa chỉ cho các thực thể tầng mạng và tầng giao vận được coi là một điều tự nhiên, con người lại thích sử dụng các tên gọi khi giao tiếp với các dịch vụ mạng. Các tên gọi có thể được mã hoá bằng các kí tự chuỗi và một dịch vụ ánh xạ cho phép các ứng dụng liên kết một tên gọi đến địa chỉ tương ứng của nó. Sử dụng các tên gọi được cho là thân thiện hơn với con người, đồng thời nó cũng cung cấp một sự mất định hướng mà sự mất định hướng này lại rất hữu dụng trong nhiều tình huống.
Because names are at a higher level than addresses, they allow (both in the example of programming above, and on the Internet) to treat addresses as mere technical identifiers, which can change at will. Only the names are stable. Bởi vì các tên gọi nằm ở tầng cao hơn so với các địa chỉ, chúng cho phép (cả trong ví dụ của ngôn ngữ lập trình ở trên cũng như với mạng Internet) việc coi các địa chỉ đơn giản chỉ là các định danh kĩ thuật, mà các định danh này có thể được thay đổi theo ý muốn. Chỉ có các tên gọi là được giữ ổn định.
The first solution that allowed applications to use names was the :term:`hosts.txt` file. This file is similar to the symbol table found in compiled code. It contains the mapping between the name of each Internet host and its associated address [#fhosts]_. It was maintained by SRI International that coordinated the Network Information Center (NIC). When a new host was connected to the network, the system administrator had to register its name and address at the NIC. The NIC updated the :term:`hosts.txt` file on its server. All Internet hosts regularly retrieved the updated :term:`hosts.txt` file from the SRI_ server. This file was stored at a well-known location on each Internet host (see :rfc:`952`) and networked applications could use it to find the address corresponding to a name. Giải pháp đầu tiên cho phép các ứng dụng sử dụng các tên gọi là tệp tin :term:`hosts.txt`. Tệp tin này giống như bảng ký tự tìm thấy ở trong các mã đã biên dịch. Nó bao gồm các ánh xạ giữa tên của mỗi một trạm Internet với địa chỉ tương ứng của nó [#fhosts]_. Nó được duy trì bởi SRI International, một đơn vị điều phối Network Information Center (NIC). Khi một trạm mới được kết nối vào mạng, người quản trị hệ thống cần đăng ký tên đó và địa chỉ tương ứng với NIC. Khi đó, NIC cập nhật tệp tin :term:`hosts.txt` trên máy chủ của họ. Tất cả các trạm Internet đều thường xuyên nhận được các tệp tin :term:`hosts.txt` cập nhật từ SRI_server. Tệp tin này được lưu tại một vị trí phổ biến trên mỗi một trạm Internet (tham khảo :rfc:`952`) và các ứng dụng kết nối mạng có thể sử dụng nó để tìm địa chỉ tương ứng với tên.
A :term:`hosts.txt` file can be used when there are up to a few hundred hosts on the network. However, it is clearly not suitable for a network containing thousands or millions of hosts. A key issue in a large network is to define a suitable naming scheme. The ARPANet initially used a flat naming space, i.e. each host was assigned a unique name. To limit collisions between names, these names usually contained the name of the institution and a suffix to identify the host inside the institution (a kind of poor man's hierarchical naming scheme). On the ARPANet few institutions had several hosts connected to the network. Một tệp tin :term:`hosts.txt` có thể được sử dụng khi có khoảng vài trăm trạm trong mạng. Tuy nhiên, nó hoàn toàn không phù hợp với một mạng với hàng nghìn hoặc hàng triệu trạm. Một vấn đề chính trong một một mạng lớn đó chính là việc định nghĩa một lược đồ tên gọi phù hợp. ARPANet đầu tiên đã sử dụng một không gian tên phẳng, ví dụ như là mỗi trạm được đặt một tên duy nhất. Để tránh việc trùng lặp giữa các tên, chúng thường bao gồm tên của tổ chức và một hậu tố để xác định trạm đó bên trong tổ chức (một kiểu đặt tên theo thứ bậc nghèo nàn). Trên mạng ARPANet chỉ có một vài tổ chức với nhiều trạm kết nối với mạng.
However, the limitations of a flat naming scheme became clear before the end of the ARPANet and :rfc:`819` proposed a hierarchical naming scheme. While :rfc:`819` discussed the possibility of organizing the names as a directed graph, the Internet opted for a tree structure capable of containing all names. In this tree, the top-level domains are those that are directly attached to the root. The first top-level domain was `.arpa` [#fdnstimeline]_. This top-level name was initially added as a suffix to the names of the hosts attached to the ARPANet and listed in the `hosts.txt` file. In 1984, the `.gov`, `.edu`, `.com`, `.mil` and `.org` generic top-level domain names were added. :rfc:`1032` proposed the utilization of the two letter :term:`ISO-3166` country codes as top-level domain names. Since :term:`ISO-3166` defines a two letter code for each country recognized by the United Nations, this allowed all countries to automatically have a top-level domain. These domains include `.be` for Belgium, `.fr` for France, `.us` for the USA, `.ie` for Ireland or `.tv` for Tuvalu, a group of small islands in the Pacific or `.tm` for Turkmenistan. The set of top-level domain-names is managed by the Internet Corporation for Assigned Names and Numbers (:term:`ICANN`). :term:`ICANN` adds generic top-level domains that are not related to a country and the `.cat` top-level domain has been registered for the Catalan language. There are ongoing discussions within :term:`ICANN` to increase the number of top-level domains. Tuy nhiên, những giới hạn của việc đặt tên phẳng trở nên rõ ràng trước khi ARPANet kết thúc và :rfc:`819` đề xuất một hình thức đặt tên có thứ bậc. Khi :rfc:`819` thảo luận về khả năng của việc tổ chức các tên gọi như là một đồ thị có hướng, thì mạng Internet đã chọn một cấu trúc cây có khả năng chứa tất cả các tên gọi. Trong cây này, những tên miền ở cấp cao nhất (top-level domains) là những tên miền trực tiếp gắn với nút gốc của cây. Tên miền cấp cao nhất đầu tiên là `.arpa` [#fdnstimeline]_. Tên miền cấp cao nhất này đầu tiên được thêm vào như là một hậu tố cho các tên gọi của các trạm gắn với ARPANet và được liệt kê trong tệp tin `hosts.txt`. Vào năm 1984, các tên miền cấp cao phổ biến như `.gov`, `.edu`, `.com`, `.mil` và `.org` đã được thêm vào. :rfc:`1032` đề xuất việc sử dụng các tên miền cao cấp là các mã đất nước bao gồm hai ký tự :term:`ISO-3166`. Khi :term:`ISO-3166` định nghĩa mã gồm hai ký tự cho mỗi một nước được ghi nhận bởi Liên hợp quốc, các quốc gia mặc nhiên có tên miền cấp cao của mỗi nước. Các tên miền này bao gồm `.be` cho Bỉ, `.fr` cho Pháp, `.us` cho Mỹ, `.ie` cho Ireland hoặc `.tv` cho Tuvalu (một đảo quốc ở Thái Bình Dương) hoặc `.tm` cho Turkmenistan. Việc định ra các tên miền cao cấp được quản lý bởi tổ chức Internet Corporation for Assigned Names and Numbers (:term:`ICANN`). :term:`ICANN` còn thêm vào các tên miền cao cấp không liên quan đến quốc gia và vì vậy tên miền cao cấp `.cat` đã được đăng ký cho ngôn ngữ Catalan. Hiện tại đang có các cuộc thảo luận tại :term:`ICANN` để tăng số lượng các tên miền cao cấp.
Each top-level domain is managed by an organization that decides how sub-domain names can be registered. Most top-level domain names use a first-come first served system, and allow anyone to register domain names, but there are some exceptions. For example, `.gov` is reserved for the US government, `.int` is reserved for international organizations and names in the `.ca` are mainly `reserved <http://en.wikipedia.org/wiki/.ca>`_ for companies or users that are present in Canada. Mỗi một tên miền cao cấp được quản lý bởi một tổ chức quyết định việc làm thế nào các tên miền thứ cấp được đăng ký. Phần lớn các tên miền cao cấp sử dụng hệ thống "first-come first served" (ai đến trước thì phục vụ trước), và cho phép bất kỳ ai cũng có thể đăng ký các tên miền với một số ngoại lệ. Ví dụ, `.gov` được bảo lưu cho chính phủ Mỹ, `.int` được bảo lưu cho các tổ chức quốc tế và các tên `.ca` (`reserved <http://en.wikipedia.org/wiki/.ca>`_) chủ yếu được bảo lưu cho các công ty hoặc người dùng ở Canada.
The syntax of the domain names has been defined more precisely in :rfc:`1035`. This document recommends the following :term:`BNF` for fully qualified domain names (the domain names themselves have a much richer syntax). Cú pháp của các tên miền được định nghĩa cụ thể hơn tại :rfc:`1035`. Tài liệu này gợi ý định dạng :term:`BNF` (Backus-Naur form) cho các tên miền đủ điều kiện (bản thân các tên miền có các cú pháp phong phú hơn nhiều).
BNF of the fully qualified host names BNF của một tên trạm đầy đủ
This grammar specifies that a host name is an ordered list of labels separated by the dot (`.`) character. Each label can contain letters, numbers and the hyphen character (`-`) [#fidn]_. Fully qualified domain names are read from left to right. The first label is a hostname or a domain name followed by the hierarchy of domains and ending with the root implicitly at the right. The top-level domain name must be one of the registered TLDs [#ftld]_. For example, in the above figure, `www.computer-networking.info` corresponds to a host named `www` inside the `computer-networking` domain that belongs to the `info` top-level domain. Ngữ pháp này chỉ định rõ rằng tên của một trạm là một danh sách sắp xếp của các nhãn được phân biệt bởi dấu chấm (`.`). Mỗi một nhãn có thể chứa các ký tự, số và gạch ngang (`-`) [#fidn]_. Một tên miền đầy đủ được đọc từ trái sang phải. Nhãn đầu tiên là tên máy chủ hoặc tên miền theo sau bởi thứ bậc của các tên miền và kết thúc với một gốc ở bên phải. Các tên miền cao cấp phải là tên miền đã được đăng ký TLDs [#ftld]_. Ví dụ, trong hình ở trên, `www.computer-networking.info` tương ứng với một trạm tên `www` nằm trong tên miền `computer-networking` mà tên miền này thuộc về tên miền cao cấp `info`.
Some visually similar characters have different character codes Một số ký tự tương tự có những mã ký tự khác nhau
The Domain Name System was created at a time when the Internet was mainly used in North America. The initial design assumed that all domain names would be composed of letters and digits :rfc:`1035`. As Internet usage grew in other parts of the world, it became important to support non-ASCII characters. For this, extensions have been proposed to the Domain Name System :rfc:`3490`. In a nutshell, the solution that is used to support Internationalized Domain Names works as follows. First, it is possible to use most of the Unicode characters to encode domain names and hostnames, with a few exceptions (for example, the dot character cannot be part of a name since it is used as a separator). Once a domain name has been encoded as a series of Unicode characters, it is then converted into a string that contains the ``xn--`` prefix and a sequence of ASCII characters. More details on these algorithms can be found in :rfc:`3490` and :rfc:`3492`. Hệ thống tên miền được tạo ra vào thời điểm khi mà mạng Internet được sử dụng phần lớn ở Bắc Mỹ. Thiết kế ban đầu giả định rằng tất cả các tên miền sẽ được cấu thành từ các ký tự và chữ số :rfc:`1035`. Khi việc sử dụng Internet phát triển hơn ở các phần khác của thế giới, việc hỗ trợ các ký tự non-ASCII trở nên quan trọng. Để làm được điều đó, các phần mở rộng đã được đề xuất lên hệ thống quản lý tên miền :rfc:`3490`. Nói ngắn gọn, giải pháp được sử dụng để hỗ trợ các tên miền quốc tế được diễn đạt như sau. Đầu tiên, nó hoàn toàn khả dĩ khi sử dụng các ký tự Unicode để mã hoá các tên miền và tên trạm, với một số ngoại lệ (ví dụ, ký tự dấu chấm không thể là một phần của tên gọi vì nó được sử dụng như là một dải phân cách). Một khi một tên miền đã được mã hoá dưới dạng một chuỗi các ký tự Unicode, nó sẽ được chuyển thành một chuỗi bao gồm các tiền tố ``xn--`` và một chuỗi các ký tự ASCII. Chi tiết hơn về các thuật toán này có thể được tìm thấy tại :rfc:`3490` và :rfc:`3492`.
This hierarchical naming scheme is a key component of the Domain Name System (DNS). The DNS is a distributed database that contains mappings between fully qualified domain names and addresses. The DNS uses the client-server model. The clients are hosts or applications that need to retrieve the mapping for a given name. Each :term:`nameserver` stores part of the distributed database and answers the queries sent by clients. There is at least one :term:`nameserver` that is responsible for each domain. In the figure below, domains are represented by circles and there are three hosts inside domain `dom` (`h1`, `h2` and `h3`) and three hosts inside domain `a.sdom1.dom`. As shown in the figure below, a sub-domain may contain both host names and sub-domains.
A :term:`nameserver` that is responsible for domain `dom` can directly answer the following queries :
the address of any host residing directly inside domain `dom` (e.g. `h2.dom` in the figure above)
the nameserver(s) that are responsible for any direct sub-domain of domain `dom` (i.e. `sdom1.dom` and `sdom2.dom` in the figure above, but not `z.sdom1.dom`)
To retrieve the mapping for host `h2.dom`, a client sends its query to the name server that is responsible for domain `.dom`. The name server directly answers the query. To retrieve a mapping for `h3.a.sdom1.dom` a DNS client first sends a query to the name server that is responsible for the `.dom` domain. This nameserver returns the nameserver that is responsible for the `sdom1.dom` domain. This nameserver can now be contacted to obtain the nameserver that is responsible for the `a.sdom1.dom` domain. This nameserver can be contacted to retrieve the mapping for the `h3.a.sdom1.dom` name. Thanks to this structure, it is possible for a DNS client to obtain the mapping of any host inside the `.dom` domain or any of its subdomains. To ensure that any DNS client will be able to resolve any fully qualified domain name, there are special nameservers that are responsible for the root of the domain name hierarchy. These nameservers are called :term:`root nameserver`.
Each root nameserver maintains the list [#froot]_ of all the nameservers that are responsible for each of the top-level domain names and their addresses [#frootv6]_. All root nameservers cooperate and provide the same answers. By querying any of the root nameservers, a DNS client can obtain the nameserver that is responsible for any top-level-domain name. From this nameserver, it is possible to resolve any domain name.
To be able to contact the root nameservers, each DNS client must know their addresses. This implies, that DNS clients must maintain an up-to-date list of the addresses of the root nameservers. Without this list, it is impossible to contact the root nameservers. Forcing all Internet hosts to maintain the most recent version of this list would be difficult from an operational point of view. To solve this problem, the designers of the DNS introduced a special type of DNS server : the DNS resolvers. A :term:`resolver` is a server that provides the name resolution service for a set of clients. A network usually contains a few resolvers. Each host in these networks is configured to send all its DNS queries via one of its local resolvers. These queries are called `recursive queries` as the :term:`resolver` must recursively send requests through the hierarchy of nameservers to obtain the `answer`.