Manually configure scripts under ubantu to enable 3G module access

Source: Internet
Author: User

WCDMA


This section uses the huawei em770w module and China Unicom WCDMA.

Pppd script


Pppd scripts are stored in the/etc/ppp/peers/directory by default. For example

File name
Use commands
# Pppd call wcdma
In this way, the pppd program is started.


The role of the pppd program is to establish a protocol and generate the network interface ppp0 (if the first one). The following isPppd call script
Example:

#/Etc/ppp/peers/wcdma
# This is pppd script, used Huawei EM770W (Union)
/Dev/ttyUSB0
115200
Crtscts
Modem
Debug
Nodetach
Usepeerdns
Defaultroute
User "3 gnet"
0.0.0.0: 0.0.0.0
Connect '/usr/sbin/chat-s-v-f/etc/ppp/wcdma-connect-chat'

For more information about pppd, use linux to help man pppd

The following describes some important parameters.
Parameter meaning
/Dev/ttyUSB0 interface
115200 interface baud rate
Crtscts interface with hardware traffic control
The modem parameter allows the pppd process to wait for the CD (Carrier Detect) signal sent back by the module
Local is the opposite.
Debug output debugging information
Nodetach does not run in the background. It runs in the background by default.
Usepeerdns use dns
The local and remote ip addresses of defaultroute are set to 0, so that the access isp allocates a local ip address.
User "login net" user name
Connect '...' calls the connection chat script

Chat script

The chat script is the script for sending and receiving real AT commands. Below is a chat script

#/Etc/ppp/wcdma-connect-chat
TIMEOUT 5
ABORT "DELAYED"
ABORT "BUSY"
ABORT "ERROR"
ABORT "no dialtone"
ABORT "no carrier"
#"
# 'OK-++ \ c-OK' ATH0
TIMEOUT 5
ECHO OFF
''At
OK AT + CGDCONT = 1, "IP", "3 gnet", 0, 0
OK ATDT * 99 #
CONNECT''

# Pppd call wcdma

If you want to see the information on the terminal, select nodetach in the pppd script. Otherwise, pppd runs in the background and the terminal does not display any information, in this way, you can view the/var/log/ppp-connect-errors record to understand the program running process. $ Tail-100/Var/log/ppp-connect-errors

If no error occurs

Timeout set to 5 seconds
Abort on (DELAYED)
Abort on (BUSY)
Abort on (ERROR)
Abort on (no dialtone)
Abort on (no carrier)
Timeout set to 5 seconds
Send (^ MAT ^ M)
CT (OK)
A ^ M
OK
-- Got it
Send (AT + CGDCONT = 1, "IP", "3 gnet", 0, 0 ^ M)
CT (OK)
^ M
AT + CGDCONT = 1, "IP", "3 gnet", 0, 0 ^ M
OK
-- Got it
Send (ATDT * 99 # ^ M)
Secondary CT (CONNECT)
^ M
ATDT * 99 # ^ M
CONNECT
-- Got it
Send (^ M)
Serial connection established.
Using channel 9
Using interface ppp0
Connect: ppp0 <-->/dev/ttyUSB0
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0xf5d87df8> <pcomp> <accomp>]
Rcvd [LCP ConfReq id = 0x20 <asyncmap 0x0> <auth chap MD5> <magic 0x172fd2b> <pcomp>
<Accomp>]
No auth is possible
Sent [LCP ConfRej id = 0x20 <auth chap MD5>]
Rcvd [LCP ConfAck id = 0x1 <asyncmap 0x0> <magic 0xf5d87df8> <pcomp> <accomp>]
Rcvd [LCP ConfReq id = 0x21 <asyncmap 0x0> <magic 0x172fd2b> <pcomp> <accomp>]
Sent [LCP ConfAck id = 0x21 <asyncmap 0x0> <magic 0x172fd2b> <pcomp> <accomp>]
Sent [CCP ConfReq id = 0x1 <deflate 15> <deflate (old #) 15> <bsd v1 15>]
Sent [IPCP ConfReq id = 0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3
0.0.0.0>]
Rcvd [LCP DiscReq id = 0x22 magic = 0x172fd2b]
Rcvd [LCP ProtRej id = 0x23 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Protocol-Reject for 'compression Control Protocol' (0x80fd) Unbound ed
Rcvd [IPCP ConfNak id = 0x1 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins
10.11.12.13> <ms-wins 10.11.12.14>]
Sent [IPCP ConfReq id = 0x2 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13>
<Ms-dns3 10.11.12.14>]
Rcvd [IPCP ConfNak id = 0x2 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins
10.11.12.13> <ms-wins 10.11.12.14>]
Sent [IPCP ConfReq id = 0x3 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13>
<Ms-dns3 10.11.12.14>]
Rcvd [IPCP ConfReq id = 0x10]
Sent [IPCP ConfNak id = 0x10 <addr 0.0.0.0>]
Rcvd [IPCP ConfRej id = 0x3 <compress VJ 0f 01>]
Sent [IPCP ConfReq id = 0x4 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
Rcvd [IPCP ConfReq id = 0x11]
Sent [IPCP ConfAck id = 0x11]
Rcvd [IPCP ConfNak id = 0x4 <addr 172.20.0000208> <ms-dns1 202.99.160.68> <ms-dns3
202.99.166.4>]
Sent [IPCP ConfReq id = 0x5 <addr 172.20.0000208> <ms-dns1 202.99.160.68> <ms-dns3
202.99.166.4>]
Rcvd [IPCP ConfAck id = 0x5 <addr 172.20.0000208> <ms-dns1 202.99.160.68> <ms-dns3
202.99.166.4>]
Cocould not determine remote IP address: defaulting to 10.64.64.64
Not replacing existing default route via 192.168.8.254
Local IP address 172.20.0000208
Remote IP address 10.64.64.64
Primary DNS address 202.99.160.68
Secondary DNS address 202.99.166.4

$ Ifconfig: ppp0

If

Serial connection established.
Using channel 3
Using interface ppp0
Connect: ppp0 <-->/dev/ttyUSB2
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
Sent [LCP ConfReq id = 0x1 <asyncmap 0x0> <magic 0x29df6e1f> <pcomp> <accomp>]
LCP: timeout sending Config-Requests
Connection terminated.

Or

Send (ATDT * 99 # ^ M)
Secondary CT (CONNECT)
^ M
ATDT * 99 # ^ M
NO CARRIER
-- Failed
Failed (no carrier)

You can try to change the ttyUSB port number. The default value is the first virtual port, which is ttyUSB0.

Manually configure scripts under ubantu to enable 3G module access

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.