当前位置:网站首页>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
边栏推荐
- The latest masterpiece!Alibaba just released the interview reference guide (Taishan version), I just brushed it for 29 days
- What is customer profile management?
- 登录业务实现(单点登录+微信扫码+短信服务)
- C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处
- IDA PRO中汇编结构体识别
- 编写方法将一个数组扁平化并且去重和递增排序
- ICML2022 | 深入研究置换敏感的图神经网络
- "SDOI2016" Journey Problem Solution
- 2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法
- uniapp小程序检查、提示更新
猜你喜欢

消息队列存储消息数据的MySQL表格

20. Support vector machine - knowledge of mathematical principles

Google Earth Engine——Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid type的错误解决

高等代数_证明_任何矩阵都相似于一个上三角矩阵

手写一个简单的web服务器(B/S架构)

VOT2021 game introduction

Unity - LineRenderer show a line

How to reduce the gap between software design and implementation

网易云信圈组上线实时互动频道,「破冰」弱关系社交

【云驻共创】【HCSD大咖直播】亲授大厂面试秘诀
随机推荐
ICML2022 | 深入研究置换敏感的图神经网络
基于单片机GSM的防火防盗系统的设计
助力数字政府建设,中科三方构建域名安全保障体系
【云驻共创】【HCSD大咖直播】亲授大厂面试秘诀
TypeScript 的组件
面试突击69:TCP 可靠吗?为什么?
JS basic exercises
10大主流3D建模技术
TestCafeSummary
支付模块实现
【1161. 最大层内元素和】
/etc/sysconfig/network-scripts 配置网卡
Bionic caterpillar robot source code
「SDOI2016」征途 题解
Fixed-length usage of nanopb string type based on RT1052 Aworks (27)
Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
程序进程和线程(线程的并发与并行)以及线程的基本创建和使用
[QNX Hypervisor 2.2 User Manual]9.14 set
手写一个简单的web服务器(B/S架构)
信奥学习规划 信息学竞赛之路(2022.07.31)