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)

相关推荐

  • 木在田字格的正确写法,“木”的笔顺在田字格怎么写

    技术木在田字格的正确写法,“木”的笔顺在田字格怎么写木在田字格里的写法如上。 木木在田字格的正确写法:[ mù ] 部首:木 笔画:4 五行:木 五笔:SSSS 基本解释 1. 树类植物的通称 :树~。乔~。灌~。~石(

    生活 2021年10月26日
  • 怎么使用DETERMINISTIC函数

    技术怎么使用DETERMINISTIC函数这篇文章主要讲解了“怎么使用DETERMINISTIC函数”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么使用DETERMIN

    攻略 2021年11月8日
  • gis安装

    技术gis安装 gis安装1、下载arcGis10.2软件下载地址:https://pan.baidu.com/s/1rHtNHn-l-myoSvCvbpAGHA 提取码:ki1e (压缩包密码:arc

    礼包 2021年10月28日
  • 如何理解ASP.NET中WCF服务与ASMX服务的兼容性

    技术如何理解ASP.NET中WCF服务与ASMX服务的兼容性这期内容当中小编将会给大家带来有关如何理解ASP.NET中WCF服务与ASMX服务的兼容性,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可

    攻略 2021年11月26日
  • 常见Hadoop命令使用方法是怎样的

    技术常见Hadoop命令使用方法是怎样的这篇文章将为大家详细讲解有关常见Hadoop命令使用方法是怎样的,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。在学习Hadoop时

    攻略 2021年11月12日
  • javagetclass与classforname(javagetclass获取属性值)

    技术Java中的getClass()及getName()方法怎么使用本篇内容介绍了“Java中的getClass()及getName()方法怎么使用”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就

    攻略 2021年12月22日