Briefly explain the relationship between IP, subnet mask, gateway and DNS server in network settings

foreword

We often use the network. Whether it is for development or just for use, we may often change the configuration in the computer. Most people may only use it, but the specific relationship is not clear. This article will use my own understanding to talk about the relationship between these two.

 IP address

First of all, we need to know one thing. The computer must be connected to the router to have an ip address. The computer itself cannot assign an ip address to itself. It must be assigned by the router. In the same LAN, the router will assign differently to each connected device. ip address.

subnet mask

Used to determine whether the IP is in the same LAN. For example, if there is a device with an IP of 192.168.0.100 and a subnet mask of 255.255.255.0, then relative to this device, it is considered that the IP in the range 192.168.0.1-192.168.0.255 is in the same range as itself A group, if there is another device with an IP of 192.168.0.200 and a subnet mask of 255.255.255.0, it is also considered that the IP of 192.168.0.100 is a group with itself, and the two devices can communicate in the LAN.

That is to say, to realize LAN communication between two devices, both parties must regard each other's IP as the same group as their own.

gateway

IP and IP cannot communicate directly, and the data must be forwarded through the routing gateway, usually the routing IP address. If the router cannot find this IP address, it will send the data to its own gateway, which is the router connected by the router. And so on.

DNS server

To resolve the domain name, network communication needs to know the IP address of the other party. If the input is not an ip but a URL, the device itself cannot resolve the URL, and the router’s DNS server can resolve the domain name to an IP, so the process is generally to enter the URL—send it to the router DNS server resolution - the device gets the IP, packs the data and sends it to the router, and the DNS server is generally the router IP address.

my understanding

In a building, there are 255 residents. Assuming that the residents want to send things to the residents, they must find the administrator of the building, and give the items and the target house number (IP address) to the administrator. The administrator will make a judgment based on the information of both parties. Do the two households consider each other to be in the same group? If so, they can send things to the households.

If the resident gives the address (URL) directly, then in the same way, find the administrator, get the house number, pack the things, add the house number and give it to the administrator for help to send it out. If the administrator is not found in the building, then it will be sent to the administrator of the community. If the administrator of the community cannot find it, it will be sent to the administrator of the area... and finally the item will be sent to the corresponding residents.

Summarize

This article mainly tells about my own understanding. I am also a novice. The state of half-knowledge in the early stage has really troubled me for a long time, and there may still be deficiencies.

Finally, I hope my article can be helpful to you.

Guess you like

Origin blog.csdn.net/lhh2333/article/details/131060660