介紹瞭如何在linux環境下面使用電信3G卡,涉及相關驅動載入,常見錯誤debug以及相關配置.
工具/原料
中國電信3G卡
系統:CentOS 6.5
驅動:HW_Linux_Driver_4.19.19.00.tar.gz
方法/步驟
A.插卡後,執行 lsub 去檢查是否載入
B.然後檢視 /dev/ 下面有沒有 ttyU* 資訊,如果沒有的話需要安裝驅動
C.驅動安裝 [HuaWei_Datacard_linux_4.19.19.00.zip --> HW_Linux_Driver_4.19.19.00.tar.gz ]
1.解壓 tar zxvf HW_Linux_Driver_4.19.19.00.tar.gz
注意: 安裝的時候路徑如下 /tmp/keyring-5CJvtT/HW/ 會報錯 必須去掉後面的 '/'
[[email protected] driver]# ./install /tmp/keyring-5CJvtT/HW
D.lsusb 重新檢視 以及 /dev/ttyU* 檔案 ,如果有如下檔案 說明驅動安裝成功
E.撥號.
E-1.檢測硬體
[[email protected] driver]# wvdialconf tee logfile
Editing `/etc/wvdial.conf'.
Scanning your serial ports for a modem.
Modem Port Scan<*1>: S0 S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyUSB_utps_diag<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB_utps_diag<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB_utps_diag<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
WvModem<*1>: Cannot get information for serial port.
ttyUSB_utps_modem<*1>: ATQ0 V1 E1 -- OK
ttyUSB_utps_modem<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB_utps_modem<*1>: Modem Identifier: ATI -- Manufacturer: I:QualComm
ttyUSB_utps_modem<*1>: Speed 9600: AT -- OK
ttyUSB_utps_modem<*1>: Max speed is 9600; that should be safe.
ttyUSB_utps_modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
WvModem<*1>: Cannot get information for serial port.
ttyUSB_utps_ndis<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB_utps_ndis<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB_utps_ndis<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
WvModem<*1>: Cannot get information for serial port.
ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 -- OK
ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB_utps_pcui<*1>: Modem Identifier: ATI -- Manufacturer: I:QualComm
ttyUSB_utps_pcui<*1>: Speed 9600: AT -- OK
ttyUSB_utps_pcui<*1>: Max speed is 9600; that should be safe.
ttyUSB_utps_pcui<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
Found a modem on /dev/ttyUSB_utps_modem.
Modem configuration written to /etc/wvdial.conf.
ttyUSB_utps_modem
ttyUSB_utps_pcui
E-3.如直接撥號,會提示賬戶未設定.
E-3.配置賬號資訊
編輯:/etc/wvdial.conf
E-4.開始撥號[建議重新插拔一下3G卡]
[[email protected] ~]# wvdial
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}!}!} }9}"}&} } } } }#}%B#}%}%}&fYN0}'}"}(}"b[05]~
--> PPP negotiation detected.
--> Starting pppd at Tue Jun 25 15:59:20 2013
--> Pid of pppd: 10334
--> Using interface ppp0
--> pppd: 6
--> pppd: 6
--> pppd: 6
--> pppd: 6
--> local IP address 119.143.146.95
--> pppd: 6
--> remote IP address 115.168.82.165
--> pppd: 6
--> primary DNS address 202.96.128.86
--> pppd: 6
--> secondary DNS address 202.96.134.133
--> pppd: 6
F.狀態檢查 okay (檢視是否能獲取到一個外部IP),然後隨便ping一個網站,比如 ping baidu.com
掉線自動重撥
--> 自動重撥機制 5s
--> Disconnecting at Tue Jun 25 16:06:10 2013
--> The PPP daemon has died: A modem hung up the phone (exit code = 16)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.
--> Auto Reconnect will be attempted in 5 seconds
注意事項
1.注意撥號資訊的配置(phone:#777 , username=card , password=card)
2.需要注意驅動是否載入