zoukankan      html  css  js  c++  java
  • Ubuntu网速慢的问题

    Ubuntu 网速慢,主要是把时间浪费在域名解析上。我们可以用dnsmasq解决这问题。
    具体如下:

    安装dnsmasq

    命令: sudo apt-get install dnsmasq

    编辑dnsmasq的配置文件

    命令: sudo gedit /etc/dnsmasq.conf

    找到下面这一项

    #resolv-file=

    用下面的一条语句替换

    resolv-file=/etc/resolv.dnsmasq.conf

    确保你没有更改过/etc/resolv.conf文件,如果改过,恢复原状

    然后执行命令

    sudo cp /etc/resolv.conf /etc/resolv.dnsmasq.conf

    然后编辑resolv.conf

    命令;sudo gedit /etc/resolv.conf

    将其中的域名服务器全部去掉,加入以下这行

    nameserver 127.0.0.1

    如果用路由上网也可以加上路由的地址

    保存,退出
    编辑/etc/dhcp3/dhclient.conf,修改为:
    #supersede domain-name “fugue.com home.vix.com”;
    prepend domain-name-servers 127.0.0.1;
    request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, host-name,
    netbios-name-servers, netbios-scope;
    执行以下命令

    sudo gedit /etc/ppp/peers/wvdial

    在 usepeerdns 前面增加 # ,也就是把这条语句覆盖掉。

    以防,resolv.conf的设置被pppoe覆盖。

    重启电脑。不重启,你会发现无法解析域名。所以一定要重启电脑,来达到重新启动dnsmasq的目的。

    重启后, 你会发现解析速度比以前快了N个数量级。
  • 相关阅读:
    js optional chaining operator
    Linux Bash Script conditions
    Linux Bash Script loop
    js Nullish Coalescing Operator
    js sort tricks All In One
    React Portal All In One
    最小生成树&&次小生成树
    链式前向星实现以及它的遍历
    [2015.11.8|9图论]解题代码集合
    最短路算法及其延伸
  • 原文地址:https://www.cnblogs.com/shengshuai/p/1404632.html
Copyright © 2011-2022 走看看