SIM7600CE TCP/IP连接与PPP拨号上网

SIM7600CE联网测试分为两部分:

1、TCP/IP连接

2、PPP拨号上网

实验环境:ubuntu-meta 16.04

硬件:树莓派3B,SIM7600CE

上网卡:移动的NB-IOT物联网卡

微雪官方教程:http://www.waveshare.net/wiki/SIM7600CE_4G_HAT

把模块插入到树莓派,并USB接口连到树莓派USB口上,开机,如下图所示:

SIM7600CE TCP/IP连接与PPP拨号上网_第1张图片

 使用SIM7600CE模块之前,需要对树莓派引脚初始化

 

1. TCP/IP连接

 

 

 

2. ppp拨号软件安装与配置

安装ppp

sudo apt-get install ppp

新建一个script脚本

cd /etc/ppp/peers
cp provider gprs

 修改gprs配置文件

nano gprs

修改内容如下:

# example configuration for a dialup connection authenticated with PAP or CHAP
#
# This is the default configuration used by pon(1) and poff(1).
# See the manual page pppd(8) for information on all the options.

# MUST CHANGE: replace myusername@realm with the PPP login name given to
# your by your provider.
# There should be a matching entry with the password in /etc/ppp/pap-secrets
# and/or /etc/ppp/chap-secrets.
user "myusername@realm"

# MUST CHANGE: replace ******** with the phone number of your provider.
# The /etc/chatscripts/pap chat script may be modified to change the
# modem initialization string.
connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs"

# Serial device to which the modem is connected.
/dev/ttyUSB2 #由于我们使用SIM7600CE的4G模块,并且该模块的驱动已经默认添加到raspbian的内核的,ttyUSB2为ppp的拨号端口

# Speed of the serial line.
115200

nocrtscts  #增加
debug  #增加
nodetach #增加
ipcp-accept-local #增加
ipcp-accept-remote #增加


# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
usepeerdns
# Use this connection as the default route.
defaultroute

# Makes pppd "dial again" when the connection is lost.
persist

 # Do not ask the remote to authenticate.
 noauth

查看SIM7600CE的串口

ls /dev/ttyUSB*

使用minicom串口调试工具简单测试(如果未安装使用 sudo apt-get install minicom 进行安装)

连接 /dev/ttyUSB2 串口调试

minicom -D /dev/ttyUSB2

调试过程如下:

AT
OK
AT+CSQ
+CSQ: 21,99

OK
AT+CPIN?
+CPIN: READY

OK
AT+COPS?
+COPS: 1,0,"CHINA MOBILE CMCC",7

OK
AT+CREG?
+CREG: 0,1

OK
AT+CPSI?
+CPSI: LTE,Online,460-00,0x69B1,132648988,136,EUTRAN-BAND40,38950,5,5,-65,-988,8

OK
AT+CEREG?
+CEREG: 0,1

OK

SIM7600CE TCP/IP连接与PPP拨号上网_第2张图片

调试完成退出。

查看网卡信息

ifconfig

 SIM7600CE TCP/IP连接与PPP拨号上网_第3张图片

开始拨号

pppd call gprs

 拨号成功!

 SIM7600CE TCP/IP连接与PPP拨号上网_第4张图片

再次查看网卡信息:

SIM7600CE TCP/IP连接与PPP拨号上网_第5张图片

可以看到多出ppp0网卡,即成功拨号,并获得一个临时IP。

 

转载于:https://www.cnblogs.com/little-kwy/p/11296426.html

你可能感兴趣的:(SIM7600CE TCP/IP连接与PPP拨号上网)