[Others] 有线网无线网同时连接后的优先级问题
Tofloor
poster avatar
scy0213
deepin
2021-01-22 01:22
Author

能不能改成有线网优先啊或者有没有这选项,这一连无线就优先无线网了,想让有线网优先,这样笔记本一拔网线还能基本无缝使用网络

Reply Favorite View the author
All Replies
from-mail_1xx-xxxx-007
deepin
2021-01-22 06:23
#1

来自NetworkManager - ArchWiki的一段介绍:

NetworkManager also prefers wired connections over wireless ones, has support for modem connections and certain types of VPN.                        #NetworkManager (简体中文) - ArchWiki内容有点老,遂取自英文Wiki。

Reply View the author
from-mail_1xx-xxxx-007
deepin
2021-01-22 06:33
#2

Use dispatcher to automatically toggle wireless depending on LAN cable being plugged in

The idea is to only turn Wi-Fi on when the LAN cable is unplugged (for example when detaching from a laptop dock), and for Wi-Fi to be automatically disabled, once a LAN cable is plugged in again.

Create the following dispatcher script[6], replacing LAN_interface with yours.

/etc/NetworkManager/dispatcher.d/wlan_auto_toggle.sh
#!/bin/sh

if [ "$1" = "LAN_interface" ]; then
    case "$2" in
        up)
            nmcli radio wifi off
            ;;
        down)
            nmcli radio wifi on
            ;;
    esac
fi
Note: You can get a list of interfaces using nmcli. The ethernet (LAN) interfaces start with en, e.g. enp0s5

 

Reply View the author