DNS

Domain name: Because THE IP address is not convenient to remember, and can not express the name and nature of the organization, people designed a domain name (such as Baidu.com), but in fact, in order to be able to access the specific host, finally need to know the IP address of the target host.

Domain names can be classified into the following types based on different levels: Top-level Domain (TLD); Secondary domain name; Level 3 domain names…

Domain Name System (DNS) is a service of the Internet. As a distributed database that maps domain names and IP addresses to each other, it enables people to access the Internet more easily. The DNS uses TCP and UDP, and the server occupies port 53. Currently, the domain name length of each level is limited to 63 characters and the total domain name length cannot exceed 253 characters.

Domain name resolution

For example, baidu.com as a domain name corresponds to the IP address 220.181.38.148. DNS is like an automatic telephone directory, we can directly dial the name baidu.com of 220.181.38.148 instead of the telephone number (IP address). DNS turns a human-friendly name like zh.wikipedia.org into a machine-friendly IP address like 220.181.38.148 after we call the site name directly.

DNS queries can be made in two ways: recursive and iterative. The DNS server used by the DNS client setup is usually a recursive server, which is responsible for handling the CLIENT’s DNS query request until the final result is returned. Generally, iterative query is used between DNS servers.

Take querying Baidu.com as an example:

  • The client sends the query packet baidu.com to the DNS server. The DNS server checks its cache first and returns the result if there are records.

  • If the record does not exist, then:

    The client first accesses the nearest DNS server (that is, the DNS server configured by the client)

    1. The DNS server sends query packets to the root DNS serverbaidu.com, the root DNS server returns the top-level domain.comThe top-level DOMAIN name server address.
    2. DNS server direction.comThe TOP-LEVEL DNS server of the DOMAIN sends query packetsbaidu.com(The upper-level DNS server records the IP address of the next-level DNS server). Store it in its own cache and return it to the client.

DHCP

Dynamic Host Configuration Protocol (ABBREVIATION: Dynamic Host Configuration Protocol) Dynamic Host Configuration Protocol (DHCP), also known as dynamic Host configuration Protocol, is a network protocol used for IP networks. It is located at the OSI application layer and works using UDP. The client uses port 68 and the server uses port 67.

  • An Intranet or network service provider automatically assigns IP addresses to users
  • Used by Intranet administrators to centrally manage all computers

The principle of

Dynamic Host Configuration Protocol (DHCP) is a communication protocol that enables network administrators to centrally manage and automatically assign IP network addresses. On an IP network, each device that connects to the Internet needs to be assigned a unique IP address. The DHCP server rents an IP address from the IP address pool to the client for a period of time. When the IP address pool expires, the DHCP server will reclaim the IP address. The router that connects to the Internet at home can act as the DHCP server.

DHCP Running Process

The DHCP operation is divided into four basic processes: requesting an IP lease, providing an IP lease, selecting an IP lease, and confirming an IP lease. After obtaining an IP address, the client can send an ARP request to avoid IP conflicts caused by the overlap of DHCP server address pools.

DHCP Discovery Server (DISCOVER)

The client sends a broadcast on the physical subnet to find an available server. The network administrator can configure a local route to forward DHCP packets to a DHCP server on another subnetwork. The client generates a UDP packet with destination IP address 255.255.255.255 or a subnet broadcast address.

The customer can also request the last IP address it uses (192.168.1.100 in the example below). If the IP address is still available on the client’s network, the server can grant the application. Otherwise, it depends on whether the server is authorized or unauthorized. The authorization server will reject the request, causing the client to apply for a new IP immediately. The unauthorized server simply ignores the request, causing a client request to time out and the client to abandon the request and apply for a new IP address.

DHCP Offers lease

When the DHCP server receives an IP lease request from a customer, it provides an IP lease. DHCP reserves an IP address for the customer and then unicasts a DHCP OFFER message to the customer over the network. The message contains the MAC address of the customer, the IP address provided by the server, the subnet mask, the lease, and the IP address of the DHCP server providing the IP.

The server checks the configuration based on the customer hardware address specified in the CHADDR field. The server here, 192.168.1.1, specifies the IP address in the YIADDR field.

DHCP REQUEST (REQUEST)

When a client receives an IP lease offer, it must tell all other DHCP servers that it has accepted a lease offer. Therefore, the client sends a DHCP REQUEST message containing the IP address of the server providing the lease. When the other DHCP servers receive the message, they withdraw all leases that may have been provided to the client. They then put the address that was reserved for that customer back into the available address pool, so that they can assign that address to other computers. Any number of DHCP servers can respond to the same IP lease request, but each client network card can only accept one lease.

BDHCP Acknowledge (ACK)

When the DHCP server receives the REQUEST message from the customer, it begins the final phase of the configuration process. This response phase involves sending a DHCP ACK packet to the customer. This package contains the lease and all other configuration information that the customer might request. At this point, the TCP/IP configuration process is complete.