600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > linux下GPRS模块ppp拨号上网

linux下GPRS模块ppp拨号上网

时间:2021-12-26 20:43:09

相关推荐

linux下GPRS模块ppp拨号上网



交叉编译器:arm-linux-gcc-4.5.4

Linux内核版本:Linux-3.0

主机操作系统:Centos 6.5

开发板:FL2440

GPRS:SIM900A

在开发SIM900模块之前,开发板已经加载了linux内核以及文件系统,并且开发板串口已经使能。并且一定要注意的是:要有一张没有欠费的电话卡!不要笑,这是个很严肃的问题!

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

所需源码:

ppp-2.4.4.tar.gz/download.php?id=35208&ResourceID=8334

注:个人觉得这是一个比较典型又比较简单的移植问题。

大体步骤:添加内核ppp上网的支持-->编译ppp-2.4.4生成一些可执行文件(pppd, chat, pppdump, pppstats)放到开发板的/usr/sbin/目录下-->将可执行脚本放在开发板的指定位置(/etc/ppp/peers/gprs,/etc/ppp/chat-gprs-connect),并执行pppd命令。

一、添加内核支持

Linux-3.0以上的版本中,rt3070的驱动已经加入了内核源码中去了,本篇用的是Linux-3.0的内核,只需要在内核的make menuconfig中选择ppp上网的支持就可以了。

修改如下:

Device Drivers --->

[*] Network device support --->

<*> PPP (point-to-point protocol) support

[*] PPP multilink support (EXPERIMENTAL)

<*> PPP support for async serial ports

<*> PPP support for sync tty ports

<*> SLIP (serial line) support

[*] CSLIP compressed headers

二、编译ppp-2.4.4

# tar -xzf ppp-2.4.4.tar.gz

# ./configure

# make CC=/opt/buildroot-.08/arm920t/usr/bin/arm-linux-gcc (交叉编译器)

如果编译成功,则会在pppd, chat, pppdump, pppstats下分别生成可执行程序pppd, chat, pppdump, pppstats。将其拷贝到开发板的/usr/sbin目录下。

三、开发板的配置

# vi/etc/ppp/peers/gprs

1 # Usage: root>pppd call gprs 2 3 #set seriral 4 /dev/ttyS1 5 6 # set baudrate 7 115200 8 9 # set flowdate10 nocrtscts11 12 connect '/usr/sbin/chat -v -f /etc/ppp/gprs-connect-chat'13 14 #set debug ,send message to /var/log/messages15 debug16 17 #To keep pppd on the terminal18 nodetach19 20 #hide-password21 22 # Accept the peer's idea of our local IP address23 ipcp-accept-local24 # Accept the peer's idea of its (remote) IP address25 ipcp-accept-remote26 27 #dial up connetion as the default route28 defaultroute29 30 usepeerdns

# vi/etc/ppp/chat-gprs-connect

1 #Copyright (c) guanlei 995318056@ 2 # This is second part of the ppp dial script. It will perform the connection 3 # 4ABORT 'BUSY' 5ABORT 'NO ANSWER' 6ABORT 'NO CARRIER' 7ABORT 'NO DIALTONE' 8ABORT 'ERROR' 9ABORT '\nRING\r\n\r\nRING\r'10TIMEOUT ''\rAT12 #set apn13 OK AT+CGDCONT=1,"IP","cmnet"14 # ............15OK ATDT*99***1# //这里要改成相应的运行商的设置16SAY " + requesting data connection\n"17CONNECT ''18SAY " + connected\n"

使能pppd:

# pppd call gprs & (&表示后台运行)

配置完就可以了,现在可以测试一下上网功能了:

#

(103.235.46.39):56databytes

64bytesfrom103.235.46.39:seq=0ttl=48time=555.719ms

64bytesfrom103.235.46.39:seq=1ttl=48time=273.481ms

---pingstatistics---

3packetstransmitted,2packetsreceived,33%packetloss

round-tripmin/avg/max=273.481/414.600/555.719ms

# ifconfig

ppp0Linkencap:Point-to-PointProtocol

inetaddr:10.110.1.110P-t-P:192.200.1.21Mask:255.255.255.255

UPPOINTOPOINTRUNNINGNOARPMULTICASTMTU:1500Metric:1

RXpackets:10errors:0dropped:0overruns:0frame:0

TXpackets:12errors:0dropped:0overruns:0carrier:0

collisions:0txqueuelen:3

RXbytes:686(686.0B)TXbytes:557(557.0B)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。