当前位置:网站首页>Quectel EC20 4G module dial related
Quectel EC20 4G module dial related
2022-08-09 06:32:00 【qq_36412526】
1.ec20dial method
The following is an excerpt from Quectel's documentation:
有2method to startppp拨号
方式1: 拷贝 quectel-chat-connect quectel-chat-disconnect quectel-ppp 到 /etc/ppp/peers 目录下.
并在 quectel-ppp Modify your serial device name here,pppd used for dialing username,password.
在 quectel-chat-connect to modify yours APN.APN/username/password is obtained from your network provider.
然后使用下面的命令启动 ppp 拨号, 命令最后的 & 可以让 pppd 后台运行
pppd call quectel-ppp &
方式2:使用quectel-pppd.sh 拨号,命令形式如下:
./quectel-pppd.sh 串口设备名(比如/dev/ttyUSB3) APN username password
ip-up:pppd 在获取 ip 和 dns 之后,This script file is automatically called to set up the system DNS
Embedded systems generally need to copy this file to /etc/ppp 目录下.
Make sure the file has executable permissions on your system.
quectel-ppp-kill Used to hang up dialing,pppdMust be hung up normally,Otherwise it may cause you next timeppp拨号失败.
Use the following method to call this script
./quectel-ppp-kill
2.ec20模块ppp拨号流程
3.Dial was successful but notping通外网
The dialing was successful but not connectedppp0设置为静态路由.设置PPP0为默认路由:Delete the original route first,route del default 再将ppp0设置为默认路由,route add default dev ppp0
为了实现自动设置ppp0为默认路由,我的方法是在/etc/ppp/ip-up脚本里添加
[email protected]:/etc/ppp# cat ip-up
#!/bin/sh
if [ -f /etc/ppp/resolv.conf ]; then
cp /etc/ppp/resolv.conf /etc/resolv.conf
elif [ -f /var/run/ppp/resolv.conf ]; then
cp /var/run/ppp/resolv.conf /etc/resolv.conf
else
echo nameserver $DNS1 > /etc/resolv.conf
echo nameserver $DNS2 >> /etc/resolv.conf
fi
route del default #Delete the original route
route add default dev ppp0 #设置ppp0为默认路由
Check routing information after dialing is successful:
n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
10.5.112.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
可见,ppp0The routing information has been added successfully,这时候再ping www.baidu.com,成功
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=14 ttl=54 time=33.2 ms
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=15 ttl=54 time=41.2 ms
4.关于ip-up和ip-up.d的说明
1. /etc/ppp/ip-up 由 ppp 套件 提供
1-1. sudo dpkg -S /etc/ppp/ip-up
ppp: /etc/ppp/ip-up
2. /etc/ppp/ip-up.d 可以由
ppp, resolvconf, pppconfig, pppoeconf, gogoc
Either kit is available
2-1. sudo dpkg -S /etc/ppp/ip-up.d
ppp, resolvconf, pppconfig, pppoeconf, gogoc: /etc/ppp/ip-up.d
3. /etc/ppp/ip-up 是 檔案; /etc/ppp/ip-up.d 是 目錄
3-1. sudo ls -Al /etc/ppp | grep ip-up
-rwxr-xr-x 1 root root 1892 2月 4 2011 ip-up
drwxr-xr-x 2 root root 4096 7月 24 12:53 ip-up.d
3-2. sudo ls -Al /etc/ppp/ip-up.d
-rwxr-xr-x 1 root root 902 2月 4 2011 0000usepeerdns
-rwxr-xr-x 1 root root 553 6月 4 2015 000resolvconf
-rwxr-xr-x 1 root root 4022 10月 24 2015 0dns-up
-rwxr-xr-x 1 root root 148 3月 30 2010 gogoc
4. 都是 可執行 script file
4-1. sudo cat /etc/ppp/ip-up
#!/bin/sh
以下省略
4-2. sudo cat /etc/ppp/ip-up.d/0000usepeerdns
#!/bin/sh -e
以下省略
5.关闭ppp0The default route of Ethernet is restored after connection,Otherwise, Ethernet will not work(???)
My solution to this problem is in ip-downadded to the scriptservice networking restart
修改后的ip-down脚本如下
[email protected]:/etc/ppp# cat ip-down
#!/bin/sh
#
# This script is run by the pppd _after_ the link is brought down.
# It uses run-parts to run scripts in /etc/ppp/ip-down.d, so to delete
# routes, unset IP addresses etc. you should create script(s) there.
#
# Be aware that other packages may include /etc/ppp/ip-down.d scripts (named
# after that package), so choose local script names with that in mind.
#
# This script is called with the following arguments:
# Arg Name Example
# $1 Interface name ppp0
# $2 The tty ttyS1
# $3 The link speed 38400
# $4 Local IP number 12.34.56.78
# $5 Peer IP number 12.34.56.99
# $6 Optional ``ipparam'' value foo
# The environment is cleared before executing this script
# so the path must be reset
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
export PATH
# These variables are for the use of the scripts run by run-parts
PPP_IFACE="$1"
PPP_TTY="$2"
PPP_SPEED="$3"
PPP_LOCAL="$4"
PPP_REMOTE="$5"
PPP_IPPARAM="$6"
export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
# as an additional convenience, $PPP_TTYNAME is set to the tty name,
# stripped of /dev/ (if present) for easier matching.
PPP_TTYNAME=`/usr/bin/basename "$2"`
export PPP_TTYNAME
# If /var/log/ppp-ipupdown.log exists use it for logging.
if [ -e /var/log/ppp-ipupdown.log ]; then
exec >> /var/log/ppp-ipupdown.log 2>&1
echo $0 [email protected]
echo
fi
# This script can be used to override the .d files supplied by other packages.
if [ -x /etc/ppp/ip-down.local ]; then
exec /etc/ppp/ip-down.local "[email protected]"
fi
run-parts /etc/ppp/ip-down.d \
--arg="$1" --arg="$2" --arg="$3" --arg="$4" --arg="$5" --arg="$6"
service networking restart
Check the routing information as follows:
[email protected]:/etc/ppp# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.5.112.254 0.0.0.0 UG 0 0 0 eth0
10.5.112.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
It can be seen that it has been restoredeth0的默认路由
边栏推荐
- How to find package information and pin definitions for NXP S32K1xx series microcontrollers
- 深度学习-神经网络原理2
- 程序性能分析 —— 复杂度分析
- 像天才一样思考:如何培养自己的创造力?
- Deep Learning - Principles of Neural Networks 2
- Teach you how to make the Tanabata meteor shower in C language - elegant and timeless (detailed tutorial)
- TCP segment of a reassembled PDU
- io.lettuce.core.RedisCommandTimeoutException Command timed out
- uniapp实现防抖搜索
- 按图搜索1688商品接口(item_search_img-按图搜索1688商品(拍立淘接口)代码对接教程
猜你喜欢
idea中PlantUML插件使用
zip压缩包密码解密
jvm线程状态
Cysteine/Galactose/Perylenediimide Functionalized Fe3O4 Fe3O4 Nanomaterials | Scientific Research Reagents
sql problem solving statement to create a table
字节跳动笔试题2020 (抖音电商)
中英文说明书丨TRC D-阿卓糖(D-Altrose)
Altium designer软件常用最全封装库,包含原理图库、PCB库和3D模型库
leetcode 之 零移位
Search 1688 product interface by image (item_search_img-search 1688 product by image (Politao interface) code docking tutorial
随机推荐
2022-08-08: Given an array arr, it represents the height of the missiles that will appear in order from morning to night.When the cannon shoots missiles, once the cannon is set to shoot at a certain h
sql问题解答创建表的语句
Use baidu EasyDL intelligent bin
jdepend
Cysteine/Galactose/Perylenediimide Functionalized Fe3O4 Fe3O4 Nanomaterials | Scientific Research Reagents
idea中PlantUML插件使用
Data center project preliminary summary
shardingsphere data sharding configuration item description and example
XxlJobConfig分布式定时器任务管理XxlJob配置类,替代
字节跳动面试题之镜像二叉树2020
P6阿里机试题之2020 斐波那契数
The singleton pattern
Output method of list string print(*a) print(““.join(str(c) for c in a) )
pycharm环境包导入到另外一个环境
PDF不能打印和复制的问题如何解决?
redis 运行lua 脚本 出现Invalid argument(s)
leetcode 之 零移位
Unity 五子棋游戏设计和简单AI(3)
Remember a nest.js route that matches all the path problems that follow
Excel受保护的工作表怎么操作?