ubuntu-16.04 华为模块 4G Sim卡 上网
参考资料:
https://blog.csdn.net/wowocpp/article/details/90080331
ubuntu-16.04.5-desktop-amd64.iso
淘宝购买机器:研凌工控
安装之后,执行如下命令:
安装 ssh server服务:
sudo apt-get install openssh-server
为root 账户 设置密码:
sudo passwd root
安装4G 拨号软件:
apt-get install wvdial
apt-get install usb-modeswitch
使用 移动 4G卡:
sudo vi /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0
Init3 = AT+CGDCONT=1,"IP","3gnet"
Modem Type = Analog Modem
Baud = 9600
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Phone = *99#
Password = guest
Username = guest
Auto Reconnect = on
Auto DNS = on
启动的时候,delete键 进入BIOS
然后 设置Chipset -->OS Selection 设置为windows 8.x
只有安装windows7的时候,才能选择windows 7
其他的时候都选择 windows 8.x
参考网址:
https://blog.csdn.net/qq_16775293/article/details/83349652
https://blog.csdn.net/jiaojian8063868/article/details/79295570
lsusb:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 006: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 005: ID 12d1:15c1 Huawei Technologies Co., Ltd.
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 002: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
ls /dev/ttyUSB*
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3 /dev/ttyUSB4
拨号测试
输入下述命令测试ME909s模块拨号情况,拨号成功则证明手机卡可以借助ME909s模块使用。
sudo wvdial hw1
1
若配置wvdial.conf文件时没有修改文件名,即wvdial.conf文件开头
[Dialer Default]
1
则拨号测试命令为
sudo wvdial
1
输入该命令后需要等待一段时间,一般30s左右,如果没有错误信息或停止,一直等下去
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
ERROR
G
EATZ
TPO
OK
RT
--> Sending: ATQ0 V1 E1 S0=0
MATQ0 V1 E1 S0=0
OK
--> Sending: AT+CGDCONT=1,"IP","4gnet"
AT+CGDCONT=1,"IP","4gnet"
O
OK
D
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
EATDT*99#
CONNECT 150000000
--> Carrier detected. Waiting for prompt.
--> Don't know what to do! Starting pppd and hoping for the best.
--> Starting pppd at Tue Oct 23 15:21:28 2018
--> Pid of pppd: 1264
--> Using interface ppp0
--> pppd: €[01]a
--> pppd: €[01]a
--> pppd: €[01]a
--> pppd: €[01]a
--> pppd: €[01]a
--> local IP address 10.140.14.89
--> pppd: €[01]a
--> remote IP address 10.64.64.64
--> pppd: €[01]a
--> primary DNS address 221.179.38.7
--> pppd: €[01]a
--> secondary DNS address 120.196.165.7
--> pppd: €[01]a
Caught signal 15: Attempting to exit gracefully...
--> Terminating on signal 15
--> pppd: €[01]a
--> Connect time 0.5 minutes.
--> pppd: €[01]a
--> pppd: €[01]a
--> pppd: €[01]a
若出现名字为ppp0的网卡设备,并且已经获得IP地址,证明ME909s模块初始化成功,是WIFI或有线网的影响导致,则修改路由表:
2.2.查看路由表
route -n
1
信息可能如下:
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 eth0
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
1
2
3
4
5
可以看出访问未知目标时,使用的是eth0的网卡,此处我们将其修改为使用ppp0来访问未知目标:
2.3.删除eth0的第一条路由信息:
sudo route del –net 0.0.0.0 eth0
1
新增一条ppp0的路由信息:
sudo route add –net 0.0.0.0 ppp0
1
修改后路由信息为:
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.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
1
2
3
4
5
6
此时再次尝试ping外网。
tencab 66321
Huawei ME906s LTE M.2 Module
sudo vi /lib/systemd/system/systemd-networkd-wait-online.service
ExecStart=/lib/systemd/systemd-networkd-wait-online --timeout=10
该脚本 支持 电信4G卡 和 移动4G卡
/etc$ sudo wvdial hw1
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0
ATQ0 V1 E1 S0=0
OK
--> Sending: AT+CGDCONT=1,"IP","3gnet"
AT+CGDCONT=1,"IP","3gnet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 150000000
--> Carrier detected. Waiting for prompt.
--> Don't know what to do! Starting pppd and hoping for the best.
--> Starting pppd at Fri May 17 09:07:12 2019
--> Pid of pppd: 1894
--> Using interface ppp0
--> pppd: KV
--> pppd: KV
--> pppd: KV
--> pppd: KV
--> pppd: KV
--> pppd: KV
--> local IP address 10.107.28.233
--> pppd: KV
--> remote IP address 10.64.64.64
--> pppd: KV
--> primary DNS address 211.137.191.27
--> pppd: KV
--> secondary DNS address 218.201.96.131
--> pppd: KV
sudo route del –net 0.0.0.0 enp4s0
sudo route add –net 0.0.0.0 ppp0
sudo wvdial hw1 & — 后台 执行
华为909S-821
wvdial arm移植笔记
https://blog.csdn.net/xiaohui1983/article/details/7105270