当前位置:网站首页>The role of /etc/resolv.conf
The role of /etc/resolv.conf
2022-07-31 23:21:00 【larance】
Backstory:
Have we ever had such an experience: when we use a browser to surf the Internet, we can't get on, but QQ can get on it.Why?There is a problem with dns, one of the ways is to solve this problem by configuring /etc/resolv.conf.
What is it?
/etc/resolv.conf It is the DNS client configuration file, which is used to set the IP address and DNS domain name of the DNS server, and also contains the domain name search order of the host.This file is a configuration file used by resolvers (a library that resolves IP addresses from hostnames).
nameserver #Define the IP address of the DNS serverdomain #define the local domain namesearch #Define the search list of domain namessortlist #sort the returned domain namesAn example of /etc/resolv.conf:
domain test.comsearch www.test.com test.comnameserver 202.96.128.86nameserver 202.96.128.166The most important is the nameserver keyword. If the nameserver is not specified, the DNS server cannot be found. Other keywords are optional.
nameserver - Indicates that the host specified by this address is the domain name server when resolving the domain name.The domain name servers are queried in the order in which they appear in the file, and the following nameservers are queried only when the first nameserver does not respond.
domain Declare the domain name of the host.It is used by many programs, such as mail systems; it is also used when doing DNS queries for hosts that do not have a domain name.If there is no domain name, the hostname will be used, removing everything before the first dot ( .).
search Its multiple parameters specify the domain name search order.When querying a host without a domain name, the host will be looked up separately in the domain declared by search.
domain and search cannot coexist; if both exist, the latter will be used.
sortlist Allows specific sorting of the domain name results.Its argument is a net/mask pair, allowing any sort order
Priority: dns cache>hosts>dns service
Steps of DNS resolution:
1. Find /etc/hosts
2. Find the domain name according to the nameserver
3. If the domain name cannot be found on the nameserver, perform search completion and take 1~2 steps again
Recently encountered wget: unable to resolve host address `******'
Workaround: vim /etc/resolv.conf
Add nameserver 114.114.114.114
The ips that can usually be configured are:
114.114.114.114
119.29.29.29
223.5.5.5
Reference Analysis of the role of /etc/hosts and /etc/resolv.conf_Nick_9705's blog-CSDN blog
边栏推荐
- In Golang go-redis cluster mode, new connections are constantly created, and the problem of decreased efficiency is solved
- PHP三元(三目)运算符
- SQL注入 Less42(POST型堆叠注入)
- Bionic caterpillar robot source code
- Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
- Flutter教程之四年开发经验的高手给的建议
- SQL injection Less54 (limited number of SQL injection + union injection)
- HTC using official firmware as bottom bag made ROM brush card bag tutorial
- 2022年CSP-J1 CSP-S1 第1轮初赛 报名指南
- 了解下C# 匿名方法
猜你喜欢

IDA PRO中汇编结构体识别
I don't know what to do with sync issues

A high-quality WordPress download site template theme developed abroad

ICML2022 | 深入研究置换敏感的图神经网络

cobaltstrike
Mysql environment installation under Linux (centos)

【Acwing】第62场周赛 题解

【Acwing】The 62nd Weekly Game Solution

/etc/sysconfig/network-scripts 配置网卡

登录业务实现(单点登录+微信扫码+短信服务)
随机推荐
景区手绘地图的绘制流程
Shell common script: Nexus batch upload local warehouse script
面试突击69:TCP 可靠吗?为什么?
Fixed-length usage of nanopb string type based on RT1052 Aworks (27)
"APIO2010" Patrol Problem Solution
I don't know what to do with sync issues
一款国外开发的高质量WordPress下载站模板主题
Learn about C# anonymous methods
The article you worked so hard to write may not be your original
VOT2021 game introduction
Flutter教程之 02 Flutter 桌面程序开发入门教程运行hello world (教程含源码)
SQL injection Less38 (stack injection)
消息队列消息存储设计(架构实战营 模块八作业)
面试突击69:TCP 可靠吗?为什么?
How to reduce the gap between software design and implementation
What is customer profile management?
Recognize anomalies (you will understand after reading this)
Unity - by casting and cloning method dynamic control under various UGUI create and display
LevelSequence source code analysis
博弈论(Depu)与孙子兵法(42/100)