zoukankan      html  css  js  c++  java
  • Linux 天翼3G上网

    华为EC122
    硬件信息如下:
    $ lsusb | grep -i Huawei
    Bus 003 Device 006: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem
    $
    这个3G网卡支持中国电信天翼3G标准CDMA2000 ,下载内核网速刚开始为40K/S,然后彪到了200K+/S (不是在做广告……)

    笔者使用软件平台为Debian5.02,系统具体参数为
    $ cat /proc/version 
    Linux version 2.6.26-2-686 (Debian 2.6.26-19) (dannf@debian.org) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Wed Aug 19 06:06:52 UTC 2009


    1. 安装驱动

    插入3G网卡到USB接口后,GNU/Linux识别该硬件,自动将其挂载到 /media/ChinaTelecom 目录下
    $ pwd
    /media/ChinaTelecom
    $ ls -F
    AutoRun.exe*  autorun.inf*  autorun.sh*     Linux/  SysConfig.dat*
    autorun.ico*  autorun.ini*  install_linux*  setup/
    $ ./install_linux 
    这样,驱动就安装好了……快吧

    2. 配置拨号上网

    笔者喜欢用 wvdial 同时管理 “3G、连手机蓝牙、连手机USB” 3种拨号方式 ,所以下面介绍用 wvdial 3G拨号及其配置过程

    先介绍配置过程:
    插入3G网卡到USB接口后,待其识别该硬件,运行
    $ sudo wvdialconf
    [sudo] password for c-aries: 
    Editing `/etc/wvdial.conf'.

    Scanning your serial ports for a modem.

    ... (省略)

    Found a modem on /dev/ttyUSB_utps_modem.
    Modem configuration written to /etc/wvdial.conf.
    ttyUSB_utps_modem<Info>: Speed 115200; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
    ttyUSB_utps_pcui<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

    这里默认配置已写入文件 /etc/wvdial.conf 如下
    $ cat /etc/wvdial.conf
    [Dialer Defaults]
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    Modem Type = Analog Modem
    ; Phone = <Target Phone Number>
    ISDN = 0
    ; Username = <Your Login Name>
    Init1 = ATZ
    ; Password = <Your Password>
    Modem = /dev/ttyUSB_utps_modem
    Baud = 115200
    修改成
    $ cat /etc/wvdial.conf
    [Dialer 3G]
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    Modem Type = Analog Modem
    Phone = #777
    ISDN = 0
    Username = ctnet@mycdma.cn
    Init1 = ATZ
    Password = vnet.mobi
    Modem = /dev/ttyUSB_utps_modem
    Baud = 115200

    拨号运行命令
    $ sudo wvdial 3g
    --> 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]}#@!}!}!} }5}"}&} } } } }#}%B#}%}%}&&qe8@F~
    --> PPP negotiation detected.
    --> Starting pppd at Sun Mar  7 09:44:49 2010
    --> Pid of pppd: 26853
    --> Using interface ppp0
    --> pppd: ≒s HPs 
    --> pppd: ≒s HPs 
    --> pppd: ≒s HPs 
    --> pppd: ≒s HPs 
    --> pppd: ≒s HPs 
    --> local  IP address 113.113.169.226
    --> pppd: ≒s HPs 
    --> remote IP address 10.10.88.48
    --> pppd: ≒s HPs 
    --> primary   DNS address 202.96.128.86
    --> pppd: ≒s HPs 
    --> secondary DNS address 220.192.32.103
    --> pppd: ≒s HPs 

    拨号成功 : )

    3. 附赠-我的wvdial.conf
    $ cat /etc/wvdial.conf

    [Dialer usb]
    Init1 = ATZ
    Init2 = AT&FE0V1&C1S0=0
    Init3 = AT+cgdcont=1,"IP","CMNET","",0,0
    Password = 172
    New PPPD = yes
    Phone = *99***2#
    Idle Seconds = 3000
    Modem Type = USB Modem
    Stupid Mode = 1
    Baud = 460800
    Auto DNS = 1
    Dial Command = ATD
    Ask Password = 0
    ISDN = 0
    Username = 172
    FlowControl = NOFLOW
    Modem = /dev/ttyACM0

    [Dialer bt]
    Init1 = ATZ
    Init2 = AT&FE0V1&C1S0=0
    Init3 = AT+cgdcont=1,"IP","CMNET","",0,0
    Password = 172
    New PPPD = yes
    Phone = *99***2#
    Idle Seconds = 3000
    Modem Type = BlueTooth Modem
    Stupid Mode = 1
    Baud = 460800
    Auto DNS = 1
    Dial Command = ATD
    Ask Password = 0
    ISDN = 0
    Username = 172
    FlowControl = NOFLOW
    Modem = /dev/rfcomm0

    [Dialer 3G]
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    Modem Type = Analog Modem
    Phone = #777
    ISDN = 0
    Username = ctnet@mycdma.cn
    Init1 = ATZ
    Password = vnet.mobi
    Modem = /dev/ttyUSB_utps_modem
    Baud = 115200

    Linux 天翼3G上网 
  • 相关阅读:
    python之 网络编程、异常处理、面向对象
    python sys模块、mongodb操作、接口开发、程序分目录、压缩解压文件
    linux安装redis完整步骤
    python之:map、filter、random、datatime,写日志,发邮件,操作mysql、redis,MD5加密,写excel
    函数、模块
    python json处理、集合操作、函数定义、文件读写
    python字典、list、字符串常见处理方法、元组、文件读写
    学习笔记
    接口测试笔记
    【04】Cent OS 7 中部署JDK + Tomcat 环境
  • 原文地址:https://www.cnblogs.com/top5/p/1683769.html
Copyright © 2011-2022 走看看