GordonWei's Blog


[Linux]在Ubuntug上使用華為E3372



最近在研究把4G LTE Dongle當作備援線路。
接上Dongle後,下指令看系統是否有偵測到。

~# lsusb
若有偵測到則出現下方訊息
Bus 002 Device 003: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)
接著要抓Vendor跟Product的ID。
~# dmesg
這邊僅擷取要知道的地方
[759231.923061] usb 2-1.1: New USB device found, idVendor=12d1, idProduct=1f01
因為目前Dongle是以USB Storage的方式被辨認,所以我們就要將其轉換成USB Modem。
先安裝套件:
apt-get install usb-modeswitch
安裝完後我們先手動切換看看。
~# usb_modeswitch -J -v 0x12d1 -p 0x1f01
feedback
Look for default devices ...
   product ID matched
 Found devices in default mode (1)
Access device 003 on bus 002
Current configuration number is 1
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI_MOBILE
     Product: HUAWEI_MOBILE
  Serial No.: 0123456789ABCDEF
-------------------------
Using standard Huawei switching message
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reset response endpoint 0x81
Reset message endpoint 0x01
-> Run lsusb to note any changes. Bye!

原本以為重開機後就要重新設定或者是要寫一個檔案讓系統自動抓。
但重開後發現系統會自動偵測為網路卡,如下:
~# ifconfig -a 

enp2s0    Link encap:Ethernet  HWaddr 74:d4:35:23:50:67
          inet addr:192.168.101.149  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::76d4:35ff:fe23:5067/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:610 errors:0 dropped:18 overruns:0 frame:0
          TX packets:252 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:305577 (305.5 KB)  TX bytes:29865 (29.8 KB)

enx0c5b8f279a64 Link encap:Ethernet  HWaddr 0c:5b:8f:27:9a:64
          inet addr:192.168.8.100  Bcast:192.168.8.255  Mask:255.255.255.0
          inet6 addr: fe80::22c3:7995:7c20:d96e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6197 (6.1 KB)  TX bytes:9527 (9.5 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:436 (436.0 B)  TX bytes:436 (436.0 B)
但發現Dongle本身就會做一次DHCP,有空再繼續研究要如何將其disable。

以上文章皆是原創(廣告文除外),轉載前請先來信通知,本人同意後方可轉載,謝謝!

文章分類:Linux


blog comments powered by Disqus

© 2019 www.kmp.tw