1、编辑内核,使其支持PPP拨号上网
make menuconfig
Device Drivers ---> Network device support --->
│ │ [*] PPP multilink support (EXPERIMENTAL) │ ││ │ [*] PPP filtering │ │
│ │ <*> PPP support for async serial ports │ │
│ │ <*> PPP support for sync tty ports │ │
│ │ <*> PPP Deflate compression │ │
│ │ <*> PPP BSD-Compress compression │ │
│ │ <*> PPP MPPE compression (encryption) (EXPERIMENTAL) │ │
│ │ <*> PPP over Ethernet (EXPERIMENTAL) │ │
│ │ <*> PPP (point-to-point protocol) support │ │
2、下载ppp-2.4.4.tar.gz
3、解压ppp-2.4.4.tar.gz文件
[huangan@localhost 3rdparty]$ tar -xzf ppp-2.4.4.tar.gz
[huangan@localhost ppp-2.4.4]$ ls
Changes-2.3 etc.ppp modules README README.MSCHAP80 scripts
chat FAQ PLUGINS README.cbcp README.MSCHAP81 SETUP
common include pppd README.eap-srp README.pppoe solaris
configure linux pppdump README.linux README.pwfd
contrib Makefile pppstats README.MPPE README.sol2
Changes-2.3 etc.ppp modules README README.MSCHAP80 scripts
chat FAQ PLUGINS README.cbcp README.MSCHAP81 SETUP
common include pppd README.eap-srp README.pppoe solaris
configure linux pppdump README.linux README.pwfd
contrib Makefile pppstats README.MPPE README.sol2
[huangan@localhost ppp-2.4.4]$ ./configure
。。。省略过程
[huangan@localhost ppp-2.4.4]$ make CC=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc
。。。省略过程
编译结束后,会在chat 、pppd、pppdump、pppstats 四个目录下生成四个可执行文件,将他们移植到开发板上的\usr\sbin 路径下并给他们777的权限即可
4、制作脚本文件
vi /etc/ppp/peers/gprs
#set serialPort
/dev/ttyS1
#set buadrate
115200
#set flowdate
nocrtscts
#to keep ppp on terminal
nodetach
# Accept the peer's idea of our local IP address
ipcp-accept-local
# Accept the peer's idea of its (remote) IP address
ipcp-accept-remote
#dial up connetion as the default route
noauth
usepeerdns
noipdefault
defaultroute
user itlanger
connect '/usr/sbin/chat -s -v -f /etc/ppp/chat-gprs-connect'
vi /etc/ppp/chat-gprs-connect
ABORT '\nBUSY\r'
ABORT '\nERROR\r'
ABORT '\nNO ANSWER\r'
ABORT '\nNO CARRIER\r'
ABORT '\nNO DIALTONE\r'
TIMEOUT 5
'' AT
OK ATE0
SAY "Press CTRL-C to break the connection process.\n"
OK 'AT+CGDCONT=1,"IP","CMNET"'
OK ATDT*99***1# //这里要改成自己的运营商号码。。我的这个号码是移动的
SAY "Waiting for connect...\n"
CONNECT ''
SAY "Connect Success!\n"
5、开始测试
:>pppd call gprs& (PS:& 是让这条命令在后台执行,这样我们才好去执行其他验证命令)
:>ping www.baidu.com
假如出现能ping通DNS 4.2.2.2 确ping不通百度 ,那就是DNS的问题
解决办法:vim /etc/resolv.conf
nameserver 4.2.2.2
nameserver 8.8.8.8
OK