ppp and ndis

3g wcdma
http://wenku.baidu.com/view/9811fcfcf705cc17552709c6.html
http://wenku.baidu.com/view/27a345fcf705cc1755270970.html
http://blog.csdn.net/hens007/article/details/7255488

2g gprs
http://wenku.baidu.com/view/acffc7ebf8c75fbfc77db2ec.html

基本情况:
内核需支持ppp协议,也要支持这个usb设备,
ppp client调用pppd进行拨号,pppd会调用chat程序与远程的ppp server会话。

tiny6410 e261上网卡拨号流程:

首先配置驱动:
3g设备驱动支持
Device Drivers  --->
 [*] USB support  --->
 <*>   USB Serial Converter support  --->  
 [*]   USB Generic Serial Driver 
 <*>   USB driver for GSM and CDMA modems   
ppp协议支持
[*] Network device support  --->
<*>   PPP (point-to-point protocol) support 
[*]     PPP multilink support (EXPERIMENTAL) 
[*]     PPP filtering
<*>     PPP support for async serial ports 
<*>     PPP support for sync tty ports
<*>     PPP Deflate compression 


假设3g模块(或上网卡)插在板子上已经被识别成了/dev/ttyUSBx了,进行pppd拨号的程序如下
1.编译pppd源码,将生产的pppd,chat搞到板子的/usr/sbin下
2.在/etc下创建ppp目录
3.ppp下创建pap-chat文件,和peers目录

[root@hemei]# cat pap-secrets 
cmnet   *       cmnet *

4.在peers目录下创建
wcdma和chat-wcdma-connect和chat-wcdma-disconnect//用于联通3g的拨号脚本
cdma2000和chat-cdma2000-connect和chat-cdma2000-disconnect//电信3g
tdscdma和chat-tdscdma-connect 和chat-tdscdma-disconnect//移动3g
内容如下:

联通3g

[root@hemei]# cat wcdma 
nodetach
lock
/dev/ttyUSB0
921600
user "card"
password "card"
crtscts
show-password
usepeerdns
noauth
noipdefault
novj
novjccomp
noccp
defaultroute
ipcp-accept-local
ipcp-accept-remote
connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-connect'
disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-wcdma-disconnect'

[root@hemei]# cat chat-wcdma-connect 
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NO DIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' AT
OK ATZ
OK AT+CGDCONT=1,\"IP\",\"3gnet\",,0,0
OK AT+CFUN=1
OK ATDT*99#
CONNECT ''

[root@hemei]# cat chat-wcdma-disconnect 
ABORT  OK
ABORT  BUSY
ABORT  DELAYED
ABORT  "NO ANSWER"
ABORT  "NO CARRIER"
ABORT  "NO DIALTONE"
ABORT  VOICE
ABORT  ERROR
ABORT  RINGING
TIMEOUT  12
""  \K
""  \K
""  \K
""  +++ATH
""  +++ATH
""  +++ATH
""  ATZ
SAY "\nGoodbay\n"
[root@hemei]# 

电信3g
[root@hemei]# cat cdma2000 
nodetach
lock
/dev/ttyUSB0
921600
user "[email protected]"
password "vnet.mobi"
crtscts
hide-password
usepeerdns
noauth
noipdefault
novj
novjccomp
noccp
defaultroute
ipcp-accept-local
ipcp-accept-remote
connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-cdma2000-connect'
disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-cdma2000-disconnect'
[root@hemei]# 
[root@hemei]# cat chat-cdma2000-connect 
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NO DIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' AT
OK ATZ
OK AT+CFUN=1
OK ATDT#777
CONNECT '' 
[root@hemei]# 
[root@hemei]# cat chat-cdma2000-disconnect 
ABORT  OK
ABORT  BUSY
ABORT  DELAYED
ABORT  "NO ANSWER"
ABORT  "NO CARRIER"
ABORT  "NO DIALTONE"
ABORT  VOICE
ABORT  ERROR
ABORT  RINGING
TIMEOUT  12
""  \K
""  \K
""  \K
""  +++ATH
""  +++ATH
""  +++ATH
""  ATZ
SAY "\nGoodbay\n"
[root@hemei]# 

移动3g
[root@hemei]# cat tdscdma 
nodetach
lock
/dev/ttyUSB0
460800
user "cmnet"
crtscts
modem
hide-password
usepeerdns
noauth
noipdefault
novj
novjccomp
noccp
defaultroute
ipcp-accept-local
ipcp-accept-remote
connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-tdscdma-connect'
disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-tdscdma-disconnect'
[root@hemei]# 
[root@hemei]# cat chat-tdscdma-connect 
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NO DIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' AT
OK ATZ
OK ATE0V1
OK ATS0=0
OK AT+CGDCONT=1,\"IP\",\"cmnet\"
OK AT+CFUN=1
OK ATDT*99***1#
CONNECT
[root@hemei]# 
[root@hemei]# cat chat-tdscdma-disconnect 
ABORT  OK
ABORT  BUSY
ABORT  DELAYED
ABORT  "NO ANSWER"
ABORT  "NO CARRIER"
ABORT  "NO DIALTONE"
ABORT  VOICE
ABORT  ERROR
ABORT  RINGING
TIMEOUT  12
""  \K
""  \K
""  \K
""  +++ATH
""  +++ATH
""  +++ATH
""  ATZ
SAY "\nGoodbay\n"


5.拨号
pppd call wcdma

进入目录/var/run/,查看是否产出文件 ppp0-ok,如果有,则表示已拨号成功,ppp0-ok文件内会存储IP地址和DNS。
/etc下新建resolv.conf文件,将分配到的两个DNS服务器地址,添加到此文件中,内容如下:
nameserver 210.22.70.3
nameserver 211.95.1.97

ifconfig有信息

[root@hemei]# ifconfig 
ppp0      Link encap:Point-to-Point Protocol  
          inet addr:10.45.210.114  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:180 (180.0 B)  TX bytes:216 (216.0 B)


6.使用如下命令切断连接
ppp-off 
kill -9 pppd进程ID 

如果3g设备插在板子上没有自动出现/dev/ttyUSBx:

使用如下命令将e261由cdrom模式转换成modem模式,此时会生成/dev/ttyUSB0-5
3g-ppp /etc/3g-modem/12d1.1446.12d1.1001
usb_modeswitch



ndis上网


1.
配置内核生成usbnet.ko (drivers/net/usb/)

Device Drivers  --->     
[*] Network device support  --->      
USB Network Adapters  ---> 
Multi-purpose USB Networking Framework

编译希姆通厂家7100等模块的ndis驱动GobiNet,ko

2.
搞到板子上加载
insmod usbnet.ko 
insmod GobiNet,ko

3.
模块插在班子上,会出现
/de/qcqmi0

ifconfig -a
有usb0接口出现

4.拨号
ndismanager  /dev/qcqmi0

进入菜单进行拨号





at 原始命令拨号

模块的拨号需要相关的网络at命令的支持
比如AT+TCPCLIENT="www.baidu.com",80

你可能感兴趣的:(协议-gsm-gprs-3g)