admin 管理员组文章数量: 1086865
4G模块Linux PPP拨号说明
前言
对于4G模块上网拨号上网有很多方法,本文针对PPP的拨号说明,至于USB串口驱动配置,请查看前面的文章:4G模块驱动移值。
一、PPP的下载和交叉编译
ppp库文件可以去
1、解包
# tar zxvf ppp-2.4.7.tar.gz
2、配置
# cd ppp-2.4.7
# ./configure
3、编译
# make CC=arm-hismall-linux-gcc
注意:arm-hismall-linux-gcc为交叉编译器
二、ppp的内核配置和ppp拨号
1、配置内核支持ppp
# make ARCH=arm CROSS_COMPILE=arm-hismall-linux- menuconfig
[*] Device Drivers →[*] Network device support →[*] PPP (point-to-point protocol) support
2、编译内核
# make ARCH=arm CROSS_COMPILE=arm-hismall-linux- uImage
3、ppp拨号
把编译出的pppd/pppd和chat/chat拷贝到linux板中的/usr/sbin/下
通过几个不同的配置文件,在拨号的时候选择相应的配置文件,现将配置文件列举如下:
FILE:/etc/ppp/peers/bc82-pppd
#Modem path, like /dev/ttyUSB3,/dev/ttyACM0, depend on your module, default path is /dev/ttyUSB3
/dev/ttyUSB1 115200
#Insert the username and password for authentication, default user and password are test
user "" password ""
# The chat script, customize your APN in this file
connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/bc82-chat-connect'
# The close script
disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/bc82-chat-disconnect'
# Hide password in debug messages
hide-password
# The phone is not required to authenticate
noauth
# Debug info from pppd
debug
# If you want to use the HSDPA link as your gateway
defaultroute
# pppd must not propose any IP address to the peer
noipdefault
# No ppp compression
novj
novjccomp
noccp
ipcp-accept-local
ipcp-accept-remote
local
# For sanity, keep a lock on the serial line
lock
modem
dump
nodetach
# Hardware flow control
nocrtscts
remotename 3gppp
ipparam 3gppp
ipcp-max-failure 10
# Ask the peer for up to 2 DNS server addresses
usepeerdns
FILE:/etc/ppp/peers/bc82-chat-connect
ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "ERROR"
#ABORT "NO ANSWER"
TIMEOUT 10
"" AT
"OK-+++\c-OK" ATH0
OK ATE0
OK ATI;+CESQ;+CPIN?;+COPS?;+CEREG?;+CGREG?;&D2
#china unicom's apn is 3gnet
#OK AT+CGDCONT=1,"IP","3gnet",,0,0
#OK ATD*99#
#China mobile APN
OK AT+CGDCONT=1,"IP","cmnet"
#OK ATDT*99***1#
OK ATD*99#
CONNECT ""
FILE:/etc/ppp/peers/bc82-chat-disconnect
TIMEOUT 5
ABORT "ERROR"
ABORT "NO DIALTONE"
ABORT "NO CARRIER"
#SAY "\nSending break to the modem\n"
"" "+++\c"
OK "ATH0"
SAY "\nGoodbay\n"
编辑好这几个文件之后,便可以通过pppd进行拨号:
# pppd call bc82-pppd &
如果拨号成功会有以下信息打印出来:
此时通过ifconfig命令查看网卡就有一个ppp0网卡出现,就可以用模块连接到互联网了
本文标签: 4G模块Linux PPP拨号说明
版权声明:本文标题:4G模块Linux PPP拨号说明 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1700349888a408476.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论