当前位置:网站首页>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 names
An example of /etc/resolv.conf:
domain test.comsearch www.test.com test.comnameserver 202.96.128.86nameserver 202.96.128.166
The 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
- 基于单片机GSM的防火防盗系统的设计
- JS basic exercises
- 支付模块实现
- Unity-LineRenderer显示一条线
- Unity - by casting and cloning method dynamic control under various UGUI create and display
- UOS统信系统 - WindTerm使用
- UOS - WindTerm use
- 逐步手撕轮播图3(保姆级教程)
- Unity-通过预制件和克隆方法动态实现各个UGUI下控件的创建和显示
猜你喜欢
Summary of the classic drawing method of histogram
Pytest first experience
如何减少软件设计和实现之间鸿沟
登录业务实现(单点登录+微信扫码+短信服务)
消息队列存储消息数据的MySQL表格
cobaltstrike
Shell common scripts: Nexus batch upload local warehouse enhanced version script (strongly recommended)
2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法
基于单片机GSM的防火防盗系统的设计
SQL27 View user details of different age groups
随机推荐
Shell常用脚本:Nexus批量上传本地仓库脚本
lua入门案例实战123DIY
TypeScript 的组件
How to identify fake reptiles?
Golang - from entry to abandonment
Flex layout in detail
(26) About menu of the top menu of Blender source code analysis
20. Support vector machine - knowledge of mathematical principles
2022年CSP-J1 CSP-S1 第1轮初赛 报名指南
周总结
编程语言是什么
SQL injection Less42 (POST type stack injection)
"APIO2010" Patrol Problem Solution
Components of TypeScript
/etc/resolv.conf的作用
不知道该怎么办的同步问题
How to get useragent
#yyds干货盘点# 面试必刷TOP101:链表中环的入口结点
Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix
ICML2022 | 深入研究置换敏感的图神经网络