求助:Fedora 37 连接小米 Redmi AX6S 路由器的无线网后网络连接状态显示”问号“是什么情况?

Screenshot from 2023-02-19 22-42-39

操作系统: Fedora 37

路由器:小米 Redmi AX6S

这个状态下只在 dnf 安装或更新时出现:

[xueshumeng@MiWiFi-RB03-srv nce]$ sudo dnf update -y
[sudo] password for xueshumeng:
Fedora 37 - x86_64 - Updates                                                                                                                                                                                                                                                                                                                                                                            0.0  B/s |   0  B     00:07
Errors during downloading metadata for repository 'updates':
  - Curl error (35): SSL connect error for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f37&arch=x86_64 [OpenSSL SSL_connect: Connection reset by peer in connection to mirrors.fedoraproject.org:443 ]
Error: Failed to download metadata for repo 'updates': Cannot prepare internal mirrorlist: Curl error (35): SSL connect error for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f37&arch=x86_64 [OpenSSL SSL_connect: Connection reset by peer in connection to mirrors.fedoraproject.org:443 ]

别的网络都可以正常访问。

连接公司的 WIFI 和手机热点时都没有出现过这样的问题。

连上了这个WiFi,但好像无法用这个WiFi连接到互联网。

建议用别的设备连接手机热点,看看能否联网,来确认是手机问题还是电脑问题。

1 个赞

我又补充了下问题的描述。

有没有手动设置 dns 之类的

1 个赞

终端输入:NetworkManager --print-config 会显示测试网络联通性的 url,我的是:https://fedoraproject.org/static/hotspot.txt

你在浏览器里面看看这个地址能不能手动连上,如果不能,那恐怕是哪里被墙了。

2 个赞

没有修改过,包括路由器的设置和笔记本系统设置里的 DNS。

[xueshumeng@fedora math]$ NetworkManager --print-config
# NetworkManager configuration: /etc/NetworkManager/NetworkManager.conf (lib: 20-connectivity-fedora.conf) (run: 15-carrier-timeout.conf)

[main]
# plugins=
# rc-manager=auto
# auth-polkit=true
# dhcp=internal
# iwd-config-path=
configure-and-quit=no

[connectivity]
enabled=true
uri=http://fedoraproject.org/static/hotspot.txt
response=OK
interval=300

[logging]
# backend=journal
# audit=false

[device]
# wifi.backend=wpa_supplicant

# no-auto-default file "/var/lib/NetworkManager/no-auto-default.state"
[xueshumeng@fedora math]$ 
[xueshumeng@fedora math]$ curl http://fedoraproject.org/static/hotspot.txt
curl: (56) Recv failure: Connection reset by peer

访问不到,是不是可以修改一下这个 URL?

结合 man NetworkManager.conf 手册中的下面章节,在 /etc/NetworkManager/conf.d 中添加文件 connectivity.conf,解决了我的问题:

CONNECTIVITY SECTION
       This section controls NetworkManager's optional connectivity checking functionality. This allows NetworkManager to detect whether or not the system can actually access the internet or whether it is
       behind a captive portal.

       Connectivity checking serves two purposes. For one, it exposes a connectivity state on D-Bus, which other applications may use. For example, Gnome's portal helper uses this as signal to show a
       captive portal login page. The other use is that default-route of devices without global connectivity get a penalty of +20000 to the route-metric. This has the purpose to give a better default-route
       to devices that have global connectivity. For example, when being connected to WWAN and to a Wi-Fi network which is behind a captive portal, WWAN still gets preferred until login.

       Note that your distribution might set /proc/sys/net/ipv4/conf/*/rp_filter to strict filtering. That works badly with per-device connectivity checking, which uses SO_BINDDEVICE to send requests on
       all devices. A strict rp_filter setting will reject any response and the connectivity check on all but the best route will fail.

       enabled
           Whether connectivity check is enabled. Note that to enable connectivity check, a valid uri must also be configured. The value defaults to true, but since the uri is unset by default,
           connectivity check may be disabled. The main purpose of this option is to have a single flag to disable connectivity check. Note that this setting can also be set via D-Bus API at runtime. In
           that case, the value gets stored in /var/lib/NetworkManager/NetworkManager-intern.conf file.

       uri
           The URI of a web page to periodically request when connectivity is being checked. This page should return the header "X-NetworkManager-Status" with a value of "online". Alternatively, its body
           content should be set to "NetworkManager is online". The body content check can be controlled by the response option. If this option is blank or missing, connectivity checking is disabled.

       interval
           Specified in seconds; controls how often connectivity is checked when a network connection exists. If set to 0 connectivity checking is disabled. If missing, the default is 300 seconds.

       response
           If set, controls what body content NetworkManager checks for when requesting the URI for connectivity checking. Note that this only compares that the HTTP response starts with the specifid text,
           it does not compare the exact string. This behavior might change in the future, so avoid relying on it. If missing, the response defaults to "NetworkManager is online". If set to empty, the HTTP
           server is expected to answer with status code 204 or send no data.

connectivity.conf 文件内容:

[connectivity]
enabled=true
uri=http://nmcheck.gnome.org/check_network_status.txt
response=NetworkManager is online
interval=3000

像上面这样的方法只是解决网络连接状态图标显示为「问号」的问题,DNF 操作时的网络连接错误问题我通过把镜像源替换为科大的镜像来解决。

还有没有更优雅的方法?给所有访问 Fedora 站点的连接加上代理?

http://blog.xueshumeng.online/linux-gnome-networkmanager-question.html

要实现这种程度的配置的话只能在路由器上做透明代理了吧?毕竟在本机上设置环境变量无法覆盖所有应用。

我觉得还是排查一下网络问题比较好,刚刚我用站长工具测试了 fedora 的站点,国内各地应该都是能访问的,很可能是你的 DNS 服务器有问题。

1 个赞

谢谢你的回答,目前宿舍里的网络我控制不了。暂时这样处理吧。