Primary knowledge of the Internet in daily life scenarios

Scene one
to transfer data between two computers
Insert picture description here

Usually when we use the computer again, sending files to is a very simple operation, but do you know the logic behind this?

First, I will introduce the related models and protocols. The OSI Open System Interconnection Reference Model
is divided into seven layers, namely:

Application layer : It is more convenient to apply the data received from the network. Protocol to be concerned: http protocol.
Presentation layer : Solve communication syntax problems between different systems.
Session layer : The session area of ​​the application device, which provides the session layer address and sets rules for the application.
Transmission layer : It solves the data transmission between hosts, and the transmission between data can be in different networks. At the same time, the transmission layer solves the problem of transmission quality. The protocol to be concerned about: TCP/UDP
network layer : Translate the network address into the corresponding physical address, and decide how to route the data from the sender to the receiver. The network layer and the Palace Museum comprehensively consider sending priority, network congestion, and service quality, and can automatically select the best path from node A to node B. Existing hardware equipment: router. Protocol to be concerned: IP.
Data link layer : When the bit stream is transmitted, peak shifts and incomplete transmission will occur. The data link layer can provide error detection and correction to ensure the reliability of data transmission. Existing hardware devices: switches.
Physical layer : Convert the bit stream into current strength for transmission, and convert it to 0101 bytecode after reaching the destination. Existing hardware equipment: network card
TCP/IP protocol
Transmission Control Protocol/Internet Protocol (TCP/IP) refers to a protocol that can transmit time information between multiple different networks. The TCP/IP protocol not only refers to the two protocols of TCP and IP, but refers to a protocol composed of FTP, SMTP, TCP, UDP, IP and other protocols. It is just because the TCP protocol and the IP protocol are the most It is representative, so it is called TCP/IP protocol.
File Transfer Protocol (FTP) is a set of standard protocols used for file transfer on the network. It works on the seventh layer of the OSI model, the fourth layer of the TCP model, and the application layer. It uses TCP transmission instead of UDP. Before establishing a connection with the server, a "three-way handshake" process is required to ensure that the connection between the client and the server is reliable and time-oriented, providing reliable guarantees for data transmission.
Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte stream-based transport layer communication protocol.
User Datagram Protocol (UDP) is an Internet protocol suite that supports a connectionless transmission protocol. This protocol is called UDP and provides a way for applications to send encapsulated IP data packets without establishing a connection.
The TCP/IP protocol refers to the OSI architecture to a certain extent. The OSI model has seven layers, from bottom to top they are the physical layer, data link layer, network layer, transport layer, session layer, presentation layer, and application layer. This is obviously somewhat complicated, so in the TCP/IP protocol, they are simplified into four levels.
(1) The services provided by the application layer, presentation layer, and session layer are not very different, so in the TCP/IP protocol, they are combined into one layer of the application layer.
(2) Since the transport vehicle and the network layer are very important in the network protocol, they are regarded as two independent layers in the TCP/IP protocol.
(3) Because the content of the data link layer and the physical layer are similar, they are merged into a layer of the network interface layer in the TCP/IP protocol. The TCP/IP protocol with only a four-layer system structure is much simpler than the OSI with a seven-layer system structure. It is precisely this way that the TCP/IP protocol has higher efficiency and lower cost in practical applications.
Insert picture description here
In the OSI open system interconnection reference model, the upper three layers process data for applications, and the lower four layers are responsible for data transmission. For example, when computer A sends a picture to computer B, the upper three layers are responsible for converting the image into a binary representation, and the lower four layers are responsible for transferring data from computer A to computer B. The process of processing data from high-level to low-level. During the process, the data will continue to grow and add a header to the data. This process is called encapsulation. Conversely, decapsulation is a process of reading data from the low-level to the high-level, during which the data will continue to become smaller.
Here is a small question, can the graphic network be expanded indefinitely in theory?
The answer is definitely no. The nature of the network cable is still a wire, and the current will attenuate during transmission. In this case, can we add a booster device on the way of current transmission, so people invented the repeater (amplifier). However, the deviation of the signal from the original signal or standard during transmission is called distortion. Therefore, the graphic network cannot theoretically achieve unlimited transmission.
Scenario 2
Data transmission between multiple computers
Firstly introduce several common connection methods of computer network
1. Linear topology
Insert picture description here
Linear topology : The number of cables required for flutter is small, the cable length is short, and it is easy to wire and maintain, but if the middle one appears The entire network will be paralyzed.
2. Ring topology
Insert picture description here
Ring topology : Compared with the linear type, the ring has one more network path, but it is not much better.
3. Star topology
Insert picture description here
Star topology: Star topology will not affect the transmission of other nodes due to damage of one node.
The star topology is the most common network topology. Therefore, we choose a star topology network. The device in the middle of the figure is called a switch. What function should it have?

1. Provide a large number of ports for cable connection, and have the functions of bridge, hub and repeater
2. There is no conflict at all, all nodes can send and receive data at the same time, and the switch can convert the bit stream into binary data and store In the memory, there will be no conflicts and no data flow loss.
3. Identify and record the MAC address. The MAC address is the computer’s ID card. It is programmed at the factory and is unique in the world and displayed in hexadecimal. The switch can identify the MAC address of the computer. When a data frame enters the switch, the switch first checks the source MAC address in the data, and then maps it with the corresponding interface (MAC address table); then checks the target MAC in the data, and then checks the local MAC address table to find Corresponding interface; if a record is found, it will only forward (unicast) to that interface; if there is no record, the traffic will be flooded.

Flooding: A copy of all other interfaces except the local incoming interface

For example, when computer A wants to send data to computer B, it needs to tell the router your MAC address first. The router will record your MAC address first, then tell computer A the MAC of computer B, and the router will send the data frame to computer B. computer. If the switch does not know the MAC of computer B, the switch will send a message to every computer except the source of the message, "Ask your computer B?" When message B is heard, it will respond to the router, "I am B, I am B" and tell the switch its own MAC, and the switch tells B's MAC to A and records it in the table.

Now we consider the previous question-can the graph network expand indefinitely in theory?
Insert picture description here
Answer: Yes, one switch can be connected to one switch to achieve unlimited expansion in theory, but in practice this kind of network will become very stuck after reaching a certain level. When a network reaches a certain scale, it is inevitable that there will be multiple floods. The flooded area is called the flooding zone. The flooding is "junk" except for the target computer, just like you always go out every time. It is a headache to dispose of the garbage at the door first. If you want to continue to expand the network, you need a device to isolate two different flooding ranges, and routers came into being.

How does the router do it?

To understand the working principle of a router, one must understand an important protocol—Internet Interconnection Protocol (IP). IP is the core of the entire TCP/IP protocol suite and the foundation of the Internet. The IP address is used to identify devices on the network, and the IP address is composed of two parts: the network address and the host address. For example, 192.168.1.1 is an IPv4 address. The IPV4 address is composed of 32-bit binary. The subnet mask is closely related to the IP address. Used to specify the network address and host address of an IP address. For example, IP address: 192.168.1.1; subnet mask: 255.255.255.0, indicating that the first 24 bits of the IP are network bits, and the last 8 bits are host bits. The IP addresses under the same network bit belong to a flooding range, also called a broadcast domain.
Insert picture description here
The computer on the left and the computer on the right are in two different broadcast domains, and the router is the boundary of the two broadcast domains. If the gateway on the left end of the router is set to 192.168.1.0, and the gateway on the right end is 192.168.2.0. At this time, if the computer on the left end wants to establish communication with the computer with IP 192.168.2.2, the router can let data packets pass, but if it wants to communicate with IP 192.168 .3.2 The computer establishes communication, and the data packet cannot pass through, and the router also assumes the role of the network gate.
Scenario 3
Surfing the Internet Surfing the
Insert picture description here
Internet has become a must-do for most people every day, but do you know the logic behind it?

The old rules still need to understand the relevant protocols and services first-Hypertext Transfer Protocol (HTTP Protocol), Domain Name Resolution Service (DNS)

HTTP is a simple request-response protocol, which usually runs on top of TCP. It specifies what kind of message the client may send to the server and what kind of response it gets.
Domain name resolution service (DNS) is a service that converts domain names into IP addresses.
When we visit Taobao, enter www.taobao.com , click Enter, and you can buy it after entering. To visit Taobao is to visit a server. The server is a super-highly equipped computer with a special operating system and provides a certain service. Each server has its own IP address, and accessing the server means accessing an IP address. The role of DNS is to convert www.taobao.com into a corresponding IP address.

Guess you like

Origin blog.csdn.net/m0_50911938/article/details/110590565