This article will not directly introduce complex and boring concepts, but explain it in a simple way with vivid examples, aiming at getting started.
DNS role
DNS is used for domain name resolution .
It is equivalent to translating the URL into an actual IP address for access by other devices.
one example
There is a website whose server IP address is 1.1.1.1
. If you use a computer to access the website, you only need to enter it in the browser to 1.1.1.1
access it.
But if the server IP address of this website changes the next day 2.2.2.2
, if you still use the previous method to access at this time, 1.1.1.1
you will not be able to access the website.
And it is impossible for this website to tell users what its IP has changed every time the IP changes.
At this time, DNS is needed to play a role.
In the network, there is a 10.1.1.1
DNS server with an address of , which will record the correspondence between domain names and ip addresses on the network.
The domain name of Baidu recorded on the DNS is www.baidu.com , and the ip address is 1.1.1.1
.
Then the computer only needs to access its domain name, and it will go to 10.1.1.1
the DNS server with ip to check Baidu's ip address. After the query is found, the computer will get 1.1.1.1
this ip to access Baidu.
In this way, even if Baidu's IP address changes, users only need to access the domain name when visiting without being affected.
The devices on the network only need to update the changed ip address to the DNS server.
DNS Hijacking and Pollution
If when accessing a certain domain name, the DNS server is maliciously modified when returning the ip address and returns a wrong ip , and the user will visit other websites.
And this wrong website can get your information through the content you entered on it.
Therefore, DNS hijacking and DNS pollution will be illegal if the consequences are serious~
extend
The hosts file on the C disk on the computer also has the function of domain name resolution, and it also records the corresponding relationship between the ip address and the domain name.
The difference is that the hosts file has a size limit, and only frequently accessed domain names are recorded, and most domain names are still resolved by DNS servers on the network.
The host file path is located atC:\Windows\System32\drivers\etc\hosts
Interested friends can open it~
Reference: https://www.bilibili.com/video/BV1AY411o7RS
https://www.bilibili.com/video/BV1Rp4y1a7xQ