DNS lookup 在把域名解析成 IP 过程中耽误了不少时间,尤其是访问比较复杂的网站的时候,比如某个页面包含多个 url,一次请求需要做多次 DNS 解析,并且从用户浏览器到 DNS server,以及 DNS server 和 DNS server 之间都会产生延迟或有可能发生的错误,Google 意识到了这点,作为 Google 雄心勃勃 make the web faster 计划的一部分,Google 去年年底发布了自己的 Google Public DNS,对于一些在我们的 VPS 上使用 vpn 浏览网页的用户,在自己 VPS 里面加入 Google Public DNS 可以加快访问网站的速度(虽然作为用户来说速度差异感觉不明显)。打开 Linux 的 inlcude/resolv.h 文件可以发现里面定义了可以追踪的 DNS server 数目:

$ vi /usr/include/resolv.h

/*
* Global defines and variables for resolver stub.
*/
# define MAXNS 3 /* max # name servers we'll track */

所以 /etc/resolv.conf 定义了3个 name server,option rotate 选项指在这3个 dns server 之间轮回查询,option timeout:1 选项设定 lookup timeout 的时间为1秒(默认为5秒),下面是 VPSee 使用的 DNS server 和 resolv.conf 配置:

$ cat /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 4.2.2.2
option rotate
option timeout:1 http://www.vpsee.com/2010/05/optimize-resolv-conf/

优化 resolv.conf的更多相关文章

  1. 两个坑-Linux下Network-Manager有线未托管-DNS resolv.conf文件开机被清空

    Linux里面有两套管理网络连接的方案: 1./etc/network/interfaces(/etc/init.d/networking) 2.Network-Manager 两套方案是冲突的,不能 ...

  2. CentOS6.3 重启后/etc/resolv.conf 被还原解决办法(转)

    今天一台服务器上不了网,设置了nameserver,重启后/etc/resolv.conf文件就被自动还原了,最后发现是被Network Manager修改了.解决方法:停止Network Manag ...

  3. /etc/resolv.conf overwritten. Redhat/Centos

    Prevent /etc/resolv.conf from being blown away by RHEL/CentOS after customizing If you are using RHE ...

  4. 转 -- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)

    原文转自:http://www.cnblogs.com/lanxuezaipiao/p/3613497.html#undefined 虚拟机里设置上网方式为NAT最方便,因为无需手动设置即可上网,但是 ...

  5. Linux下/etc/resolv.conf 配置DNS客户

    文件/etc/resolv.conf配置DNS客户,它包含了主机的域名搜索顺序和DNS服务器的地址,每一行应包含一个关键字和一个或多个的由空格隔开的参数.下面是一个例子文件: search mydom ...

  6. RAC GI安装,报"Task resolv.conf Integerity"验证失败

    安装12.1.0.2 rac测试环境的时候,报"Task resolv.conf Integerity"验证失败 解决方案: 因为测试环境,没有使用DNS,删除resolv.con ...

  7. Linux下/etc/resolv.conf 会被重新写入

    主要原因是因为安装了network manager,所以在启动后每次都会重写这个文件. 所以需要在network manager->eth0->ipv4->Automatic(DHC ...

  8. 解决Ubuntu系统的每次开机重启后,resolv.conf清空的问题

    问题情况描述如下: 普及知识:   /etc/resolv.conf ,其实是一个Link .它其实指向的是 /run/resolvconf/resolv.conf.  Ubuntu 有一个 reso ...

  9. Ubuntu Server 中resolv.conf重启时被覆盖的问题

    /etc/resolv.conf中设置dns之后每次重启Ubuntu Server时该文件会被覆盖,针对这种情况找了一些个解决方法 防止/etc/resolv.conf被覆盖的方法 方法一 1.需要创 ...

随机推荐

  1. Leetcode 1021. Remove Outermost Parentheses

    括号匹配想到用栈来做: class Solution: def removeOuterParentheses(self, S: str) -> str: size=len(S) if size= ...

  2. 二叉树的前序、中序、后序遍历 python

    话不多说,直接上代码 class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None cl ...

  3. 51Nod 1081:子段求和(前缀和)

    1081 子段求和  基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题  收藏  关注 给出一个长度为N的数组,进行Q次查询,查询从第i个元素开始长度为l的子段所有元素之和 ...

  4. 设置Nginx日志

    在nginx.conf文件或vhosts/*.conf文件中的access_log日志中指定级别为main. http { include mime.types; default_type appli ...

  5. HDU5296 Annoying problem(LCA)

    //#pragma comment(linker, "/STACK:1677721600") #include <map> #include <set> # ...

  6. FastAdmin bootstrap-table 分页手动输入跳转

    FastAdmin bootstrap-table 分页手动输入跳转 Bootstrap-Table (V1.11.0)默认是没有这个功能的,不过作者有写的扩展. https://github.com ...

  7. 【转】ubuntu中没有/etc/inittab文件探究

    原文网址:http://blog.csdn.net/gavinr/article/details/6584582 linux 启动时第一个进程是/sbin/init,其主要功能就是软件执行环境,包括系 ...

  8. jquery on() bind()绑定的点击事件在js动态新添加的元素生效

    方法一:$('.class').on("click",function(){……}); 相当于 $('.class').bind("click",functio ...

  9. LDAP基本概念

    LDAP(Lightweight Directory Access Protocol)是一种基于计算模型的客户机/服务器X.500目录服务访问协议.LDAP是从X.500目录访问协议的基础上发展过来的 ...

  10. moodle搭建相关的笔记

    关于moodle内网外网访问问题的解决方案(转) http://blog.chinaunix.net/uid-656828-id-3106027.html