Explain in simple terms what is IP address, subnet mask, port number, DNS, gateway (beginners must read it)

1. IP address

IP address: To achieve communication between computers, an ip address is necessary. An IP address is composed of a network address and a host address.

Function: confirm the position.

Example: equivalent to an address, such as the room number of a building.

2. Subnet mask

Subnet mask: Divide the IP address into a network address and a host address. It cannot exist alone and must be used together with the IP address.

Function: Confirm the network segment.

Example: If the ip address is the room number of the building, then the subnet mask is the floor number of the building.

3. Port number

Port number: The computer in the network represents its identity through the IP address. It can only represent a specific computer, but a computer can provide many services at the same time, such as database service, FTP service, Web service, etc. We use the port number to distinguish these different services provided by the same computer. For example, the common port number 21 refers to the FTP service, port number 23 refers to the Telnet service, and port number 25 refers to the SMTP service. The port number is generally used as a 4-digit integer, and the port number cannot be repeated on the same computer, otherwise, an exception such as a port conflict will occur.

Function: The main function of the port number is to indicate the service provided by a specific process in a computer.

Example: The client finds the corresponding server through the IP address, but there are many applications on the server, and each application corresponds to a port number. Through the port number, the client can accurately access the application of the server.

4. DNS protocol

DNS protocol: DNS protocol is a service of the Internet. It serves as a distributed database that maps domain names and IP addresses to each other, enabling people to access the Internet more conveniently.

Function:
forward resolution: find the corresponding IP address according to the host name (domain name).
Reverse analysis: Find the corresponding host domain name according to the IP address.

Example: When a host on the Internet wants to access another host, it must obtain its IP address, just like you must know the address of his home when you visit a friend. Taking ipv4 as an example, the IP in TCP/IP The address is composed of four numbers separated by ".", which is not very convenient to remember, so the domain name system is used to manage the correspondence between names and IPs.

Why not use a domain name to communicate directly?
1. Because the IP address is a fixed length, IPv4 is 32 bits, IPv6 is 128 bits, and the domain name is variable length, which is not easy for computers to process.
2. The IP address is inconvenient for users to remember, but the domain name is easy for users to use. For example, www.baidu.com is Baidu's domain name.
3. In summary, IP addresses are host-oriented, while domain names are user-oriented.

5. Gateway

Gateway: It is a bridge between a network and other networks. Suppose there are network A and network B, the IP address range of network A is "192.168.1.1-192.168.1.254", the subnet mask is 255.255.255.0; the IP address range of network B is "192.168.2.1-192.168.2.254" , the subnet mask is 255.255.255.0. In the absence of a router, TCP/IP communication cannot be performed between two networks. Even if the two networks are connected to the same switch (or hub), the TCP/IP protocol will use the subnet mask (255.255 .255.0) to determine that the hosts in the two networks are in different networks. And to realize the communication between these two networks, you must go through the gateway. If the host in network A finds that the destination host of the data packet is not in the local network, it forwards the data packet to its own gateway, and then forwards the data packet to the gateway of network B, and the gateway of network B forwards it to a certain network B host. The process of forwarding data packets from network A to network B. A gateway in the usual sense is a gateway under the TCP/IP protocol.

Role: middleman, bridge.

For example: Suppose your name is Xiaobudian (very small), you live in a big yard, but your parents do not allow you to go out of the gate, if you want to contact the outside world, your parents (your own gateway) must help you by phone connect. If you want to chat with your classmate Xiao Ming, Xiao Ming's family lives in another yard far away, and he also has parents (Xiao Ming's gateway) at home. But you don't know Xiao Ming's phone number, but your class teacher has a list of all the students in your class and a phone number comparison table (your teacher is your DNS server).
So you have the following dialogue with your parents at home:
Little one: Mom (or Dad), I want to ask the head teacher to check Xiaoming's phone number, okay? Parent: OK, you wait. (Then your parent hung up a phone call to your head teacher and asked for Xiao Ming's phone number) Yes, his home number is 211.99.99.99
Xiao Budian: Great! Mom (or Dad), I want to find Xiao Ming, please contact Xiao Ming for me.
Parent: No problem. (Then the parent sent a request to the telephone company to connect to Xiao Ming’s phone number. Of course, the last pass was transferred to Xiao Ming’s parents, and then his parents transferred the call to Xiao Ming). In this way, you got in touch with Xiao
Ming .
If you figure out what a gateway is, the default gateway will be easy to understand. Just like a room can have multiple doors, a host can have multiple gateways. The default gateway means that if a host cannot find an available gateway, it will send the data packet to the default designated gateway, and the gateway will process the data packet.

Guess you like

Origin blog.csdn.net/qq_46901210/article/details/127343858