移远官网

Quectel_QConnectManager未创建默认路由

使用拨号软件拨号,第一次不会添加默认路由

root@zy-pve:~# ip route
10.28.152.36/30 dev wwan0 proto kernel scope link src 10.28.152.38 
192.168.1.0/24 dev vmbr0 proto kernel scope link src 192.168.1.1 

第一次拨号的部分日志

[09-26_13:41:52:193] ip addr flush dev wwan0
[09-26_13:41:52:196] ip link set dev wwan0 down
[09-26_13:41:52:601] requestSetupDataCall WdsConnectionIPv4Handle: 0xe24742b0
[09-26_13:41:52:696] requestSetupDataCall WdsConnectionIPv6Handle: 0xe2697040
[09-26_13:41:52:857] ip link set dev wwan0 up
[09-26_13:41:52:860] busybox udhcpc -f -n -q -t 5 -i wwan0
[09-26_13:41:52:866] Clearing IP addresses on wwan0, upping it
[09-26_13:42:08:131] File:ql_raw_ip_mode_check Line:147 udhcpc fail to get ip address, try next:
[09-26_13:42:08:131] ip link set dev wwan0 down
[09-26_13:42:08:135] echo Y > /sys/class/net/wwan0/qmi/raw_ip
[09-26_13:42:08:136] ip link set dev wwan0 up
[09-26_13:42:08:139] busybox udhcpc -f -n -q -t 5 -i wwan0
[09-26_13:42:08:143] Clearing IP addresses on wwan0, upping it
[09-26_13:42:08:253] Setting IP address 10.28.152.38 on wwan0
[09-26_13:42:08:255] Deleting routers
[09-26_13:42:08:255] Adding router 10.28.152.37
[09-26_13:42:08:258] Recreating /etc/resolv.conf
[09-26_13:42:08:258]  Adding DNS server 223.87.253.100
[09-26_13:42:08:258]  Adding DNS server 223.87.253.253
[09-26_13:42:08:290] Warning: No route items found for wwan0
[09-26_13:42:08:290] ip -6 address flush dev wwan0
[09-26_13:42:08:294] ip -6 address add 2409:8962:249:4a2:d5d:f6a8:b50d:631b/64 dev wwan0
[09-26_13:42:08:297] ip -6 route add default dev wwan0

第二次重新拨号,可以添加默认路由了

root@zy-pve:~# ip route
default via 10.77.27.221 dev wwan0 
10.77.27.216/29 dev wwan0 proto kernel scope link src 10.77.27.220 
192.168.1.0/24 dev vmbr0 proto kernel scope link src 192.168.1.1

第二次重新拨号的部分日志

[09-26_13:42:57:960] ip addr flush dev wwan0
[09-26_13:42:57:963] ip link set dev wwan0 down
[09-26_13:42:58:312] requestSetupDataCall WdsConnectionIPv4Handle: 0xe24742b0
[09-26_13:42:58:408] requestSetupDataCall WdsConnectionIPv6Handle: 0xe250eba0
[09-26_13:42:58:568] ip link set dev wwan0 up
[09-26_13:42:58:572] busybox udhcpc -f -n -q -t 5 -i wwan0
[09-26_13:42:58:575] Clearing IP addresses on wwan0, upping it
[09-26_13:42:58:684] Setting IP address 10.77.27.220 on wwan0
[09-26_13:42:58:687] Deleting routers
[09-26_13:42:58:697] Adding router 10.77.27.221
[09-26_13:42:58:699] Recreating /etc/resolv.conf
[09-26_13:42:58:700]  Adding DNS server 223.87.253.100
[09-26_13:42:58:700]  Adding DNS server 223.87.253.253
[09-26_13:42:58:727] ip -6 address flush dev wwan0
[09-26_13:42:58:730] ip -6 address add 2409:8963:28b:ff50:bc6a:7c33:d97f:edc4/64 dev wwan0
[09-26_13:42:58:733] ip -6 route add default dev wwan0

两次日志的差异在于第一次有这个警告

[09-26_13:42:08:290] Warning: No route items found for wwan0

测试平台:Proxmox VE 7.4-1
内核版本:Linux zy-pve 5.15.102-1-pve #1 SMP PVE 5.15.102-1 (2023-03-14T13:48Z) x86_64 GNU/Linux
5G模块:RM520N
驱动:Quectel_Linux_Android_QMI_WWAN_Driver_V1.2.6
拨号软件:Quectel_QConnectManager_Linux_V1.6.5

这一步的时候就会自动添加路由。
如果没添加请检查下udhcpc 的脚本。

问题解决了,把

route add default gw $i dev $interface metric $((metric++))

改成

/sbin/route add default gw $i dev $interface metric $((metric++))

多测试下

看起来不太像。
/sbin/ 是在PATH里的。
应该是这里的逻辑的问题