1. 加入内核支持:
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
PPP Deflate compression
PPP BSD-Compress compression
2. 下载ppp
wget -c ftp://ftp.samba.org/pub/ppp/ppp-2.4.5.tar.gz
3. 交叉编译
# ./configure
# make CC=arm-linux-gcc
4. 将目录下pppd chat pppdump pppstats下可执行程序pppd, chat, pppdump, pppstats拷贝到开发板/usr/sbin目录下
5. mkdir /etc/ppp; mkdir /etc/ppp/peers
然后建立如下4个文件:
1)/etc/ppp/peers/gprs
/dev/s3c2410_serial1
115200
nocrtscts ##important! 一定要注意这里,开发板与PC机不同,没有硬件流控,导致我chat总是没有回应,折腾了一上午才发现!
nodetach ##去掉该项,拨号就在后台运行。
noauth
usepeerdns
noipdefault
ipcp-accept-local
ipcp-accept-remote
defaultroute
user itlanger
connect '/usr/sbin/chat -s -v -f /etc/ppp/chat-gprs-connect'
2) /etc/ppp/chat-gprs-connect
TIMEOUT 5
ECHO ON
ABORT '\nBUSY\r'
ABORT '\nERROR\r'
ABORT '\nNO ANSWER\r'
ABORT '\nNO CARRIER\r'
ABORT '\nNO DIALTONE\r'
TIMEOUT 5
'' AT
OK ATE0
TIMEOUT 60
SAY "Press CTRL-C to break the connection process.\n"
OK AT+CGREG=1
OK AT+CGATT=1
OK 'AT+CGDCONT=1,"IP","CMNET"'
OK AT+CGQMIN=1,0,0,0,0,31
OK AT+CGACT=1,1
OK ATDT*99***1#
TIMEOUT 60
SAY "Waiting for connect...\n"
CONNECT ''
SAY "Connect Success!\n"
3) /etc/ppp/pap-secrets
itlanger * ''
4) /etc/ppp/chap-secrets
itlanger * ''
6. 进行拨号连接:
[root@srp-arm /]# /usr/sbin/pppd call gprs
timeout set to 5 seconds
abort on (\nBUSY\r)
abort on (\nERROR\r)
abort on (\nNO ANSWER\r)
abort on (\nNO CARRIER\r)
abort on (\nNO DIALTONE\r)
timeout set to 5 seconds
send (AT^M)
expect (OK)
^M
OKOK
-- got it
send (ATE0^M)
timeout set to 60 seconds
Press CTRL-C to break the connection process.
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGREG=1^M)
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGATT=1^M)
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGDCONT=1,"IP","CMNET"^M)
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGQMIN=1,0,0,0,0,31^M)
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGACT=1,1^M)
expect (OK)
^M
^M
OKOK
-- got it
send (ATDT*99***1#^M)
timeout set to 60 seconds
Waiting for connect...
expect (CONNECT)
^M
^M
CONNECTCONNECT
-- got it
send (^M)
Connect Success!
Serial connection established.
Using interface ppp0
Connect: ppp0 <--> /dev/s3c2410_serial1
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
Warning - secret file /etc/ppp/chap-secrets has world and/or group access
CHAP authentication succeeded
CHAP authentication succeeded
not replacing existing default route via 192.168.0.1
local IP address 10.24.19.4
remote IP address 192.168.254.254
primary DNS address 211.137.160.5
secondary DNS address 211.136.17.107
7. 解决问题:
1)解决出现的警告:
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
Warning - secret file /etc/ppp/chap-secrets has world and/or group access
只要去掉这两个文件的权限即可:
chmod 600 /etc/ppp/*-secrets
2) 后台拨号:
去掉gprs文件中的nodetach
并且 mkdir /var/log
3)关闭ppp连接
在控制终端中用CTRL-C就可以断开连接
在后台可以用如下脚本文件实现: /etc/ppp/ppp-off
#!/bin/sh
if [ -r /var/run/ppp0.pid ]; then
kill -INT `cat /var/run/ppp0.pid`
fi
if [ ! "$?" = "0" ]; then
rm -f /var/run/ppp0.pid
echo "ERROR: close ppp0 failed!"
exit 1
fi
echo "SUCCESS: ppp0 was closed!"
exit 0
8. 发现使用ppp拨号后,就再也不用AT指令建立socket连接了,方便多了。
哈哈。。。
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
PPP Deflate compression
PPP BSD-Compress compression
2. 下载ppp
wget -c ftp://ftp.samba.org/pub/ppp/ppp-2.4.5.tar.gz
3. 交叉编译
# ./configure
# make CC=arm-linux-gcc
4. 将目录下pppd chat pppdump pppstats下可执行程序pppd, chat, pppdump, pppstats拷贝到开发板/usr/sbin目录下
5. mkdir /etc/ppp; mkdir /etc/ppp/peers
然后建立如下4个文件:
1)/etc/ppp/peers/gprs
/dev/s3c2410_serial1
115200
nocrtscts ##important! 一定要注意这里,开发板与PC机不同,没有硬件流控,导致我chat总是没有回应,折腾了一上午才发现!
nodetach ##去掉该项,拨号就在后台运行。
noauth
usepeerdns
noipdefault
ipcp-accept-local
ipcp-accept-remote
defaultroute
user itlanger
connect '/usr/sbin/chat -s -v -f /etc/ppp/chat-gprs-connect'
2) /etc/ppp/chat-gprs-connect
TIMEOUT 5
ECHO ON
ABORT '\nBUSY\r'
ABORT '\nERROR\r'
ABORT '\nNO ANSWER\r'
ABORT '\nNO CARRIER\r'
ABORT '\nNO DIALTONE\r'
TIMEOUT 5
'' AT
OK ATE0
TIMEOUT 60
SAY "Press CTRL-C to break the connection process.\n"
OK AT+CGREG=1
OK AT+CGATT=1
OK 'AT+CGDCONT=1,"IP","CMNET"'
OK AT+CGQMIN=1,0,0,0,0,31
OK AT+CGACT=1,1
OK ATDT*99***1#
TIMEOUT 60
SAY "Waiting for connect...\n"
CONNECT ''
SAY "Connect Success!\n"
3) /etc/ppp/pap-secrets
itlanger * ''
4) /etc/ppp/chap-secrets
itlanger * ''
6. 进行拨号连接:
[root@srp-arm /]# /usr/sbin/pppd call gprs
timeout set to 5 seconds
abort on (\nBUSY\r)
abort on (\nERROR\r)
abort on (\nNO ANSWER\r)
abort on (\nNO CARRIER\r)
abort on (\nNO DIALTONE\r)
timeout set to 5 seconds
send (AT^M)
expect (OK)
^M
OKOK
-- got it
send (ATE0^M)
timeout set to 60 seconds
Press CTRL-C to break the connection process.
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGREG=1^M)
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGATT=1^M)
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGDCONT=1,"IP","CMNET"^M)
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGQMIN=1,0,0,0,0,31^M)
expect (OK)
^M
^M
OKOK
-- got it
send (AT+CGACT=1,1^M)
expect (OK)
^M
^M
OKOK
-- got it
send (ATDT*99***1#^M)
timeout set to 60 seconds
Waiting for connect...
expect (CONNECT)
^M
^M
CONNECTCONNECT
-- got it
send (^M)
Connect Success!
Serial connection established.
Using interface ppp0
Connect: ppp0 <--> /dev/s3c2410_serial1
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
Warning - secret file /etc/ppp/chap-secrets has world and/or group access
CHAP authentication succeeded
CHAP authentication succeeded
not replacing existing default route via 192.168.0.1
local IP address 10.24.19.4
remote IP address 192.168.254.254
primary DNS address 211.137.160.5
secondary DNS address 211.136.17.107
7. 解决问题:
1)解决出现的警告:
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
Warning - secret file /etc/ppp/chap-secrets has world and/or group access
只要去掉这两个文件的权限即可:
chmod 600 /etc/ppp/*-secrets
2) 后台拨号:
去掉gprs文件中的nodetach
并且 mkdir /var/log
3)关闭ppp连接
在控制终端中用CTRL-C就可以断开连接
在后台可以用如下脚本文件实现: /etc/ppp/ppp-off
#!/bin/sh
if [ -r /var/run/ppp0.pid ]; then
kill -INT `cat /var/run/ppp0.pid`
fi
if [ ! "$?" = "0" ]; then
rm -f /var/run/ppp0.pid
echo "ERROR: close ppp0 failed!"
exit 1
fi
echo "SUCCESS: ppp0 was closed!"
exit 0
8. 发现使用ppp拨号后,就再也不用AT指令建立socket连接了,方便多了。
哈哈。。。