我正在尝试使用 NetworkManager 在 Linux 中配置 gsm 调制解调器连接。
该调制解调器的详细信息如下:
# mmcli -m 0
/org/freedesktop/ModemManager1/Modem/0 (device id 'f45005b4e117e9572228e3e57af4ead9cc620063')
-------------------------
Hardware | manufacturer: 'Sierra Wireless, Incorporated'
| model: 'MC7304'
| revision: 'SWI9X15C_05.05.58.00 r27038 carmd-fwbuild1 2015/03/04 21:30:23'
| supported: 'gsm-umts
| lte
| gsm-umts, lte'
| current: 'gsm-umts, lte'
| equipment id: '356853056005343'
-------------------------
System | device: '/sys/devices/platform/ocp/47400000.usb/47401400.usb/musb-hdrc.0.auto/usb1/1-1'
| drivers: 'option1, qmi_wwan'
| plugin: 'Generic'
| primary port: 'cdc-wdm0'
| ports: 'ttyUSB0 (qcdm), ttyUSB2 (at), cdc-wdm0 (qmi), wwan0 (net)'
-------------------------
Numbers | own : 'unknown'
-------------------------
Status | lock: 'sim-pin'
| unlock retries: 'sim-pin (3), sim-pin2 (0), sim-puk (10), sim-puk2 (10)'
| state: 'locked'
| power state: 'on'
| access tech: 'unknown'
| signal quality: '0' (cached)
-------------------------
Modes | supported: 'allowed: 2g, 3g, 4g; preferred: none'
| current: 'allowed: 2g, 3g, 4g; preferred: none'
-------------------------
Bands | supported: 'cdma-bc15-aws, dcs, egsm, pcs, g850, u2100, u1900, u800, u850, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
| current: 'cdma-bc15-aws, dcs, egsm, pcs, g850, u2100, u1900, u850, u900, eutran-i, eutran-iii, eutran-vii, eutran-viii, eutran-xx'
-------------------------
IP | supported: 'ipv4, ipv6, ipv4v6'
-------------------------
SIM | path: '/org/freedesktop/ModemManager1/SIM/0'
-------------------------
Bearers | paths: 'none'
然后我尝试按如下方式添加连接:
# nmcli c add save yes type gsm ifname cdc-wdm0 con-name gsm autoconnect yes apn gprs.swisscom.ch user gprs password gprs
Connection 'gsm' (7acbdf27-9854-4f5a-a5d4-dbfde55e79a3) successfully added.
# nmcli c modify gsm gsm.pin ****
然后我验证该连接是否已经注册:
# nmcli con
NAME UUID TYPE DEVICE
gsm 7acbdf27-9854-4f5a-a5d4-dbfde55e79a3 gsm --
Wired connection 2 5059a1aa-9674-4e9f-8a6d-5ef5c5fb4389 802-3-ethernet --
Wired connection 1 76533211-9c38-411d-8e73-c0e2d58a267a 802-3-ethernet eth0
然后我尝试连接:
# nmcli c up gsm
Error: Connection activation failed: Connection 'gsm' is not available on the device cdc-wdm0 at this time.
以下是生成的日志条目:
Feb 27 15:27:29 amg NetworkManager[286]: <info> Auto-activating connection 'gsm'.
Feb 27 15:27:29 amg NetworkManager[286]: <info> Activation (cdc-wdm0) starting connection 'gsm'
Feb 27 15:27:29 amg NetworkManager[286]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) scheduled...
Feb 27 15:27:29 amg NetworkManager[286]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) started...
Feb 27 15:27:29 amg NetworkManager[286]: <info> (cdc-wdm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
Feb 27 15:27:29 amg NetworkManager[286]: <info> (cdc-wdm0): device state change: prepare -> need-auth (reason 'none') [40 60 0]
Feb 27 15:27:29 amg NetworkManager[286]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) complete.
Feb 27 15:27:29 amg NetworkManager[286]: <warn> No agents were available for this request.
Feb 27 15:27:29 amg NetworkManager[286]: <info> (cdc-wdm0): device state change: need-auth -> failed (reason 'no-secrets') [60 120 7]
Feb 27 15:27:29 amg NetworkManager[286]: <warn> Activation (cdc-wdm0) failed for connection 'gsm'
Feb 27 15:27:29 amg NetworkManager[286]: ** (NetworkManager:286): CRITICAL **: mm_modem_simple_disconnect: assertion 'MM_IS_MODEM_SIMPLE (self)' failed
Feb 27 15:27:29 amg NetworkManager[286]: <info> (cdc-wdm0): device state change: failed -> disconnected (reason 'none') [120 30 0]
Feb 27 15:27:29 amg NetworkManager[286]: <info> (cdc-wdm0): deactivating device (reason 'none') [0]
Feb 27 15:28:05 amg NetworkManager[286]: <warn> Failed to activate 'gsm': Connection 'gsm' is not available on the device cdc-wdm0 at this time.
出了什么问题?我配置错误了吗?还是需要额外的步骤?我该如何进一步调查出了什么问题?
看来这条线是一个线索:** (NetworkManager:286): CRITICAL **: mm_modem_simple_disconnect: assertion 'MM_IS_MODEM_SIMPLE (self)' failed
,但我不确定这是什么意思。
任何帮助将不胜感激。
答案1
我来晚了(解决相关问题),但上面的打印输出中似乎 SIM 卡已被锁定:
Status | lock: 'sim-pin'
| unlock retries: 'sim-pin (3), sim-pin2 (0), sim-puk (10), sim-puk2 (10)'
| state: 'locked' <-- there
| power state: 'on'
| access tech: 'unknown'
| signal quality: '0' (cached)
解决此问题的一种方法是让网络管理员自动将 PIN 发送到调制解调器/SIM 卡。以下是来自此站点的一个例子但你应该明白:
nmcli c add type gsm ifname <interface> con-name <name> apn <operator_apn> username <user> password <password> pin <PIN>
我已将 /etc/NetworkManager/system-connections/ 中的连接文件编辑为如下内容:
# This is from the middle of the file, and contains data relevant to my ISP
[gsm]
apn=online.telia.se
number=*99#
pin=1234