技术专栏
全志平台华为4G模块调试记录2
1. 前言
上篇主要是描述的需要修改的地方;
这里主要描述网络配置和调试方法
2. 修改ip-up脚本
#!/system/bin/sh
PPPD_PID_FILE=/data/system/${PHYINTERFACE}_pppd.pid
case $1 in
ppp[1-9])
/android/bin/iptables --flush;
/android/bin/iptables --table nat --flush;
/android/bin/iptables --delete-chain;
/android/bin/iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE;
/android/bin/iptables --append FORWARD --in-interface $1 -j ACCEPT;
echo 0 > /proc/sys/net/ipv4/ip_forward;
echo 1 > /proc/sys/net/ipv4/ip_forward;
;;
ppp0)
/system/bin/setprop "net.interfaces.defaultroute" "gprs";
;;
esac
#just for debug ...............shuge@allwinnertech.com
#/system/bin/log -t aw-pppoe "0: $0"
#/system/bin/log -t aw-pppoe "1: $1"
#/system/bin/log -t aw-pppoe "2: $2"
#/system/bin/log -t aw-pppoe "3: $3"
#/system/bin/log -t aw-pppoe "4: $4"
#/system/bin/log -t aw-pppoe "5: $5"
#/system/bin/log -t aw-pppoe "6: $6"
#
#/system/bin/log -t aw-pppoe "LINKNAME: $LINKNAME"
#/system/bin/log -t aw-pppoe "IFNAME: $IFNAME"
#/system/bin/log -t aw-pppoe "DEVICE: $DEVICE"
#/system/bin/log -t aw-pppoe "PPPLOGNAME: $PPPLOGNAME"
#/system/bin/log -t aw-pppoe "PPPD_PID: $PPPD_PID"
#/system/bin/log -t aw-pppoe "PEERNAME: $PEERNAME"
#/system/bin/log -t aw-pppoe "SPEED: $SPEED"
#/system/bin/log -t aw-pppoe "USEPEERDNS: $USEPEERDNS"
#/system/bin/log -t aw-pppoe "LINKINTERFACE: $LINKINTERFACE"
# Use interface name if linkname is not available
NAME="$PHYINTERFACE-"$1""
/system/bin/setprop "net.$NAME.dns1" "$DNS1"
/system/bin/setprop "net.$NAME.dns2" "$DNS2"
/system/bin/setprop "net.$NAME.local-ip" "$IPLOCAL"
/system/bin/setprop "net.$NAME.remote-ip" "$IPREMOTE"
/system/bin/setprop "net.${PHYINTERFACE}-pppoe.phyif" "$1"
/system/bin/setprop "net.${PHYINTERFACE}-pppoe.status" "started"
3. 运行huawei-ppp-on脚本
sh ./huawei-ppp-on --user=card --pwd=card --pn=*99# --auth=chap --apn=1234
正常情况下打印为:
er=card --pwd=card --pn=*99# --auth=chap --apn=1234 <
*=--user=card
--pwd*=--pwd=card
--pn*--pn=*99#
--auth*=--auth=chap
--apn*=--apn=1234
root@petrel-p1:/system/etc/ppp # abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
abort on (BUSY)
abort on (Username/Password Incorrect)
send (AT^M)
expect (OK)
AT^M^M
OK
-- got it
send (ATH0^M)
expect (OK)
^M
ATH0^M^M
OK
-- got it
send (AT+CGDCONT=1,"IP","1234"^M)
expect (OK)
^M
AT+CGDCONT=1,"IP","1234"
OK
-- got it
send (ATDT*99#^M)
expect (CONNECT)
ATDT*99#^M^M
CONNECT
-- got it
send
4. 查看虚拟网卡
执行命令busybox ifconfig,可以看到生成了ppp0网口,如下:
但是此时是无法连接互联网的,因为没有配置dns
5. 查看dns
首先看下通过pppoe报文交互获得dns是什么,利用命令获取如下:getprop | grep dns
[net.-ppp0.dns1]: [211.136.20.203]
[net.-ppp0.dns2]: [211.136.17.107]
6. 配置dsn
root@petrel-p1:/system/etc/ppp # setprop net.dns1 211.136.20.203
root@petrel-p1:/system/etc/ppp # setprop net.dns2 211.136.17.107
root@petrel-p1:/system/etc/ppp # ndc resolver setifdns ppp0 "" 211.136.20.203
200 0 Resolver command succeeded
root@petrel-p1:/system/etc/ppp # ndc resolver setdefaultif ppp0
7. ping百度
ping www.baidu.com
PING www.a.shifen.com (183.232.231.173) 56(84) bytes of data.
64 bytes from 183.232.231.173: icmp_seq=1 ttl=55 time=49.2 ms
64 bytes from 183.232.231.173: icmp_seq=2 ttl=55 time=31.4 ms
64 bytes from 183.232.231.173: icmp_seq=3 ttl=55 time=30.6 ms
64 bytes from 183.232.231.173: icmp_seq=4 ttl=55 time=29.7 ms
64 bytes from 183.232.231.173: icmp_seq=5 ttl=55 time=25.6 ms
64 bytes from 183.232.231.173: icmp_seq=6 ttl=55 time=32.8 ms
64 bytes from 183.232.231.173: icmp_seq=7 ttl=55 time=32.6 ms
64 bytes from 183.232.231.173: icmp_seq=8 ttl=55 time=28.5 ms
64 bytes from 183.232.231.173: icmp_seq=9 ttl=55 time=27.5 ms
64 bytes from 183.232.231.173: icmp_seq=10 ttl=55 time=33.8 ms
64 bytes from 183.232.231.173: icmp_seq=11 ttl=55 time=32.2 ms
64 bytes from 183.232.231.173: icmp_seq=12 ttl=55 time=31.3 ms
64 bytes from 183.232.231.173: icmp_seq=13 ttl=55 time=27.2 ms
64 bytes from 183.232.231.173: icmp_seq=14 ttl=55 time=33.6 ms
64 bytes from 183.232.231.173: icmp_seq=15 ttl=55 time=29.4 ms
64 bytes from 183.232.231.173: icmp_seq=16 ttl=55 time=31.2 ms
64 bytes from 183.232.231.173: icmp_seq=17 ttl=55 time=28.7 ms
64 bytes from 183.232.231.173: icmp_seq=18 ttl=55 time=33.5 ms
64 bytes from 183.232.231.173: icmp_seq=19 ttl=55 time=32.4 ms
64 bytes from 183.232.231.173: icmp_seq=20 ttl=55 time=30.1 ms
64 bytes from 183.232.231.173: icmp_seq=21 ttl=55 time=26.7 ms
64 bytes from 183.232.231.173: icmp_seq=22 ttl=55 time=33.5 ms
64 bytes from 183.232.231.173: icmp_seq=23 ttl=55 time=33.5 ms
64 bytes from 183.232.231.173: icmp_seq=24 ttl=55 time=28.5 ms
64 bytes from 183.232.231.173: icmp_seq=25 ttl=55 time=30.8 ms
64 bytes from 183.232.231.173: icmp_seq=26 ttl=55 time=33.6 ms
64 bytes from 183.232.231.173: icmp_seq=27 ttl=55 time=31.8 ms
64 bytes from 183.232.231.173: icmp_seq=28 ttl=55 time=29.5 ms
64 bytes from 183.232.231.173: icmp_seq=29 ttl=55 time=33.6 ms
表明手动测试,可以连接网络了。
8. 通过init.rc进行拨号
device/softwinner/petrel-p1/init.rc中可以修改如下
串口中输入setprop persist.has_LTE 1,即可进行拨号。
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
84
9
评论
打赏
- 分享
- 举报
评论
0个
手气红包
暂无数据
相关专栏
-
浏览量:7967次2021-01-08 15:04:53
-
浏览量:10272次2020-11-26 15:59:29
-
浏览量:4235次2020-09-23 19:01:05
-
浏览量:11313次2020-12-16 19:13:45
-
浏览量:8340次2021-01-20 17:16:00
-
浏览量:10989次2020-12-16 18:56:54
-
浏览量:6912次2020-11-26 17:02:47
-
浏览量:8408次2020-11-26 14:22:19
-
浏览量:10142次2021-01-22 16:07:20
-
浏览量:4860次2022-10-14 08:34:42
-
浏览量:7022次2020-09-10 09:46:52
-
浏览量:3039次2020-08-29 21:36:16
-
浏览量:9476次2020-09-28 16:42:40
-
浏览量:7122次2021-01-16 14:52:44
-
浏览量:6923次2021-01-22 15:28:47
-
浏览量:1944次2020-12-30 16:54:40
-
浏览量:14488次2021-01-16 15:43:02
-
浏览量:1352次2024-01-12 15:17:33
-
浏览量:2393次2020-09-21 19:12:37
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者
free-jdx
您的支持将鼓励我继续创作!
打赏金额:
¥1
¥5
¥10
¥50
¥100
支付方式:
微信支付
打赏成功!
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注