Chapter 6 Application Layer

1. Application layer overview

1690373672446

The application layer is the top layer of the computer network architecture, the ultimate goal of designing and building a computer network, and the fastest growing part of a computer network.

  • Early text-based applications (email, telnet, file transfer, newsgroups)

  • In the 1990s, the World Wide Web www

  • Today's popular instant messaging, P2P file sharing and various audio and video applications

  • The miniaturization and "ubiquity" of computing equipment, the increasing popularity and rapid development of broadband residential access and wireless access provide a broad stage for more new applications in the future.

2. Client-server approach and peer-to-peer approach

  • Network applications run on different end systems at the edge of the network and communicate with each other to accomplish a certain task together.

  • The first thing to consider when developing a new network application is the organization of network applications on various end systems and the relationship between them.

  • There are two main types that are currently popular:

    • Client/Server (Client/Server, C/S) mode
    • Peer-to-Peer (P2P) mode

2.1 Client/Server (Client/Server, C/S) mode

  • Client and server refer to the two application processes involved in the communication.

  • The client/server approach describes the relationship between the service and the serviced process.

  • The client is the service requester and the server is the service provider.

  • The server is always running and waiting for service requests from clients. The server has a fixed port number (for example, the default port number of an HTTP server is 80), and the host running the server also has a fixed IP address.

1690374388180

  • The C/S method is the traditional and most mature method on the Internet. Many network applications we are familiar with use the C/S method. Including World Wide Web www, email, file transfer FTP, etc.

  • C/S-based application services are usually service-centralized, that is, application services are concentrated on server computers that are much less than client computers in the network.

    • Since one server computer provides services for multiple clients, in C/S applications, it often happens that the server computer cannot keep up with the requests of many clients.
    • For this reason, in C/S application, computer cluster (or server farm) is commonly used to build a powerful virtual server.

2.2 Peer-to-Peer (P2P) method

  • In the P2P mode, there is no fixed service requester and service provider, and the application processes distributed in each end system at the edge of the network are peers, which are called peers. The peers communicate directly with each other, and each peer is both a requester and a provider of services.

  • Currently, popular P2P applications on the Internet mainly include P2P file sharing, instant messaging, P2P streaming media, distributed storage, and so on.

  • P2P-based applications are service-distributed, because the service is not concentrated in a few server computers, but distributed in a large number of peer-to-peer computers, which are not owned by the service provider, but desktop computers controlled by individuals and laptops, which are commonly found in homes, campuses, and offices.

  • One of the most prominent features of the P2P approach is its scalability. Because every time a peer is added to the system, it not only increases the service requester, but also increases the service provider, and the system performance will not decrease due to the increase in scale.

  • The P2P method has a cost advantage because it usually does not require huge server facilities and server bandwidth. In order to reduce costs, service providers are increasingly interested in using the P2P approach for applications.

1690374677262

3. Dynamic Host Configuration Protocol DHCP

1690375523319

4. Domain Name System DNS

  • The Internet adopts the domain name structure of hierarchical tree structure

  • The domain name structure is composed of several components, each component is separated by a "dot", representing domain names of different levels.

1690375881263

  • Domain names at each level are composed of English letters and numbers, no more than 63 characters, and do not distinguish between uppercase and lowercase letters.
  • The lowest-ranking domain name is written on the far left, and the highest-ranking top-level domain name is written on the far right.
  • The full domain name cannot exceed 255 characters.

1690376150312

The mapping relationship between domain names and IP addresses must be stored in the domain name server for all other applications to query. Obviously, all information cannot be stored in one domain name server. DNS uses domain name servers distributed in various places to realize the conversion of domain names to IP addresses.

Domain name servers can be divided into the following four different types:

Root name server
Root name server is the highest level name server. Each root domain name server knows the domain names and IP addresses of all top-level domain name servers. There are 13 root domain name servers with different IP addresses on the Internet. Although we think of each of the 13 root domain name servers as a single server, "each server" is actually a server cluster composed of many computers distributed around the world. When the local domain name server sends a query request to the root domain name server, the router forwards the query request message to a root domain name server closest to the DNS client. This speeds up the DNS query process, and at the same time makes more reasonable use of Internet resources. The root domain name server usually does not directly resolve the domain name, but returns the IP address of the top-level domain name server of the top-level domain name to which the domain name belongs.

Top-Level Name Servers
These name servers are responsible for managing all second-level domain names registered with that top-level name server. When a DNS query request is received, a corresponding answer (maybe the final result, or the IP address of the domain name server of the next level of authority) is given.

Authoritative Name Servers
These name servers are responsible for managing domain names for a zone. The domain name of each host must be registered with an authoritative domain name server. Therefore, the authoritative domain name server knows the mapping relationship between the domain name under its jurisdiction and the IP address. In addition, the authoritative domain name server also knows the address of its subordinate domain name server.

Local Name Servers
Local name servers do not belong to the hierarchy of name servers described above. When a host sends a DNS request message, the message is first sent to the host's local domain name server. The local domain name server acts as a proxy and forwards the message to the hierarchical structure of the above domain name server. Every ISP, a university, or even a college within a university can have a local domain name server, which is sometimes called a default domain name server. The local domain name server is relatively close to the user, generally not more than a few routers away, and may also be in the same local area network. The IP address of the local domain name server needs to be directly configured in the host that needs domain name resolution.

1690376572775

Because the recursive query is too burdensome for the domain name server being queried, the following mode is usually adopted: the query from the requesting host to the local domain name server is a recursive query, while the remaining queries are iterative queries.

In order to improve DNS query efficiency, reduce the load on the root domain name server and reduce the number of DNS query messages on the Internet, cache memory is widely used in domain name servers. The cache is used to store the records of recently queried domain names and where to obtain domain name mapping information.

Since the mapping relationship between domain names and IP addresses is not permanent, in order to keep the content in the cache correct, the domain name server should set a timer for each content and delete items that exceed a reasonable time (for example, each item is only stored for two days) )

Caching is needed not only in local domain name servers, but also in user hosts. Many user hosts download the entire database of domain names and IP addresses from the local domain name server at startup, maintain a cache of their most recently used domain names, and only query the domain name server when the domain name cannot be found in the cache. Similarly, the host also needs to maintain the correctness of the content in the cache.

[2010 Question 40] If the local domain name server has no cache, when the recursive method is used to resolve the domain name of a host on another network, the number of domain name request messages sent by the user host and the local domain name server are A. one, one B.
one
, many
C. many, one
D. many, many

[2016 Question 40] Assuming that all domain name servers adopt iterative query method for domain name resolution, when H4 accesses the website whose canonical domain name is www.abc.xyz.com, the domain name server 201.1.1.1 may complete the process of domain name resolution. The minimum and maximum times to issue DNS queries are C
A.0, 3
B.1, 3
C.0, 4
D.1, 4

1690376948693

【Analysis】

If there is DNS information of the domain name in the DNS cache of the host H4, there is no need to query any domain name server. In this way, H4 does not need to issue a DNS query to the default domain name server (local domain name server) in the figure, and the domain name server does not need to issue a DNS query.

The topic is given to use iterative query for domain name resolution. In the worst case, the local domain name server in the figure needs to send a total of 4 DNS queries to the following domain name servers in sequence:

root name server

Top level domain name server (.com)

Authoritative Domain Name Server (xyz.com)

Authoritative Domain Name Server (abc.xyz.com)

5. File Transfer Protocol FTP

  • Transferring files from one computer to another computer that may be far away through the network is a basic network application, that is, file transfer.

  • File transfer protocol FTP (File Transfer Protocol) is the most widely used file transfer protocol on the Internet.

    • FTP provides interactive access, allowing customers to specify the type and format of the file (such as specifying whether to use ASCII codes), and allowing the file to have access permissions (such as users who access the file must be authorized and enter a valid password).
    • FTP shields the details of each computer system, so it is suitable for transferring files between any computers in a heterogeneous network.
  • In the early stage of Internet development, the use of FTP to transfer files accounted for about one-third of the entire Internet traffic, and the traffic generated by email and domain name systems was even smaller than that generated by FTP. It was only in 1995 that the traffic of the World Wide Web WWW surpassed that of FTP for the first time.

A common use of FTP is to transfer files between computers, especially for transferring files in bulk.

Another common use of FTP is to let website designers bulk upload to their web servers the large number of files that make up the content of a website.

1690377871233

1690377922788

[2009 Question 40] When transferring FTP commands between the FTP client and the server, the connection used is A

A. Control connection established over TCP
B. Data connection established over TCP
C. Control connection established over UDP
D. Data connection established over UDP

【Analysis】

The following two parallel TCP connections should be established between the FTP client and server:

One is the control connection, which remains open throughout the session and is used to transmit FTP-related control commands.

The other is a data connection, used for file transfer, which is established every time a file is transferred and closed when the transfer ends.

[2017 Question 40] Among the following statements about the FTP protocol, the wrong one is C

A. The data connection is closed after each data transfer

B. The control connection remains open for the duration of the session

C. The server establishes a data connection with the TCP20 port of the client

D. The client establishes a control connection with the TCP port 21 of the server

[Analysis]
Two parallel TCP connections, "control connection" and "data connection", need to be established between the FTP client and server.

The control connection remains open during the entire session, while the data connection is established for each file transfer and closed when the transfer is complete.

By default, FTP uses TCP21 port for control connection and TCP20 port for data connection.

However, whether to use TCP port 20 to establish a data connection is related to the transmission mode. The active mode uses TCP port 20, and the passive mode is determined through negotiation between the server and the client.

6. Email

  • The e-mail system adopts the client/server approach.

  • There are three main building blocks of an email system: the user agent, the mail server, and the protocols required for email.

    • A user agent is the interface between the user and the email system, also known as email client software.
    • A mail server is the infrastructure of an email system. All ISPs on the Internet have mail servers, whose function is to send and receive mail , and is also responsible for maintaining user mailboxes.
    • Protocols include mail sending protocols (such as SMTP) and mail reading protocols (such as POP3, IMAP).

1690378478649

[2012 Question 40] If the process of sending and receiving emails between user 1 and user 2 is shown in the figure below, the application layer protocols used in stages ①, ②, and ③ in the figure can be D A.SMTP, SMTP
, SMTP
B. POP3, SMTP, POP3
C. POP3, SMTP, SMTP
D. SMTP, SMTP, POP3

1690378952547

【2013 Question 40】Among the following statements about the SMTP protocol, the correct one is A
I. Only supports the transmission of 7-bit ASCII code content

II. Support sending mail between mail servers

III. Support sending mail from user agent to mail server

IV. Support sending mail from mail server to user agent

A. Only I, II and III
B. Only I and IV
C. Only I, III and IV
D. Only II, III and IV

[2018 Question 40] The content that can be directly transmitted by the SMTP protocol without conversion is D
A. JPEG graphics
B. MPEG video C.
EXE files
D. ASCIl text

7. World Wide Web WWW

  • The World Wide Web www (World Wide Web) is not some kind of special computer network. It is a large-scale, online information repository and a distributed application running on the Internet.

  • The World Wide Web uses hyperlinks between web pages to link web pages of different websites into a logical information network.

  • For easy access to documents worldwide, the World Wide Web uses Uniform Resource Locators (URLs) to designate the location of any kind of "resource" on the Internet.

  • The general form of a URL consists of the following four parts:1690379452066

  • Hypertext Transfer Protocol HTTP (HyperText Transfer Protocol). HTTP defines how a browser (that is, a World Wide Web client process) requests a World Wide Web document from a World Wide Web server, and how the World Wide Web server transmits a World Wide Web document to a browser.

  • HTTP/1.0 uses a non-persistent connection method. In this mode, every time the browser requests a file, it must establish a TCP connection with the server, and close the connection immediately after receiving the response.

    • Every time a document is requested, there is an overhead of twice the RTT. If there are many reference objects (such as pictures, etc.) on a web page, it takes 2RTT to request each object.
    • In order to reduce the delay, the browser usually establishes multiple parallel TCP connections to request multiple objects at the same time. However, this will consume a lot of resources of the World Wide Web server, especially the World Wide Web server will often serve the requests of a large number of clients at the same time, which will make it a heavy burden.

1690379786236

  • HTTP/1.1 uses a persistent connection method. In this mode, the World Wide Web server still maintains this connection after sending the response, so that the same client (browser) and the server can continue to transmit subsequent HTTP request messages and response messages on this connection. This is not limited to passing objects referenced on the same page, as long as the documents are all on the same server.

  • HTTP message format. HTTP is text-oriented, and each field in its message is some ASCII code string, and the length of each field is uncertain.

1690380026723

Reference: 6.2 Client-Server Mode and Peer-to-Peer Mode_哔哩哔哩_bilibili

Guess you like

Origin blog.csdn.net/m0_57385165/article/details/131951364