Ubuntu环境 - 断网重连问题解决

本文提供了解决Ubuntu系统下DSL拨号上网频繁断线的方法,通过修改/etc/ppp/options文件中的lcp-echo-failure和lcp-echo-interval参数,调整重连次数和周期,有效防止网络不稳定造成的断线问题。

Ubuntu下DSL拨号上网频繁断网解决方法

打开配置文件/etc/ppp/options
sudo vi /etc/ppp/options
# 不熟悉vi的同学可以使用gedit
sudo gedit /etc/ppp/options
在options文件中找到以下两行代码

lcp-echo-failure 4

相当于断线之后发送的心跳帧,即重连次数。

If this option is given, pppd will send an LCP echo-request frame to the peer every n seconds.

lcp-echo-interval 30

重连周期
If this option is given, pppd will presume the peer to be dead if n
LCP echo-requests are sent without receiving a valid LCP echo-reply. If this happens, pppd will terminate the connection.

两个字段的意思就是每30秒内重连一次,4次重连失败就自动断网,把4改大点,比如40、400。

Ubuntu下网络管理的其他命令

# 安装pppoe组件
sudo apt-get install pppoe pppoeconf

# 图形界面配置pppoe,等同于“编辑连接”
nm-connection-editor

# 命令行界面配置pppoe
sudo pppoeconf

# 联网,自动DSL拨号连接
sudo pon dsl-provider

# 断网,停止DSL拨号连接
sudo poff

# 重启网络服务
sudo service network-manager restart

Reference:https://www.cnblogs.com/ssooking/p/8571749.html

➜ NodeJS # 1. 备份要数据 e/NodeJS-backup # 2. 更新当前系统 ➜ NodeJS sudo cp -r /workspace/NodeJS /workspace/NodeJS-backup do apt upgrade -y # 3. 安装升级工具 sudo apt install update-manager-core -y # 4. 执行发行版升级 sudo do-release-upgrade ➜ NodeJS ➜ NodeJS # 2. 更新当前系统 ➜ NodeJS sudo apt update && sudo apt upgrade -y Hit:1 http://mirrors.tencentyun.com/ubuntu focal InRelease Hit:2 http://mirrors.tencentyun.com/ubuntu focal-updates InRelease Hit:3 http://mirrors.tencentyun.com/ubuntu focal-backports InRelease Hit:4 http://mirrors.tencentyun.com/ubuntu focal-security InRelease Hit:5 https://download.docker.com/linux/ubuntu focal InRelease Hit:6 https://packages.redis.io/deb focal InRelease Hit:7 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease Ign:8 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease Err:9 http://apt.postgresql.org/pub/repos/apt focal-pgdg Release 404 Not Found [IP: 198.18.0.8 80] Hit:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0 InRelease Reading package lists... Done E: The repository 'http://apt.postgresql.org/pub/repos/apt focal-pgdg Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. ➜ NodeJS ➜ NodeJS # 3. 安装升级工具 ➜ NodeJS sudo apt install update-manager-core -y Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libboost-filesystem1.71.0 libboost-iostreams1.71.0 libboost-program-options1.71.0 libgoogle-perftools4 libhiredis0.14 libjemalloc2 liblua5.1-0 libpcap0.8 libsnappy1v5 libtcmalloc-minimal4 libunwind8 libyaml-cpp0.6 lua-bitop lua-cjson Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: distro-info python3-distro-info python3-distupgrade python3-update-manager python3-yaml ubuntu-advantage-tools ubuntu-pro-client ubuntu-pro-client-l10n ubuntu-release-upgrader-core Suggested packages: shunit2 python3-launchpadlib The following NEW packages will be installed: distro-info python3-distro-info python3-distupgrade python3-update-manager python3-yaml ubuntu-advantage-tools ubuntu-pro-client ubuntu-pro-client-l10n ubuntu-release-upgrader-core update-manager-core 0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. Need to get 603 kB of archives. After this operation, 3,696 kB of additional disk space will be used. Get:1 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 python3-yaml amd64 5.3.1-1ubuntu0.1 [136 kB] Get:2 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 distro-info amd64 0.23ubuntu1.1 [17.1 kB] Get:3 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 ubuntu-pro-client amd64 36ubuntu0~20.04 [236 kB] Get:4 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 ubuntu-advantage-tools all 36ubuntu0~20.04 [11.0 kB] Get:5 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 ubuntu-pro-client-l10n amd64 36ubuntu0~20.04 [18.7 kB] Get:6 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 python3-distro-info all 0.23ubuntu1.1 [5,944 B] Get:7 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 python3-update-manager all 1:20.04.10.23 [38.5 kB] Get:8 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 python3-distupgrade all 1:20.04.41 [105 kB] Get:9 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 ubuntu-release-upgrader-core all 1:20.04.41 [24.3 kB] Get:10 http://mirrors.tencentyun.com/ubuntu focal-updates/main amd64 update-manager-core all 1:20.04.10.23 [11.6 kB] Fetched 603 kB in 0s (4,465 kB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package python3-yaml. (Reading database ... 38118 files and directories currently installed.) Preparing to unpack .../0-python3-yaml_5.3.1-1ubuntu0.1_amd64.deb ... Unpacking python3-yaml (5.3.1-1ubuntu0.1) ... Selecting previously unselected package distro-info. Preparing to unpack .../1-distro-info_0.23ubuntu1.1_amd64.deb ... Unpacking distro-info (0.23ubuntu1.1) ... Selecting previously unselected package ubuntu-pro-client. Preparing to unpack .../2-ubuntu-pro-client_36ubuntu0~20.04_amd64.deb ... Unpacking ubuntu-pro-client (36ubuntu0~20.04) ... Selecting previously unselected package ubuntu-advantage-tools. Preparing to unpack .../3-ubuntu-advantage-tools_36ubuntu0~20.04_all.deb ... Unpacking ubuntu-advantage-tools (36ubuntu0~20.04) ... Selecting previously unselected package ubuntu-pro-client-l10n. Preparing to unpack .../4-ubuntu-pro-client-l10n_36ubuntu0~20.04_amd64.deb ... Unpacking ubuntu-pro-client-l10n (36ubuntu0~20.04) ... Selecting previously unselected package python3-distro-info. Preparing to unpack .../5-python3-distro-info_0.23ubuntu1.1_all.deb ... Unpacking python3-distro-info (0.23ubuntu1.1) ... Selecting previously unselected package python3-update-manager. Preparing to unpack .../6-python3-update-manager_1%3a20.04.10.23_all.deb ... Unpacking python3-update-manager (1:20.04.10.23) ... Selecting previously unselected package python3-distupgrade. Preparing to unpack .../7-python3-distupgrade_1%3a20.04.41_all.deb ... Unpacking python3-distupgrade (1:20.04.41) ... Selecting previously unselected package ubuntu-release-upgrader-core. Preparing to unpack .../8-ubuntu-release-upgrader-core_1%3a20.04.41_all.deb ... Unpacking ubuntu-release-upgrader-core (1:20.04.41) ... Selecting previously unselected package update-manager-core. Preparing to unpack .../9-update-manager-core_1%3a20.04.10.23_all.deb ... Unpacking update-manager-core (1:20.04.10.23) ... Setting up distro-info (0.23ubuntu1.1) ... Setting up python3-yaml (5.3.1-1ubuntu0.1) ... Setting up python3-distro-info (0.23ubuntu1.1) ... Setting up ubuntu-pro-client (36ubuntu0~20.04) ... debconf: unable to initialize frontend: Dialog debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.) debconf: falling back to frontend: Readline Created symlink /etc/systemd/system/multi-user.target.wants/ua-reboot-cmds.service → /lib/systemd/system/ua-reboot-cmds.service. Created symlink /etc/systemd/system/timers.target.wants/ua-timer.timer → /lib/systemd/system/ua-timer.timer. Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-advantage.service → /lib/systemd/system/ubuntu-advantage.service. Setting up ubuntu-pro-client-l10n (36ubuntu0~20.04) ... Setting up ubuntu-advantage-tools (36ubuntu0~20.04) ... debconf: unable to initialize frontend: Dialog debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.) debconf: falling back to frontend: Readline Setting up python3-update-manager (1:20.04.10.23) ... Setting up python3-distupgrade (1:20.04.41) ... Setting up ubuntu-release-upgrader-core (1:20.04.41) ... Setting up update-manager-core (1:20.04.10.23) ... Processing triggers for man-db (2.9.1-1) ...
最新发布
11-13
Ubuntu上安装ufw,如果出现问题,可能是由于Python版本问题导致的。解决方法是将所需的包添加到当前系统版本的Python lib中。另外,在Ubuntu和CentOS上关闭防火墙的命令是不同的,需要注意。以下是几种关闭防火墙的方式: 1. 使用命令关闭防火墙: - 对于Ubuntu: sudo ufw disable - 对于CentOS: sudo systemctl stop firewalld 2. 安装桌面版: - 对于服务器版操作系统,可以通过安装桌面环境解决问题。首先安装桌面: sudo apt install ubuntu-gnome-desktop - 然后设置默认启动模式为多用户模式: sudo systemctl set-default multi-user.target - 最后启动桌面环境: startx 3. 使用VNC进行安装: 如果上述方法无效,您还可以尝试使用VNC来进行安装。首先安装VNC,并按照相应的步骤进行配置。 请根据您的具体情况选择适合的解决方案,并确保您在使用任何命令时都有足够的权限。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [python module ufw 即 ubuntu的防火墙遇到问题的包](https://download.youkuaiyun.com/download/m0_53011501/87121910)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [ubuntu虚拟机安装/配置vncserver](https://blog.youkuaiyun.com/aaalifu/article/details/126117474)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值