|
|
|
前一阶段探讨了根文件系统,有了些认识和体会。现在可以把利用GPRS模块拨号上网的功能添加进来了。首先要在Linux上调试通过pppd。主要就是三个脚本:ppp-on,ppp-off, ppp-on-dialer。需要注意的问题有:
·首先要把eth0关闭。否则即使获取ip成功,也无法发送数据。
·在Linux下,必须采用pap,且设定好用户名。这个用户名是一个假定的用户名了,不用密码。在Windows下则不需要用户名。
[root@listentec ~]#cat /etc/ppp/pap-secrets foo * "" *
|
host上测试通过,下面就可以交叉编译pppd,移植到arm板上了。
pppd的编译还是有些奇怪的问题。我在CentOS上编译pppd-2.4.3,总是出现问题,主要就是牵扯到libpcap库。记得以前编译成功过,
并没有采用该库。那时是在RH9上,所以到RH9上,编译就没有问题了。用arm-linux-readelf查看,也不需要libpcap库的支持。
OS: RedHat 9.0 CROSS Compiler: cross-3.3.2或者cross-3.4.1 pppd: pppd-2.4.3
|
过程:
(1)./configure
(2)make CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc
交叉编译完成后,strip一下。得到的pppd约231K,chat约19K。下载到target
board上面,测试通过。这里有一个问题就是,不需要在/etc/resolv.conf中添加DNS服务器,默认会在你建立的/etc/ppp/文件
夹下自动建立一个resolv.conf。
[root@listentec ~]#tree /etc/ppp /etc/ppp |-- pap-secrets |-- ppp-off |-- ppp-on |-- ppp-on-dialer `-- resolv.conf
0 directories, 5 files
|
利用echo测试程序,发现利用gprs发送数据没有问题。但是ping域名还是不通。另外有一个问题就是,ping测试时,time delay因为网络不同差异也比较大,有些时候可能会到18s左右。无线网络质量对数据发送的影响会非常大。
[root@listentec ~]#ifconfig eth0 down [root@listentec ~]#/etc/ppp/ppp-on & [root@listentec ~]#Serial connection established. using channel 1 Using interface ppp0 Connect: ppp0 <--> /dev/ttyS2 Warning - secret file /etc/ppp/pap-secrets has world and/or group access sent [LCP ConfReq id=0x1 <asyncmap 0x20a0000> <magic 0xc328b095> <pcomp> <accomp>] rcvd [LCP ConfRej id=0x1 <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0x20a0000> <magic 0xc328b095>] rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <auth pap> <magic 0xb7a54d00>] sent [LCP ConfAck id=0x1 <asyncmap 0x0> <auth pap> <magic 0xb7a54d00>] rcvd [LCP ConfAck id=0x2 <asyncmap 0x20a0000> <magic 0xc328b095>] Warning - secret file /etc/ppp/pap-secrets has world and/or group access sent [PAP AuthReq id=0x1 user="foo" password=<hidden>] rcvd [PAP AuthAck id=0x1 "Welcome!"] Remote message: PAP authentication succeeded sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>] sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>] rcvd [IPCP ConfReq id=0x1 <addr 10.79.158.165>] sent [IPCP ConfAck id=0x1 <addr 10.79.158.165>] rcvd [LCP ProtRej id=0x1 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f] rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>] sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>] rcvd [IPCP ConfNak id=0x2 <addr 10.79.78.138> <ms-dns1 211.136.20.203> <ms-dns3 202.96.69.38>] sent [IPCP ConfReq id=0x3 <addr 10.79.78.138> <ms-dns1 211.136.20.203> <ms-dns3 202.96.69.38>] rcvd [IPCP ConfAck id=0x3 <addr 10.79.78.138> <ms-dns1 211.136.20.203> <ms-dns3 202.96.69.38>] local IP address 10.79.78.138 remote IP address 10.79.158.165 primary DNS address 211.136.20.203 secondary DNS address 202.96.69.38
[root@listentec ~]#ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:89 errors:0 dropped:0 overruns:0 frame:0 TX packets:89 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4809 (4.6 KiB) TX bytes:4809 (4.6 KiB)
ppp0 Link encap:Point-to-Point Protocol inet addr:10.79.78.138 P-t-P:10.79.158.165 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:5 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:64 (64.0 B) TX bytes:97 (97.0 B)
| | |
阅读(1192) | 评论(0) | 转发(0) |