Difference between revisions of "How to use 4G Module on Debian"

From FriendlyELEC WiKi
Jump to: navigation, search
(Created page with "查看中文")
 
(Start Dialing)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[How to use 4G Module on Debian/zh|查看中文]]
 
[[How to use 4G Module on Debian/zh|查看中文]]
 +
 +
===How to use 4G Module on Debian===
 +
====Create the following files (Configuration for China Unicom)====
 +
* /etc/ppp/peers/quectel-pppd
 +
<syntaxhighlight lang="bash">
 +
# /etc/ppp/peers/quectel-pppd
 +
# Usage:root>pppd call quectel-pppd
 +
#Modem path, like /dev/ttyUSB3,/dev/ttyACM0, depend on your module, default path is /dev/ttyUSB3
 +
/dev/ttyUSB2 115200
 +
#Insert the username and password for authentication, default user and password are test
 +
user "test" password "test"
 +
# The chat script, customize your APN in this file
 +
connect 'chat -s -v -f /etc/ppp/peers/quectel-chat-connect'
 +
# The close script
 +
disconnect 'chat -s -v -f /etc/ppp/peers/quectel-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 30
 +
# Ask the peer for up to 2 DNS server addresses
 +
usepeerdns
 +
</syntaxhighlight>
 +
* /etc/ppp/peers/quectel-chat-connect
 +
<syntaxhighlight lang="bash">
 +
ABORT "BUSY"
 +
ABORT "NO CARRIER"
 +
ABORT "NO DIALTONE"
 +
ABORT "ERROR"
 +
ABORT "NO ANSWER"
 +
TIMEOUT 30
 +
"" AT
 +
OK ATE0
 +
OK ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2
 +
# Insert the APN provided by your network operator, default apn is 3gnet
 +
OK AT+CGDCONT=1,"IP","3gnet",,0,0
 +
OK ATD*99#
 +
CONNECT
 +
</syntaxhighlight>
 +
* /etc/ppp/peers/quectel-chat-disconnect
 +
<syntaxhighlight lang="bash">
 +
ABORT "ERROR"
 +
ABORT "NO DIALTONE"
 +
SAY "\nSending break to the modem\n"
 +
""  +++
 +
""  +++
 +
""  +++
 +
SAY "\nGoodbay\n"
 +
</syntaxhighlight>
 +
 +
====Start Dialing====
 +
<syntaxhighlight lang="bash">
 +
sudo pppd call quectel-pppd
 +
</syntaxhighlight>
 +
 +
====Set up DNS====
 +
modify the following file to add the DNS configuration:
 +
<syntaxhighlight lang="bash">
 +
vi /etc/systemd/resolved.conf
 +
</syntaxhighlight>
 +
Fill in the DNS output from pppd, for example 114.114.114.114:
 +
<syntaxhighlight lang="bash">
 +
[Resolve]
 +
DNS=114.114.114.114
 +
</syntaxhighlight>
 +
Restart systemd-resolved service:
 +
<syntaxhighlight lang="bash">
 +
sudo systemctl daemon-reload
 +
sudo systemctl restart systemd-resolved.service
 +
</syntaxhighlight>
 +
Stop other network ports if necessary:
 +
<syntaxhighlight lang="bash">
 +
sudo ifconfig eth0 down
 +
sudo ifconfig eth1 down
 +
</syntaxhighlight>

Latest revision as of 03:38, 7 August 2023

查看中文

1 How to use 4G Module on Debian

1.1 Create the following files (Configuration for China Unicom)

  • /etc/ppp/peers/quectel-pppd
# /etc/ppp/peers/quectel-pppd
# Usage:root>pppd call quectel-pppd
#Modem path, like /dev/ttyUSB3,/dev/ttyACM0, depend on your module, default path is /dev/ttyUSB3
/dev/ttyUSB2 115200
#Insert the username and password for authentication, default user and password are test
user "test" password "test"
# The chat script, customize your APN in this file
connect 'chat -s -v -f /etc/ppp/peers/quectel-chat-connect'
# The close script
disconnect 'chat -s -v -f /etc/ppp/peers/quectel-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 30
# Ask the peer for up to 2 DNS server addresses
usepeerdns
  • /etc/ppp/peers/quectel-chat-connect
ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"
TIMEOUT 30
"" AT
OK ATE0
OK ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2
# Insert the APN provided by your network operator, default apn is 3gnet
OK AT+CGDCONT=1,"IP","3gnet",,0,0
OK ATD*99#
CONNECT
  • /etc/ppp/peers/quectel-chat-disconnect
ABORT "ERROR"
ABORT "NO DIALTONE"
SAY "\nSending break to the modem\n"
""  +++
""  +++
""  +++
SAY "\nGoodbay\n"

1.2 Start Dialing

sudo pppd call quectel-pppd

1.3 Set up DNS

modify the following file to add the DNS configuration:

vi /etc/systemd/resolved.conf

Fill in the DNS output from pppd, for example 114.114.114.114:

[Resolve]
DNS=114.114.114.114

Restart systemd-resolved service:

sudo systemctl daemon-reload
sudo systemctl restart systemd-resolved.service

Stop other network ports if necessary:

sudo ifconfig eth0 down
sudo ifconfig eth1 down