![如何使用调制解调器管理器而不是网络管理器访问互联网](https://linux22.com/image/70456/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E8%B0%83%E5%88%B6%E8%A7%A3%E8%B0%83%E5%99%A8%E7%AE%A1%E7%90%86%E5%99%A8%E8%80%8C%E4%B8%8D%E6%98%AF%E7%BD%91%E7%BB%9C%E7%AE%A1%E7%90%86%E5%99%A8%E8%AE%BF%E9%97%AE%E4%BA%92%E8%81%94%E7%BD%91.png)
我最近买了一个 tata docomo dongle。
插入它后,我得到了以下详细信息:-
Aug 05 17:30:46 think-debian kernel: usb 1-2: new high-speed USB device number 5 using xhci_hcd
Aug 05 17:30:46 think-debian kernel: usb 1-2: New USB device found, idVendor=12d1, idProduct=1f01
Aug 05 17:30:46 think-debian kernel: usb 1-2: New USB device strings: Mfr=3, Product=2, SerialN
Aug 05 17:30:46 think-debian kernel: usb 1-2: Product: HUAWEI Mobile
Aug 05 17:30:46 think-debian kernel: usb 1-2: Manufacturer: Huawei Technologies
Aug 05 17:30:47 think-debian mtp-probe[2824]: checking bus 1, device 5: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2"
Aug 05 17:30:47 think-debian mtp-probe[2824]: bus: 1, device: 5 was not an MTP device
Aug 05 17:30:47 think-debian systemd[1]: Created slice system-usb_modeswitch.slice.
Aug 05 17:30:47 think-debian systemd[1]: Starting USB_ModeSwitch__1-2:1.0...
Aug 05 17:30:47 think-debian laptop-mode[2880]: Laptop mode
Aug 05 17:30:47 think-debian laptop-mode[2881]: enabled, active
Aug 05 17:30:48 think-debian kernel: usb-storage 1-2:1.0: USB Mass Storage device detected
Aug 05 17:30:48 think-debian kernel: scsi host3: usb-storage 1-2:1.0
Aug 05 17:30:48 think-debian kernel: usbcore: registered new interface driver usb-storage
Aug 05 17:30:48 think-debian kernel: usbcore: registered new interface driver uas
Aug 05 17:30:48 think-debian usb_modeswitch[2910]: switch device 12d1:1f01 on 001/005
Aug 05 17:30:49 think-debian kernel: usb 1-2: USB disconnect, device number 5
Aug 05 17:30:58 think-debian kernel: usb 1-2: new high-speed USB device number 6 using xhci_hcd
Aug 05 17:30:58 think-debian kernel: usb 1-2: New USB device found, idVendor=12d1, idProduct=14db
Aug 05 17:30:58 think-debian kernel: usb 1-2: New USB device strings: Mfr=4, Product=3, SerialNumber=0
Aug 05 17:30:58 think-debian kernel: usb 1-2: Product: HUAWEI Mobile
Aug 05 17:30:58 think-debian kernel: usb 1-2: Manufacturer: Huawei Technologies
Aug 05 17:30:58 think-debian mtp-probe[2921]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2"
Aug 05 17:30:58 think-debian mtp-probe[2921]: bus: 1, device: 6 was not an MTP device
Aug 05 17:30:58 think-debian laptop-mode[2997]: Laptop mode
Aug 05 17:30:58 think-debian laptop-mode[2998]: enabled, active
Aug 05 17:30:58 think-debian laptop-mode[3036]: Laptop mode
Aug 05 17:30:58 think-debian laptop-mode[3037]: enabled, active
Aug 05 17:30:58 think-debian kernel: cdc_ether 1-2:1.0 eth1: register 'cdc_ether' at usb-0000:00:14.0-2, CDC Ethernet Device, 00:a0:c6:09:5c:40
Aug 05 17:30:58 think-debian kernel: usbcore: registered new interface driver cdc_ether
Aug 05 17:30:58 think-debian kernel: cdc_ether 1-2:1.0 enx00a0c6095c40: renamed from eth1
Aug 05 17:30:58 think-debian root[3105]: usb_modeswitch: switched to 12d1:14db on 001/006
Aug 05 17:30:58 think-debian systemd[1]: Started USB_ModeSwitch__1-2:1.0.
Aug 05 17:31:01 think-debian ModemManager[1276]: <info> Couldn't find support for device at '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2': not supported by any plugin
Aug 05 17:32:24 think-debian kernel: usb 1-1: new low-speed USB device number 7 using xhci_hcd
Aug 05 17:32:24 think-debian kernel: usb 1-1: New USB device found, idVendor=192f, idProduct=0916
Aug 05 17:32:24 think-debian kernel: usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Aug 05 17:32:24 think-debian kernel: usb 1-1: Product: USB Optical Mouse
Aug 05 17:32:24 think-debian kernel: usb 1-1: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
Aug 05 17:32:24 think-debian mtp-probe[3112]: checking bus 1, device 7: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1"
Aug 05 17:32:24 think-debian mtp-probe[3112]: bus: 1, device: 7 was not an MTP device
Aug 05 17:32:24 think-debian laptop-mode[3162]: Laptop mode
Aug 05 17:32:24 think-debian laptop-mode[3163]: enabled, active
同样的情况lsusb
也得到了证实:-
Bus 003 Device 002: ID 8087:8000 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 04f2:b39a Chicony Electronics Co., Ltd
Bus 001 Device 003: ID 8087:07dc Intel Corp.
Bus 001 Device 002: ID 138a:0017 Validity Sensors, Inc.
Bus 001 Device 006: ID 12d1:1f01 Huawei Technologies Co., Ltd.
Bus 001 Device 005: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
然后我尝试使用这两个命令https://askubuntu.com/questions/78164/configuring-tata-photon-usb-modem-huawei-ec156作为基础。我在 Debian 上;-
sudo modprobe usbserial vendor=0x12d1 product=0x14db
sudo usb_modeswitch -v 0x12d1 -p 0x14db -H -W
以下是输出:-
Take all parameters from the command line
* usb_modeswitch: handle USB devices with multiple modes
* Version 2.2.5 (C) Josua Dietze 2015
* Based on libusb1/libusbx
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x12d1
DefaultProduct= 0x14db
HuaweiMode=1
NeedResponse=0
ifconfig -a
给出:-
xxxxxxxxxx Link encap:Ethernet HWaddr xx:xx:xx:xx:xx
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:20 Memory:e0600000-e0620000
eth0:avahi Link encap:Ethernet HWaddr xx:xx:xx:xx:xx
inet addr:169.254.7.244 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:e0600000-e0620000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:468 errors:0 dropped:0 overruns:0 frame:0
TX packets:468 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:44602 (43.5 KiB) TX bytes:44602 (43.5 KiB)
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
第一个ifconfig -a
是我分享的 USB 加密狗xxxxxx。
这是我可以通过的最新信息sudo journalctl -f
Aug 07 12:17:06 think-debian kernel: usb 1-1: new high-speed USB device number 11 using xhci_hcd
Aug 07 12:17:06 think-debian kernel: usb 1-1: New USB device found, idVendor=12d1, idProduct=1f01
Aug 07 12:17:06 think-debian kernel: usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Aug 07 12:17:06 think-debian kernel: usb 1-1: Product: HUAWEI Mobile
Aug 07 12:17:06 think-debian kernel: usb 1-1: Manufacturer: Huawei Technologies
Aug 07 12:17:06 think-debian kernel: usb-storage 1-1:1.0: USB Mass Storage device detected
Aug 07 12:17:06 think-debian kernel: scsi host6: usb-storage 1-1:1.0
Aug 07 12:17:06 think-debian mtp-probe[3600]: checking bus 1, device 11: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1"
Aug 07 12:17:06 think-debian mtp-probe[3600]: bus: 1, device: 11 was not an MTP device
Aug 07 12:17:06 think-debian systemd[1]: Starting USB_ModeSwitch__1-1:1.0...
Aug 07 12:17:07 think-debian usb_modeswitch[3656]: switch device 12d1:1f01 on 001/011
Aug 07 12:17:08 think-debian kernel: usb 1-1: USB disconnect, device number 11
Aug 07 12:17:16 think-debian kernel: usb 1-1: new high-speed USB device number 12 using xhci_hcd
Aug 07 12:17:16 think-debian kernel: usb 1-1: New USB device found, idVendor=12d1, idProduct=14db
Aug 07 12:17:16 think-debian kernel: usb 1-1: New USB device strings: Mfr=4, Product=3, SerialNumber=0
Aug 07 12:17:16 think-debian kernel: usb 1-1: Product: HUAWEI Mobile
Aug 07 12:17:16 think-debian kernel: usb 1-1: Manufacturer: Huawei Technologies
Aug 07 12:17:16 think-debian kernel: cdc_ether 1-1:1.0 eth1: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, xx:xx:xx:xx:xx
Aug 07 12:17:16 think-debian mtp-probe[3684]: checking bus 1, device 12: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1"
Aug 07 12:17:16 think-debian mtp-probe[3684]: bus: 1, device: 12 was not an MTP device
Aug 07 12:17:16 think-debian kernel: cdc_ether 1-1:1.0 xxxxxxxxx: renamed from eth1
Aug 07 12:17:17 think-debian root[3788]: usb_modeswitch: switched to 12d1:14db on 001/012
Aug 07 12:17:17 think-debian systemd[1]: Started USB_ModeSwitch__1-1:1.0.
Aug 07 12:17:19 think-debian ModemManager[1372]: <info> Couldn't find support for device at '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1': not supported by any plugin
似乎需要调制解调器管理器的东西。有什么帮助吗?
这是我的/etc/network/interfaces
输出:-
$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
所以 eth0 已经被分配/占用用于有线接口。
route
给出这个:-
$ sudo route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default * 0.0.0.0 U 1002 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
更新 - 我更新了 usbids,现在列表比以前好得多:-
$ lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 004: ID 04f2:b39a Chicony Electronics Co., Ltd
Bus 002 Device 003: ID 8087:07dc Intel Corp.
Bus 002 Device 002: ID 138a:0017 Validity Sensors, Inc. Fingerprint Reader
Bus 002 Device 009: ID 192f:0916 Avago Technologies, Pte.
Bus 002 Device 007: ID 12d1:14db Huawei Technologies Co., Ltd. E353/E3131
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
现在我正在使用网络管理器,但我希望调制解调器管理器进行所需的更改。
答案1
ModemManager(当前)仅适用于至少公开的调制解调器设备1个控制端口。您的华为设备看起来是基于 HiLink 的设备,它仅通过以下方式公开以太网网络接口cdc_ether
:在该模式下连接该设备的唯一方法就是在其上运行 DHCP 客户端(例如,配置 NetworkManager 以在该特定接口上尝试动态 IP 寻址)。一旦完成,您将获得例如在该网络接口中设置的IP地址,以及到(调制解调器中的虚拟网关)192.168.8.2
的默认路由。192.168.8.1
我之前说“当前”是因为HiLink设备确实有一个控制接口;连接网络接口后,192.168.8.1
调制解调器本身就会显示一个网站,其中包含 Web 服务 API,允许监控信号质量等。 ModemManager 中正在进行一些工作来支持这种管理,但还没有准备好。
答案2
我觉得这个官方在 Linux 上使用 Tata Indicom 手机/USB 调制解调器指南(五页 PDF)将为您提供帮助。