日期:

2013.6.10

作者:

杨正

版本:

1.0 (初版)

QQ:

1209758756<yz2012ww@gmail.com>

 

开发环境的叙述

内容

3G拨号上网

SIM卡

中国移动

嵌入式开发板

FL2440

核心CPU

S3C2440

嵌入式linux内核版本

Linux-3.0

主机开发环境

Linux操作系统

 

主要步骤:

1

向linux内核中添加3G模块的驱动(USB转串口的驱动)和ppp协议的支持,重新编译下载内核。

2

对ppp-2.4.4源代码进行交叉编译。

将拨号上网所需的两个应用程序pppd和chat拷贝到开发板/usr/sbin文件夹下,将改好的脚本文件wcdma、wcdma-chat-connect、wcdma-chat-disconnect存放在/etc/ppp/peers目录下。将含有域名解析服务器地址的文件resolv.conf拷贝到/etc目录下。

3

移植usb_modeswitch。

下载源代码包,并解压缩。对其进行修改,然后编译生成usb_modeswitch和usb_modeswitch.d,然后将usb_modeswitch下载到usr/sbin目录下,将usb_modeswitch.d下载到etc/目录下。

4

执行“pppd call wcdma”命令进行拨号,进行网络测试。

 

 

 

 

一、      usb_modeswitch移植

usb_modeswitch工具用到libusb提供的API,所以在移植usb_modeswitch之前先编译libusb。

下载源码:

[lingyun@localhost yangzheng]$ mkdir usbmode

[lingyun@localhostyangzheng]$ cd usbmode/

[lingyun@localhost usbmode]$wget

http://ncu.dl.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.0/libusb-1.0.0.tar.bz2

[lingyun@localhostusbmode]$ wget
http://ncu.dl.sourceforge.net/project/libusb/libusb-compat-0.1/libusb-compat-0.1.4/libusb-compat-0.1.4.tar.bz2

[lingyun@localhostusbmode]$ wget
http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-1.2.4.tar.bz2

[lingyun@localhostusbmode]$ tar libusb-1.0.0.tar.bz2

usb-modeswitch-data-20130607.tar.bz2下载地址:
http://www.draisberghof.de/usb_modeswitch/#download

 

解压:

[lingyun@localhostusbmode]$ tar -jxf libusb-1.0.0.tar.bz2

[lingyun@localhostusbmode]$ tar -jxf usb-modeswitch-1.2.6.tar.bz2

[lingyun@localhostusbmode]$ tar -jxf usb-modeswitch-data-20130607.tar.bz2

 

编译libusb:

[lingyun@localhostusbmode]$ cd libusb-1.0.0

[lingyun@localhostlibusb-1.0.0]$ mkdir ../install     //在上层目录建install目录

[lingyun@localhost libusb-1.0.0]$

./configure --prefix=/home/lingyun/yangzheng/usbmode/install/  --build=i686 --host=arm-linux--disable-shared --enable-static

--prefix=/home/lingyun/yangzheng/usbmode/install(install的绝对路径)          

[lingyun@localhostlibusb-1.0.0]$ ls

aclocal.m4  config.guess config.status  COPYING   INSTALL    libusb-1.0.pc     Makefile.am  PORTING  TODO

AUTHORS     config.h      config.sub     depcomp  install-sh  libusb-1.0.pc.in  Makefile.in README

ChangeLog   config.h.in  configure      doc       libtool     ltmain.sh         missing      stamp-h1

compile     config.log    configure.ac   examples libusb      Makefile          NEWS         THANKS

[lingyun@localhost libusb-1.0.0]$make

[lingyun@localhost libusb-1.0.0]$make install

[lingyun@localhost usbmode]$export
PKG_CONFIG_PATH=/home/lingyun/yangzheng/usbmode/install/lib/pkgconfig:$PKG_CONFIG_PATH

[lingyun@localhostlibusb-compat-0.1.5]$ ./configure--prefix=/home/lingyun/yangzheng/usbmode/install/  --build=i686 --host=arm-linux--disable-shared --enable-static

[lingyun@localhost libusb-compat-0.1.5]$make

[lingyun@localhostlibusb-compat-0.1.5]$ make install

libusb-1.0.0.tar.bz2  libusb-compat-0.1.5         usb-modeswitch-1.2.6         usb-modeswitch-data-20130607.tar.bz2

[lingyun@localhost usbmode]$cd install/

[lingyun@localhost install]$ls

bin  include lib

 

 

编译usb_modeswitch:

[lingyun@localhost usbmode]$cd usb-modeswitch-1.2.6

[lingyun@localhostusb-modeswitch-1.2.6]$ vim Makefile

CC =/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc   #add by yangzheng

CFLAGS      += -Wall -I../install/include-static      #add by yangzheng

LIBS        = -L../install/lib/ -l usb -l usb-1.0-l pthread   #add by yangzheng

[lingyun@localhostusb-modeswitch-1.2.6]$ make

[lingyun@localhostusb-modeswitch-1.2.6]$ cp usb_modeswitch../install/bin/

[lingyun@localhostusb-modeswitch-1.2.6]$ cp usb_modeswitch /tftp/

 

把usb-modeswitch-data-20130607下的usb_modeswitch.d中的所以文件都拷贝到开发板的etc/usb_modeswitch.d/目录:

[lingyun@localhost usbmode]$cd usb-modeswitch-data-20130607

[lingyun@localhostusb-modeswitch-data-20130607]$ ls

40-usb_modeswitch.rules  ChangeLog COPYING  gen-rules.tcl  Makefile README  usb_modeswitch.d

[lingyun@localhostusb-modeswitch-data-20130607]$ tar -jcf usb_modeswitch.d.tar.bz2usb_modeswitch.d

[lingyun@localhostusb-modeswitch-data-20130607]$ ls

40-usb_modeswitch.rules  ChangeLog COPYING  gen-rules.tcl  Makefile README  usb_modeswitch.d  usb_modeswitch.d.tar.bz2

[lingyun@localhostusb-modeswitch-data-20130607]$ cp usb_modeswitch.d.tar.bz2 /tftp/

 

把usb_modeswitch下载到/usr/sbin目录下,把usb_modeswitch.d下载到/etc/目录下:

>: cdusr/sbin/

>: tftp-gr usb_modeswitch 192.168.1.3

>: cd etc/

>: tftp-gr usb_modeswitch.d.tar.bz2 192.168.1.3

>: tar-jxf usb_modeswitch.d.tar.bz2

 

到这里usb_modeswitch移植完成。

 

二、      PPP移植

各项工作具体说明

向linux内核添加3G模块的驱动(USB转串口驱动)和PPP协议的支持,然后编译内核并下载到开发板。当然如果之前已经移植好内核,那么只需要增加几个选项就可以,然后在编译内核就可以了,这个文档默认内核已经移植过,所以只讲与USB转串口驱动和PPP协议支持的几个选项。

[lingyun@localhost yangzheng]$ cd linux-3.0

[lingyun@localhost linux-3.0]$ ls

arch    crypto         fs       Kbuild  MAINTAINERS     modules.order  REPORTING-BUGS  sound              usr

block   Documentation  include  Kconfig Makefile         Module.symvers  samples         System.map         virt

COPYING drivers        init     kernel  mm               net             scripts        tools              vmlinux

CREDITS firmware       ipc      lib     modules.builtin  README          security        uImage-s3c2440.gz vmlinux.o

[lingyun@localhost linux-3.0]$ vt100

[lingyun@localhost linux-3.0]$ make menuconfig

USB的驱动要选这几个:

DeviceDrivers---→

USBsupport---→

<*>USB SerialConverter support--→

[*]USBGeneric Serial Driver 

<*>USBdriver for GSM and CDMA modems

下面是详细步骤:

按“Enter”进入“Device Drivers”目录

按“Enter”进入“USB support”目录

按“Enter”进入“USB SerialConverter support”目录

按“Y”将“USBGeneric Serial Driver”编译进内核

按“Y”将“USB driver for GSM and CDMA modems”编译进内核

 

 

到此3G模块驱动添加完成,下面进行ppp协议支持的添加(下面所示的几个选项必选):

DeviceDrivers--→

Network devicesupport---→

<*> PPP (point-to-point protocol) support   
        [*]   PPP multilink support (EXPERIMENTAL)    
        <*>   PPP support for async serial ports      
        <*>   PPP support for sync tty ports          
       <*>   PPP Deflate compression               

 <*>   PPP BSD-Compress compression 

 

下面是详细步骤:

按“Enter”进入“Device Drivers”目录

按“Enter”进入“Network device support”目录

选择ppp协议支持(之前所提的必选,这里全部选上)编译进内核

完成了这些步骤以后就可以退出make menuconfig进行make编译内核了。然后再把生成的镜像文件下载到板子上重启开发板即可。然后就会发现在/dev/目录下生成ppp设备节点:

 

 

>: ls-l dev/ppp

crw-rw----    1 root    root      108,   0 Feb 21 21:13 dev/ppp

 

交叉编译好工作源代码ppp-2.4.4,得到pppd和chat,解压源代码包,进入目录,进行交叉编译:

[lingyun@localhost yangzheng]$ mkdir ppp

[lingyun@localhost yangzheng]$ cd ppp

[lingyun@localhost ppp]$ wget ftp://ftp.samba.org/pub/ppp/ppp-2.4.4.tar.gz
[lingyun@localhost ppp]$ tar -zxf ppp-2.4.4.tar.gz

[lingyun@localhost ppp]$ cd ppp-2.4.4

[lingyun@localhost ppp-2.4.4]$ls

Changes-2.3  configure FAQ   pppstats     README.eap-srp  README.MSCHAP80  README.pwfd SETUP

chat         contrib    include modules   pppd             README       README.linux    README.MSCHAP81  README.sol2 solaris

common       etc.ppp    linux   PLUGINS   pppdump          README.cbcp  README.MPPE     README.pppoe     scripts

[lingyun@localhost ppp-2.4.4]$./configure //生成Makefile

[lingyun@localhost ppp-2.4.4]$ls

Changes-2.3  configure FAQ      Makefile pppstats     README.eap-srp  README.MSCHAP80  README.pwfd SETUP

chat         contrib    include modules   pppd             README       README.linux    README.MSCHAP81  README.sol2 solaris

common       etc.ppp    linux   PLUGINS   pppdump          README.cbcp  README.MPPE     README.pppoe     scripts

 

[lingyun@localhost ppp-2.4.4]$cd chat/  //对chat目录下的文件进行修改

[lingyun@localhost chat]$ ls

chat.8 chat.c  chat.o  Makefile Makefile.linux  Makefile.sol2

[lingyun@localhost chat]$ vim chat.c

1167

1168    if (timeout_next) {

1169    timeout_next = 0;

1170    s = clean(s, 0);/* add by yangzheng*/

1171    timeout = atoi(s);

1172    free(s);     /* add byyangzheng  */

 

[lingyun@localhost chat]$ vim Makefile

INSTALL= install

CC =/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc    #addby yangzheng

 

all:   chat

 

chat:  chat.o

    #$(CC) -o chat chat.o

$(CC) -static -o chat chat.o       #add by yangzheng

 

[lingyun@localhost ppp-2.4.4]$cd pppd      //修改pppd目录下的文件

[lingyun@localhost pppd]$ ls

auth.c     chap-md5.o  eap.c    fsm.h    ipxcp.o  Makefile        multilink.c   pppcrypt.o spinlock.h     tdb.o

auth.o     chap_ms.c   eap.h    fsm.o    lcp.c    Makefile.linux  multilink.o  spinlock.o     tty.c

cbcp.c     chap_ms.h   eap.o    ipcp.c   lcp.h    Makefile.sol2   options.c    pppd.8      srp-entry.8    tty.o

cbcp.h     chap_ms.o   ecp.c    ipcp.h   lcp.o    md4.c           options.o     pppd.h     srp-entry.c    upap.c

ccp.c      chap-new.c  ecp.h    ipcp.o   magic.c  md4.h           patchlevel.h  ppp.pam    sys-linux.c    upap.h

ccp.h      chap-new.h  ecp.o    ipv6cp.c magic.h  md4.o           pathnames.h   sha1.c     sys-linux.o    upap.o

ccp.o      chap-new.o  eui64.c ipv6cp.h  magic.o  md5.c           plugins       sha1.h      sys-solaris.c  utils.c

chap-md5.c demand.c    eui64.h  ipxcp.c  main.c   md5.h           pppcrypt.c    sha1.o     tdb.c          utils.o

chap-md5.h demand.o    fsm.c    ipxcp.h  main.o   md5.o           pppcrypt.h    spinlock.c tdb.h

 

[lingyun@localhost pppd]$ vim auth.c

1316    ao->neg_upap = !refuse_pap /*&& (passwd[0] != 0 ||get_pap_passwd(NULL))*/;

[lingyun@localhost pppd]$ vim Makefile

35 CC = /opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc

47 #MPPE=y

52 #FILTER=y

69 #PLUGIN=y

[lingyun@localhost ppp-2.4.4]$make

[lingyun@localhost ppp-2.4.4]$cd chat/

[lingyun@localhost chat]$ ls

chat  chat.8  chat.c chat.o  Makefile  Makefile.linux  Makefile.sol2

[lingyun@localhost chat]$ file chat

chat: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, notstripped

[lingyun@localhost ppp-2.4.4]$cd pppd

[lingyun@localhost pppd]$ ls

auth.c     chap-md5.o  eap.c    fsm.h    ipxcp.o  Makefile        multilink.c   pppcrypt.o spinlock.h     tdb.o

auth.o     chap_ms.c   eap.h    fsm.o    lcp.c    Makefile.linux  multilink.o  pppd       spinlock.o     tty.c

cbcp.c     chap_ms.h   eap.o    ipcp.c   lcp.h    Makefile.sol2   options.c    pppd.8      srp-entry.8    tty.o

cbcp.h     chap_ms.o   ecp.c    ipcp.h   lcp.o    md4.c           options.o     pppd.h     srp-entry.c    upap.c

ccp.c      chap-new.c  ecp.h    ipcp.o   magic.c  md4.h           patchlevel.h  ppp.pam    sys-linux.c    upap.h

ccp.h       chap-new.h ecp.o    ipv6cp.c  magic.h md4.o           pathnames.h   sha1.c     sys-linux.o    upap.o

ccp.o      chap-new.o  eui64.c  ipv6cp.h magic.o  md5.c           plugins       sha1.h      sys-solaris.c  utils.c

chap-md5.c demand.c    eui64.h  ipxcp.c  main.c   md5.h           pppcrypt.c    sha1.o     tdb.c          utils.o

chap-md5.h demand.o    fsm.c    ipxcp.h  main.o   md5.o           pppcrypt.h    spinlock.c tdb.h

[lingyun@localhost pppd]$ file pppd

pppd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (usesshared libs), not stripped

拨号所用到的程序就是ppp-2.4.4/pppd下的pppd和ppp-2.4.4/chat下的chat可执行程序,将交叉编译出来的这两个应用程序拷贝到开发板 /usr/sbin目录下,更改其属性为可执行文件。

[lingyun@localhost pppd]$ cp pppd /tftp/

[lingyun@localhost chat]$ cp chat /tftp/

在开发板上进行如下操作:

>: cd usr/sbin/

>: tftp -gr chat 192.168.1.3       //下载

>: tftp -gr pppd 192.168.1.3

>: chmod a+x chat                  //设置为执行权限

>: chmod a+x pppd

 

 

配置拨号的脚文件

拨号上网需要的配置文件有3个:

wcdma,wcdma-chat-connect,wcdma-chat-disconnect(存放位置是开发板的/etc/ppp/peers)。

>: mkdir ppp

>: mkdir peers

>: cd peers

wcdma配置文件内容

>: vi wcdma

#/etc/ppp/peers/cdma

# This is pppd script for China liantong

# Usage:  root>pppd call cdma

hide-password

noauth

connect '/usr/sbin/chat -s -v -f/etc/ppp/peers/wcdma-chat-connect'

disconnect '/usr/sbin/chat -s -v -f/etc/ppp/peers/wcdma-chat-disconnect'

debug

/dev/ttyUSB2

115200

defaultroute

noipdefault

novj

novjccomp

noccp

ipcp-accept-local

ipcp-accept-remote

local

lock

dump

nodetach

user "card"

password "card"

crtscts

remotename 3gppp

ipparam 3gppp

usepeerdns

 

wcdma-chat-connect配置文件内容

>: vi wcdma-chat-connect

ABORT "BUSY"

ABORT "NO CARRIER"

ABORT "NO DIALTONE"

ABORT "ERROR"

ABORT "NO ANSWER"

TIMEOUT 120

"" AT

OK \rATZ

OK\rAT+CGDCONT=1,"IP","cmnet",,0,0

OK ATDT*99#

CONNECT \d\c

 

wcdma-chat-disconnect配置文件内容

>: vi wcdma-chat-disconnect

ABORT "ERROR"

ABORT "NO DIALTONE"

SAY "\NSending break to the modem\n"

""\k"

""+++ATH"

SAY "\nGood bay\n"

 

还要添加一个域名解析的文件:

>:cd etc/

>:vi resolv.conf

nameserver4.2.2.2

nameserver8.8.8.8

~

 

 

到这里PPP 移植就完成了。

 

 

到了这里大部分工作已经完成了,但是我们的开发板依然不能拨号,还需进一步修改和添加配置文件。

当我们的MF626插件中兴WCDMA USB调制解调器,Linux内核识别作为一个cd – rom。

scsi0 :usb-storage 1-1.4:1.0

scsi 0:0:0:0: CD-ROM            ZTE      USB SCSI CD-ROM  2.31 PQ: 0 ANSI: 2

现在我们需要使用usb_modeswitch切换3 g USB调制解调器来调制解调器(USB转换为seiral),对于usb_modeswitch使用libusb,libusb依赖于USB文件系统。所以我们在使用usb_modeswitch之前必须挂在usbfs,否则它不能检测USB设备。

添加中兴WCDMA现代usb_modeswitchMF626配置文件:

>: cd apps/

>: vi zte_mf626.conf

# ZTE devices
 
DefaultVendor=   0x19d2
DefaultProduct=  0x2000
 
TargetVendor=   0x19d2
TargetProductList="0001,0002,0015,0016,0017,0031,0037,0052,0055,0063,0064,0066,0091,0108,0117,0128,0157,2002,2003"
 
MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
MessageContent3="55534243123456702000000080000c85010101180101010101000000000000"
 
NeedResponse=1

 

 

>:  usb_modeswitch -c /apps/zte_mf626.conf

Looking for target devices ...
   No devices in target mode or class found
  Looking for default devices ...
   No devices in default mode found. Nothing to do. Bye.

这是因为usbfs文件系统没有挂在起来,所以使用usb_modeswitch之前要挂载它:

>: mount -tusbfs usbfs /proc/bus/usb/

>: mount

rootfs on / typerootfs (rw)

ubi0:rootfs on /type ubifs (rw,relatime)

proc on /proc typeproc (rw,relatime)

tmpfs on /tmp typetmpfs (rw,relatime)

tmpfs on /dev typetmpfs (rw,relatime)

sysfs on /sys typesysfs (rw,relatime)

usbfs on/proc/bus/usb type usbfs (rw,relatime)

devpts on /dev/ptstype devpts (rw,relatime,mode=600)

 

>: lsproc/bus/usb/

001      devices

这样我usbfs就挂载起来了,但是如果重启开发板后,还得重新挂载,为了每次启动系统都能自动挂载,我们进行如下修改:

>: cd etc/

>: vi fstab

# /etc/fstab: static file system information.

# Copyright (C) 2013 yangzheng <yangzheng@gmail.com>

#

#<File system> <mount pt>     <type>   <options>         <dump> <pass>

#devpts         /dev/pts       devpts   defaults          0     0

#/dev/root      /              ext2     rw,noauto         0     1

proc           /proc          proc     defaults          0     0

tmpfs          /tmp           tmpfs    defaults          0     0

tmpfs           /dev           tmpfs    defaults          0     0

sysfs          /sys           sysfs    defaults          0     0

usbfs           /proc/bus/usb  usbfs   defaults          0      0

 

现在的话就可以看到如下信息了:

>:  usb_modeswitch -c /apps/zte_mf626.conf

Looking for target devices ...

 No devices intarget mode or class found

Looking for default devices ...

   foundmatching product ID

   adding device

 Found device indefault mode, class or configuration (1)

Accessing device 007 on bus 001 ...

Getting the current device configuration ...

 OK, got currentdevice configuration (1)

Using interface number 0

Using endpoints 0x01 (out) and 0x81 (in)

Inquiring device details; driver will be detached ...

Looking for active driver ...

 OK, driverfound; name unknown, limitation of libusb1

 OK, driver"unkown" detached

 

SCSI inquiry data (for identification)

-------------------------

  Vendor String:ZTE    

   Model String:USB SCSI CD-ROM

Revision String: 2.31

-------------------------

 

USB description data (for identification)

usb 1-1.4: usbfs: process 802 (usb_modeswitch) did notclaim interface 0 before use

-------------------------

Manufacturer: ZTE,Incorporated

     Product:ZTE CDMA Technologies MSM

  Serial No.:1234567890ABCDEF

-------------------------

Setting up communication with interface 0

Using endpoint 0x01 for message sending ...

Trying to send message 1 to endpoint 0x01 ...

 OK, messagesuccessfully sent

Reading the response to message 1 (CSW) ...

 OK, responsesuccessfully read (13 bytes).

Trying to send message 2 to endpoint 0x01 ...

 OK, messagesuccessfully sent

Reading the response to message 2 (CSW) ...

 OK, responsesuccessfully read (13 bytes).

Trying to send message 3 to endpoint 0x01 ...

 OK, messagesuccessfully sent

Reading the response to message 3 (CSW) ...

 OK, responsesuccessfully read (0 bytes).

Resetting response endpoint 0x81

Resetting message endpoint 0x01

 Device is gone,skipping any further commands

-> Run lsusb to note any changes. Bye.

 

>: usb 1-1.4: USB disconnect, device number 7

usb 1-1.4: new full speed USB device number 8 using s3c2410-ohci

usb 1-1.4: New USB device found, idVendor=19d2,idProduct=0031

usb 1-1.4: New USB device strings: Mfr=2, Product=1,SerialNumber=3

usb 1-1.4: Product: ZTE CDMA Technologies MSM

usb 1-1.4: Manufacturer: ZTE,Incorporated

usb 1-1.4: SerialNumber: 1234567890ABCDEF

option 1-1.4:1.0: GSM modem (1-port) converterdetected

usb 1-1.4: GSM modem (1-port) converter now attachedto ttyUSB0

option 1-1.4:1.1: GSM modem (1-port) converterdetected

usb 1-1.4: GSM modem (1-port) converter now attachedto ttyUSB1

scsi5 : usb-storage 1-1.4:1.2

option 1-1.4:1.3: GSM modem (1-port) converterdetected

usb 1-1.4: GSM modem (1-port) converter now attachedto ttyUSB2

scsi 5:0:0:0: Direct-Access     ZTE     MMC Storage      2.31 PQ: 0 ANSI:2

sd 5:0:0:0: Attached scsi generic sg0 type 0

sd 5:0:0:0: [sda] Attached SCSI removable disk

 

 

 

发送at命令:

>:microcom  -s 115200 dev/ttyUSB2

at

OK

at+cpin

+OK

 

OK

at+csq

OK

at

OK

at+csq

+CSQ:11,99

 

OK

at+creg

OK

 

Sync

 

 

现在就可以进行拨号了:

>:pppd call wcdma

pppdoptions in effect:

debug           # (from /etc/ppp/peers/wcdma)

nodetach                # (from /etc/ppp/peers/wcdma)

dump            # (from /etc/ppp/peers/wcdma)

noauth          # (from /etc/ppp/peers/wcdma)

usercard               # (from/etc/ppp/peers/wcdma)

password??????         # (from/etc/ppp/peers/wcdma)

remotename3gppp                # (from/etc/ppp/peers/wcdma)

/dev/ttyUSB2            # (from /etc/ppp/peers/wcdma)

115200          # (from /etc/ppp/peers/wcdma)

lock            # (from /etc/ppp/peers/wcdma)

connect/usr/sbin/chat -s -v -f /etc/ppp/peers/wcdma-chat-connect               # (from /etc/ppp/peers/wcdma)

disconnect/usr/sbin/chat -s -v -f /etc/ppp/peers/wcdma-chat-disconnect         # (from /etc/ppp/peers/wcdma)

crtscts         # (from /etc/ppp/peers/wcdma)

local           # (from /etc/ppp/peers/wcdma)

hide-password           # (from /etc/ppp/peers/wcdma)

novj            # (from /etc/ppp/peers/wcdma)

novjccomp               # (from /etc/ppp/peers/wcdma)

ipcp-accept-local               # (from /etc/ppp/peers/wcdma)

ipcp-accept-remote              # (from /etc/ppp/peers/wcdma)

ipparam3gppp           # (from/etc/ppp/peers/wcdma)

noipdefault             # (from /etc/ppp/peers/wcdma)

defaultroute            # (from /etc/ppp/peers/wcdma)

usepeerdns              # (from /etc/ppp/peers/wcdma)

noccp           # (from /etc/ppp/peers/wcdma)

abort on(BUSY)

abort on(NO CARRIER)

abort on(NO DIALTONE)

abort on(ERROR)

abort on(NO ANSWER)

timeoutset to 120 seconds

send(AT^M)

expect(OK)

AT^M^M

OK

 -- got it

 

send(^MATZ^M)

expect(OK)

^M

ATZ^M^M

OK

 -- got it

 

send(^MAT+CGDCONT=1,"IP","cmnet",,0,0^M)

expect(OK)

^M

AT+CGDCONT=1,"IP","cmnet",,0,0^M^M

OK

 -- got it

 

send(ATDT*99#^M)

expect(CONNECT)

^M

ATDT*99#^M^M

CONNECT

 -- got it

 

send (\d)

Serialconnection established.

usingchannel 1

Usinginterface ppp0

Connect:ppp0 <--> /dev/ttyUSB2

sent [LCPConfReq id=0x1 <asyncmap 0x0> <magic 0xfb2b5aaa> <pcomp><accomp>]

rcvd [LCPConfReq id=0x0 <asyncmap 0x0> <auth chap MD5> <magic0x172b914> <pcomp> <accomp>]

sent [LCPConfAck id=0x0 <asyncmap 0x0> <auth chap MD5> <magic0x172b914> <pcomp> <accomp>]

rcvd [LCPConfAck id=0x1 <asyncmap 0x0> <magic 0xfb2b5aaa> <pcomp><accomp>]

rcvd [LCPDiscReq id=0x1 magic=0x172b914]

rcvd[CHAP Challenge id=0x1 <bcbf3cbe363150861c15cffae8617331>, name ="UMTS_CHAP_SRVR"]

sent[CHAP Response id=0x1 <6fcce180826b52be7803fc7a4b601de5>, name = "card"]

rcvd[CHAP Success id=0x1 ""]

CHAPauthentication succeeded

CHAPauthentication succeeded

sent[IPCP ConfReq id=0x1 <addr 0.0.0.0><ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]

rcvd[IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13><ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins10.11.12.14>]

sent[IPCP ConfReq id=0x2 <addr 0.0.0.0><ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]

rcvd[IPCP ConfReq id=0x0]

sent[IPCP ConfNak id=0x0 <addr 0.0.0.0>]

rcvd[IPCP ConfNak id=0x2 <addr 10.218.148.212> <ms-dns1 211.137.58.20><ms-dns3 211.136.20.203>]

sent[IPCP ConfReq id=0x3 <addr 10.218.148.212> <ms-dns1 211.137.58.20><ms-dns3 211.136.20.203>]

rcvd[IPCP ConfReq id=0x1]

sent[IPCP ConfAck id=0x1]

rcvd[IPCP ConfAck id=0x3 <addr 10.218.148.212> <ms-dns1 211.137.58.20><ms-dns3 211.136.20.203>]

Could notdetermine remote IP address: defaulting to 10.64.64.64

local  IP address 10.218.148.212

remote IPaddress 10.64.64.64

primary   DNS address 211.137.58.20

secondaryDNS address 211.136.20.203

 

这样虽然拨号成功,但是它是在前台运行的,现在我们不能进行其他的任何操作,以前前台被它占领了,所以我们用pppd call wcdma $这个命令让它在后台运行,这样我们就可以在前台进行其他的操作了。

>:pppd call wcdma &

>:pppd options in effect:

debug           # (from /etc/ppp/peers/wcdma)

nodetach                # (from /etc/ppp/peers/wcdma)

dump            # (from /etc/ppp/peers/wcdma)

noauth          # (from /etc/ppp/peers/wcdma)

usercard               # (from/etc/ppp/peers/wcdma)

password??????         # (from/etc/ppp/peers/wcdma)

remotename3gppp                # (from/etc/ppp/peers/wcdma)

/dev/ttyUSB2            # (from /etc/ppp/peers/wcdma)

115200          # (from /etc/ppp/peers/wcdma)

lock            # (from /etc/ppp/peers/wcdma)

connect/usr/sbin/chat -s -v -f /etc/ppp/peers/wcdma-chat-connect               # (from /etc/ppp/peers/wcdma)

disconnect/usr/sbin/chat -s -v -f /etc/ppp/peers/wcdma-chat-disconnect         # (from /etc/ppp/peers/wcdma)

crtscts         # (from /etc/ppp/peers/wcdma)

local           # (from /etc/ppp/peers/wcdma)

hide-password           # (from /etc/ppp/peers/wcdma)

novj            # (from /etc/ppp/peers/wcdma)

novjccomp               # (from /etc/ppp/peers/wcdma)

ipcp-accept-local               # (from /etc/ppp/peers/wcdma)

ipcp-accept-remote              # (from /etc/ppp/peers/wcdma)

ipparam3gppp           # (from /etc/ppp/peers/wcdma)

noipdefault             # (from /etc/ppp/peers/wcdma)

defaultroute            # (from /etc/ppp/peers/wcdma)

usepeerdns              # (from /etc/ppp/peers/wcdma)

noccp           # (from /etc/ppp/peers/wcdma)

abort on(BUSY)

abort on(NO CARRIER)

abort on(NO DIALTONE)

abort on(ERROR)

abort on(NO ANSWER)

timeoutset to 120 seconds

send(AT^M)

expect(OK)

AT^M^M

OK

 -- got it

 

send(^MATZ^M)

expect(OK)

^M

ATZ^M^M

OK

 -- got it

 

send(^MAT+CGDCONT=1,"IP","cmnet",,0,0^M)

expect(OK)

^M

AT+CGDCONT=1,"IP","cmnet",,0,0^M^M

OK

 -- got it

 

send(ATDT*99#^M)

expect(CONNECT)

^M

ATDT*99#^M^M

CONNECT

 -- got it

 

send (\d)

Serialconnection established.

usingchannel 2

Usinginterface ppp0

Connect:ppp0 <--> /dev/ttyUSB2

sent [LCPConfReq id=0x1 <asyncmap 0x0> <magic 0x7c43b6f1><pcomp> <accomp>]

rcvd [LCPConfReq id=0x2 <asyncmap 0x0> <auth chap MD5> <magic0x1737710> <pcomp> <accomp>]

sent [LCPConfAck id=0x2 <asyncmap 0x0> <auth chap MD5> <magic0x1737710> <pcomp> <accomp>]

rcvd [LCPConfAck id=0x1 <asyncmap 0x0> <magic 0x7c43b6f1><pcomp> <accomp>]

rcvd [LCPDiscReq id=0x3 magic=0x1737710]

rcvd[CHAP Challenge id=0x1 <b4df208e52eb3e10d25ccb92482a3b65>, name = "UMTS_CHAP_SRVR"]

sent[CHAP Response id=0x1 <b1e297cac61ee8ea5e54d436b8fa0f59>, name = "card"]

rcvd[CHAP Success id=0x1 ""]

CHAPauthentication succeeded

CHAPauthentication succeeded

sent[IPCP ConfReq id=0x1 <addr 0.0.0.0><ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]

rcvd[IPCP ConfReq id=0x2]

sent[IPCP ConfNak id=0x2 <addr 0.0.0.0>]

rcvd[IPCP ConfNak id=0x1 <addr 10.219.187.159> <ms-dns1 211.137.58.20><ms-dns3 211.136.20.203>]

sent[IPCP ConfReq id=0x2 <addr 10.219.187.159> <ms-dns1 211.137.58.20><ms-dns3 211.136.20.203>]

rcvd[IPCP ConfReq id=0x3]

sent[IPCP ConfAck id=0x3]

rcvd[IPCP ConfAck id=0x2 <addr 10.219.187.159> <ms-dns1 211.137.58.20><ms-dns3 211.136.20.203>]

Could notdetermine remote IP address: defaulting to 10.64.64.64

local  IP address 10.219.187.159

remote IPaddress 10.64.64.64

primary   DNS address 211.137.58.20

secondaryDNS address 211.136.20.203

 

 

三、          现在我们就来测试一下,看看能不能上网

 

>: ping 4.2.2.2-I ppp0

64 bytes from 4.2.2.2:seq=4 ttl=50 time=338.370 ms

64 bytes from 4.2.2.2:seq=5 ttl=50 time=532.402 ms

64 bytes from 4.2.2.2:seq=6 ttl=50 time=446.398 ms

64 bytes from 4.2.2.2:seq=7 ttl=50 time=322.424 ms

64 bytes from 4.2.2.2:seq=8 ttl=50 time=337.416 ms

64 bytes from 4.2.2.2:seq=9 ttl=50 time=334.444 ms

 

Ping一下外网:

>: ping -I ppp0 210.32.200.129

PING 210.32.200.129 (210.32.200.129): 56 data bytes

64 bytes from 210.32.200.129: seq=14 ttl=49time=1287.905 ms

64 bytes from 210.32.200.129: seq=19 ttl=49time=263.708 ms

64 bytes from 210.32.200.129: seq=30 ttl=49time=408.844 ms

64 bytes from 210.32.200.129: seq=32 ttl=49time=175.844 ms

 

>: telnet bbs.newsmth.net

rcvd [LCP ProtRej id=0x4 00 e5 0a db bb 9f 04 02 02 02 b8 d2 00 35 00 27 be 0c 00 0d 01 00 00 01 00 00 00 00 00 00 03 77...]

Protocol-Reject for unsupported protocol0xe5

 

Entering character mode

Escape character is '^]'.


 

 

Ping百度:

>: ping -I ppp0 www.baidu.com

PING www.baidu.com (220.181.112.143): 56 data bytes

64 bytes from 220.181.112.143: seq=0 ttl=49time=155.370 ms

64 bytes from 220.181.112.143: seq=1 ttl=49time=651.665 ms

64 bytes from 220.181.112.143: seq=2 ttl=49time=210.690 ms

64 bytes from 220.181.112.143: seq=3 ttl=49time=243.637 ms

64 bytes from 220.181.112.143: seq=4 ttl=49time=240.710 ms

64 bytes from 220.181.112.143: seq=5 ttl=49time=231.712 ms


--- www.baidu.com ping statistics ---

6 packets transmitted, 6 packets received,0% packet loss

round-trip min/avg/max =155.370/288.964/651.665 ms

 

 

这个文档有些地方还需要完善!!

Logo

更多推荐