Ubuntu 18.04 LTS的网络经常变成问号导致网速很慢的解决办法

技术Ubuntu 18.04 LTS的网络经常变成问号导致网速很慢的解决办法 Ubuntu 18.04 LTS的网络经常变成问号导致网速很慢的解决办法问题描述:
Ubuntu系统Gnome桌面顶部栏的网

Ubuntu 18.04的网络经常变成问号导致网速很慢的解决办法

问题描述:

人的本质系统土地神桌面顶部栏的网络图标经常变成了一个问号。期间不能打开网页,在终端里面砰公网有时能通但丢包严重,或者根本就不通,错误提示名称解析暂时失败,表示域名解析失败。

问题原因:

人的本质默认安装的域名服务器(域名服务器)解析工具系统已解决存在问题;

系统频繁对网络信号进行连接检查,导致不能联网。

解决办法:

一、将DNS解析工具从systemd-resolved切换为unbound

1、安装unbound

sudo apt-get安装未绑定

2、安装resolvconf

sudo apt-get install resolvconf

3、禁用默认域名解析工具systemd-resolved并停止正在运行的程序

sudo系统ctl禁用systemd-resolved.service

sudo系统ctl禁用系统d-已解决

4、配置NetworkManager,使其使用unbound作为系统的域名解析工具

sudo vim/etc/网络管理员/网络管理员。conf

在该配置文件中,紧跟插件在下面一行加上dns=未绑定:

[主要]

plugins=ifupdown,keyfile

dns=未绑定

[ifupdown]

托管=假

[设备]

wifi.scan-rand-mac-address=no

5、手动启用unbound

sudo系统ctl启用未绑定-解决冲突

sudo系统ctl启用未绑定

6、修改unbound配置文件/etc/unbound/unbound.conf

查看unbound.conf的指南页面

未绑定的人

可以看到有以下一段内容:

服务器:

目录: '/etc/unbound '

用户名:未绑定

#确保解开可以从chroot内部访问熵。

#例如,在Linux操作系统上使用这些命令(在加州大学伯克利分校软件(Berkeley Software Distribution)上,使用devfs(8 )) :

# mount-bind-n/dev/random/etc/unbound/dev/random

#和装载-绑定-n /dev/log /etc/unbound/dev/log

chrot : '/etc/unbound '

#日志文件: '/etc/unbound/unbound。日志' #取消注释以使用日志文件。

PID file : '/etc/unbound/unbound。' PID '

# verbosity: 1 #取消注释并增加以获取更多日志记录。

#监听所有接口,回答本地子网的询问。

接口: 0.0.0.0

接口:0

访问控制: 10.0.0.0/8允许

允许访问控制: 2001:DB8:/64

把这段配置内容追加到文件/etc/unbound/unbound.conf中:

#未绑定配置f

ile for Debian.
#
# See the unbound.conf(5) man page.
#
# See /usr/share/doc/unbound/examples/unbound.conf for a commented
# reference config file.
#
# The following line includes additional configuration files from the
# /etc/unbound/unbound.conf.d directory.
include: "/etc/unbound/unbound.conf.d/*.conf"
directory: "/etc/unbound"
username: unbound
# make sure unbound can access entropy from inside the chroot.
# e.g. on linux the use these commands (on BSD, devfs(8) is used):
# mount --bind -n /dev/random /etc/unbound/dev/random
# and mount --bind -n /dev/log /etc/unbound/dev/log
chroot: "/etc/unbound"
# logfile: "/etc/unbound/unbound.log" #uncomment to use logfile.
pidfile: "/etc/unbound/unbound.pid"
# verbosity: 1 # uncomment and increase to get more logging.
# listen on all interfaces, answer queries from the local subnet.
interface: 0.0.0.0
interface: ::0
access-control: 10.0.0.0/8 allow
access-control: 2001:DB8::/64 allow

7、修改resolvconf配置文件/etc/resolconf/resolv.conf.d/tail

查看unbound的manual页面,可以看到有以下一段内容:

To use a locally running Unbound for resolving put
             nameserver 127.0.0.1
into resolv.conf(5).

这里意思是,要使用某一个域名服务器,就要将该服务器的键值对写入到/etc/resolv.conf中。比如要使用本地的unbound程序做域名解析,就把nameserver 127.0.0.1加入到文件/etc/resolv.conf中。

但是我们打开文件/etc/resolv.conf,发现文件头部的描述如下:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

这里说明文件/etc/resolv.conf的内容是又resolvconf软件生成的,手动修改只能临时起作用,一旦主机重启文件中的内容就会消失。因此我们必须在resolvconf软件中找到配置该文件的配置文件。

查看resolvconf软件的manual页面,我们发现了如下内容:

FILES
       /etc/default/resolvconf
              See the ENVIRONMENT VARIABLES section.
       /etc/resolvconf/interface-order
              Determines the order of precedence of nameserver  addresses  and
              search domain names.  See above and interface-order(5).
       /etc/resolvconf/resolv.conf.d/base
              File  containing  basic resolver information.  The lines in this
              file are included in the resolver configuration file  even  when
              no interfaces are configured.
       /etc/resolvconf/resolv.conf.d/head
              File  to be prepended to the dynamically generated resolver con‐
              figuration file.  Normally this is just a comment line.
       /etc/resolvconf/resolv.conf.d/tail
              File to be appended to the dynamically generated  resolver  con‐
              figuration  file.   To  append nothing, make this an empty file.
              This file is a good place to put a resolver options line if  one
              is needed, e.g.,
              
       /etc/resolvconf/resolv.conf.d/original
              Copy  of the /etc/resolv.conf file before the resolvconf package
              was installed.  This file has no effect on  the  functioning  of
              resolvconf;  it  is  retained  so  that  /etc/resolv.conf can be
              restored to its original state  if  the  resolvconf  package  is
              removed.
              Note  also  that a copy of this file is included in the database
              until the first reboot  after  installation  of  the  resolvconf
              package;  this ensures that nameservers reachable before instal‐
              lation of resolvconf are still reachable after  installation  of
              resolvconf  even though at that point not all suppliers of name‐
              server  information  may  have  supplied  their  information  to
              resolvconf(8).
              Note also that the administrator can choose to create a symbolic
              link in /etc/resolvconf/resolv.conf.d/ from tail to original  so
              that the contents of original are always added to the end of the
              dynamically generated file.

从中找到文件 /etc/resolvconf/resolv.conf.d/tail,该文件用来生成/etc/resolv.conf的配置文件质之一。

在文件 /etc/resolvconf/resolv.conf.d/tail中加入需要的键值对之后,重启主机就能在文件/etc/resolv.conf中看到配置好的DNS:

nameserver 119.29.29.29
nameserver 233.5.5.5
nameserver 114.114.114.114
nameserver 1.1.1.1

目前可用的DNS主要有以下:

  • 腾讯的公用免费DNS: 119.29.29.29(首选)、182.254.116.116(备选)
  • 阿里的公用免费DNS: 233.5.5.5(首选)、233.6.6.6(备选)
  • 国内移动、电信和联通通用的公用免费DNS: 114.114.114.114
  • Cloudflare的公用免费DNS: 1.1.1.1(首选)、1.0.0.1(备选)

二、关闭系统的网络连接检查

网络信号的连接检查是导致WiFi图标经常变成问号的原因,不过这种状态下并不影响主机的网络连接,只是比较影响心情。
这里的方法是:进入设置-》隐私-》关闭连接检查

三、如果不关闭网络连接检查可以配置文件/etc/ppp/options

这里的解决方法参考一篇博客Ubuntu网络频繁掉线解决方案

/etc/PPP/options其中的lcp-echo-failure默认设为4,lcp-echo-interval设为30秒,也就是说如果120秒钟之内ADSL网络服务器没有回echo-reply信号。

可能是国内ADSL网络本身的问题,服务器好像是不会回echo-reply信号(有待考证)或者很长时间才会回echo-reply信号。所以可以把上面两个参数适当地调大一些。

  • 打开配置文件/etc/ppp/options
sudo vim /etc/ppp/options
  • 在options文件中找到以下两行代码
lcp-echo-failure 4
lcp-echo-interval 30
  • lcp-echo-failure 4改为lcp-echo-failure 15
  • 重启主机使配置生效

参考博客:Ubuntu WiFi图标变成问号 网速很慢

内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/84601.html

(0)

相关推荐

  • 远近闻名类似的词语,用下列词语编一个童话故事

    技术远近闻名类似的词语,用下列词语编一个童话故事卡尔是 远近闻名的制剑师摩尔的小儿子远近闻名类似的词语,他不仅剑制的的 好,剑术也是一流的,可以和国王的卫队相提并论。听说伯爵悬赏勇士去杀掉山上的恶龙,卡尔不假思索拿上最合

    生活 2021年10月25日
  • 分析数据库都做了哪些操作

    技术分析数据库都做了哪些操作这篇文章主要介绍“分析数据库都做了哪些操作”,在日常操作中,相信很多人在分析数据库都做了哪些操作问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”分析数据库都做了哪

    攻略 2021年11月4日
  • spring boot的多线程并发定时任务是什么

    技术spring boot的多线程并发定时任务是什么spring boot的多线程并发定时任务是什么,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所

    攻略 2021年10月21日
  • 微信小程序swiper组件怎么创建(微信小程序的wxss文件作用)

    技术微信小程序中的wxs模块怎么用这篇文章将为大家详细讲解有关微信小程序中的wxs模块怎么用,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。WXS的使用wxs是专门用于wxml页面的,它

    攻略 2021年12月19日
  • c语言多线程详解(c语言多线程数据安全)

    技术C#多线程安全怎么理解这篇文章主要介绍“C#多线程安全怎么理解”,在日常操作中,相信很多人在C#多线程安全怎么理解问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”C#多线程安全怎么理解”

    2021年12月22日
  • 淘宝买家信用,淘宝买家信誉分规则介绍

    技术淘宝买家信用,淘宝买家信誉分规则介绍一、评分原则:与买家有直接关系。当买家收到商品时,可以对卖家的商品、服务以及物流进行评价。看看卖家的商品是否与描述的一样淘宝买家信用?卖家的服务态度是否认真又耐心?物流的速度快不快

    生活 2021年10月27日