Manually using GPRS

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (Added Cingular WAP)
(clean up to work for me too)
Line 1: Line 1:
You need to have GSM parts already initialized, with modem logged in to the network, for this to work. It is best to test it by doing test call.
+
You need to have GSM parts already initialized, with modem logged in to the network, for this to work. It is best to test it by doing test call. The GPRS connection is made using the PPP protocol to a server identified by an "APN" at the network operator.
  
You'll need /etc/ppp/chap-secrets: (I used tabs in this file, I hope that does not matter).
+
Depending on the APN, you may need password authentication using CHAP or PAP. You can add the following default line for "password-less" connections:
Or /etc/ppp/pap-secret if you need PAP.
+
 
<pre>
 
<pre>
# Secrets for authentication using CHAP
 
 
# client        server  secret                  IP addresses
 
# client        server  secret                  IP addresses
  "gprs"        *       "gprs"                  *
+
*               *      ""                     *
 
+
## opt in for eplus
+
#  "eplus"      *      "gprs"                 *
+
 
</pre>
 
</pre>
  
 +
For CHAP, lines in /etc/ppp/chap-secrets are used. For PAP, the lines are in /etc/ppp/pap-secrets. The client should match the "user" option in pppd the config file (below). You can use * to mean any here, but the option user "" doesn't mean empty!
 +
 +
For example:
 +
<pre>
 +
# Secrets for authentication using CHAP
 +
# client        server  secret                  IP addresses
 +
*              *      ""                      *
 +
"gprs"          *      "gprs"                  *
 +
"eplus"        *      "gprs"                  * 
 +
</pre>
  
You'll need /etc/ppp/gprs:
+
You'll need /etc/ppp/peers/gprs:
 
<pre>
 
<pre>
 
# File:
 
# File:
Line 40: Line 45:
  
 
# Connect script
 
# Connect script
connect /etc/ppp/gprs-connect-chat
+
connect /etc/ppp/peers/gprs-connect-chat
  
 
# IP addresses:
 
# IP addresses:
Line 47: Line 52:
 
# - if you use the 10. network at home or something and pppd rejects it,
 
# - if you use the 10. network at home or something and pppd rejects it,
 
# change the address to something else
 
# change the address to something else
:160.218.160.218
+
:10.0.0.1
  
 
# pppd must not propose any IP address to the peer!
 
# pppd must not propose any IP address to the peer!
Line 54: Line 59:
 
# Accept peers idea of our local address
 
# Accept peers idea of our local address
 
ipcp-accept-local
 
ipcp-accept-local
 
# Ignore carrier detect signal from the modem
 
local
 
  
 
# No ppp compression
 
# No ppp compression
Line 63: Line 65:
  
 
# Disconnect script
 
# Disconnect script
disconnect /etc/ppp/gprs-disconnect-chat
+
disconnect /etc/ppp/peers/gprs-disconnect-chat
  
 
# Add default route
 
# Add default route
 
defaultroute
 
defaultroute
  
#a neco pro udrzeni linky
+
# very long timeouts (unwise?)
 
lcp-echo-interval 300
 
lcp-echo-interval 300
 
lcp-echo-failure 40000
 
lcp-echo-failure 40000
  
 +
# don't require the other end to authenticate to us
 +
noauth
 +
 +
# username to use for authentication, should match "client" in /etc/ppp/{chap,pap}-secrets
 
user "gprs"    ## opt out for eplus/pap
 
user "gprs"    ## opt out for eplus/pap
#name "eplus"  ## opt in for eplus/pap
+
#user "eplus"  ## opt in for eplus/pap
#noauth        ## opt in for eplus/pap
+
#auth login +chap -pap
+
 
</pre>
 
</pre>
And you'll need /etc/ppp/gprs-connect-chat, probably needs "x" bit.
+
 
 +
And you'll need /etc/ppp/peers/gprs-connect-chat (needs "chmod +x"):
 +
 
 
<pre>
 
<pre>
 
#!/bin/sh
 
#!/bin/sh
Line 131: Line 137:
 
SAY            "try restarting the phone.\n"
 
SAY            "try restarting the phone.\n"
 
</pre>
 
</pre>
You will need to adjust APN name in at+cgdcont line. Then, after initializing GSM, you should be to initialize GPRS by pppd file /etc/ppp/gprs. Good luck!
+
 
 +
You will need to adjust the APN name "internet" in at+cgdcont line to match what your network operator provides.  
 +
 
 +
 
 +
Also good to have is /etc/ppp/peers/gprs-connect-chat (needs "chmod +x"):
 +
 
 +
<pre>
 +
#!/bin/sh
 +
 
 +
exec /usr/sbin/chat -V -s -S    \
 +
ABORT          "BUSY"          \
 +
ABORT          "ERROR"        \
 +
ABORT          "NO DIALTONE"  \
 +
SAY            "\nSending break to the modem\n"        \
 +
""              "\K"            \
 +
""              "\K"            \
 +
""              "\K"            \
 +
""              "+++ATH"        \
 +
""              "+++ATH"        \
 +
""              "+++ATH"        \
 +
"NO CARRIER"    ""              \
 +
SAY            "\nPDP context detached\n"
 +
</pre>
 +
 
 +
Then, after initializing GSM, you should be able to initialize GPRS by pppd call gprs. Good luck!
  
 
To dial in - and get verbose output - use pppd
 
To dial in - and get verbose output - use pppd
 
<pre>
 
<pre>
pppd debug file /etc/ppp/gprs
+
pppd debug call gprs
 
</pre>
 
</pre>
  
Line 155: Line 185:
 
|-  
 
|-  
 
| USA || Cingular (AT&T) || Less than full internet || wap.cingular ||
 
| USA || Cingular (AT&T) || Less than full internet || wap.cingular ||
 +
|-
 +
| Finland || Sonera  || Behind NAT || internet ||
 +
|-
 +
| Finland || Sonera  || Public IP  || prointernet ||
 
|-
 
|-
 
| Germany || T-Mobile ||  || internet.t-mobile ||
 
| Germany || T-Mobile ||  || internet.t-mobile ||

Revision as of 15:57, 18 August 2007

You need to have GSM parts already initialized, with modem logged in to the network, for this to work. It is best to test it by doing test call. The GPRS connection is made using the PPP protocol to a server identified by an "APN" at the network operator.

Depending on the APN, you may need password authentication using CHAP or PAP. You can add the following default line for "password-less" connections:

# client        server  secret                  IP addresses
*               *       ""                      *

For CHAP, lines in /etc/ppp/chap-secrets are used. For PAP, the lines are in /etc/ppp/pap-secrets. The client should match the "user" option in pppd the config file (below). You can use * to mean any here, but the option user "" doesn't mean empty!

For example:

# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
*               *       ""                      *
"gprs"          *       "gprs"                  *
"eplus"         *       "gprs"                  *  

You'll need /etc/ppp/peers/gprs:

# File:
# gprs
#
# Description:
# This file holds the serial cable and IrDA pppd options for GPRS phones

# To give some debug info
# debug

# Serial device to which terminal is connected;
/dev/ttySAC0
holdoff 3

# Serial port line speed
115200

# Hardware flow control needs to be used with serial cable.
# With IrDA it should be disabled with nocrtscts option.
crtscts  # serial cable
#nocrtscts # IrDA

# To keep pppd on the terminal
nodetach

# Connect script
connect /etc/ppp/peers/gprs-connect-chat

# IP addresses:
# - accept peers idea of our local address and set address peer as 10.0.0.1
# (any address would do, since IPCP gives 0.0.0.0 to it)
# - if you use the 10. network at home or something and pppd rejects it,
# change the address to something else
:10.0.0.1

# pppd must not propose any IP address to the peer!
noipdefault

# Accept peers idea of our local address
ipcp-accept-local

# No ppp compression
novj
novjccomp

# Disconnect script
disconnect /etc/ppp/peers/gprs-disconnect-chat

# Add default route
defaultroute

# very long timeouts (unwise?)
lcp-echo-interval 300
lcp-echo-failure 40000

# don't require the other end to authenticate to us
noauth

# username to use for authentication, should match "client" in /etc/ppp/{chap,pap}-secrets
user "gprs"    ## opt out for eplus/pap
#user "eplus"  ## opt in for eplus/pap

And you'll need /etc/ppp/peers/gprs-connect-chat (needs "chmod +x"):

#!/bin/sh
#
# File:
# chat-gprs-connect
#
# Description:
# chat script to open Sonera GPRS service with GPRS phones. If ppp
# negotiation stalls, try restarting the phone. To try with other GPRS
# operator setting, change the PDP contex setting. The settings work with
# all Ericsson models, but Nokia 8310 does not suppor QoS parameters with
# AT commands, so just delete those lines and it'll work.
#
# Set PDP context CID=1, protocol=IP, APN=internet:
# AT+CGDCONT=1,"IP","internet","",0,0
#
# Set CID=1 QoS requirements from the network, not supported by 8310:
# AT+CGQREQ=1,0,0,0,0,0
#
# Set CID=1 minimum acceptable QoS parameters, not supported by 8310:
# AT+CGQMIN=1,0,0,0,0,0
#
# 'Call' CID=1 (activate PDP context one, perform GPRS attach):
# ATD*99***1#
#
# was "internet.open.s"
#
# V connectu bylo "ip","internet"
# The actual chat script:
exec chat                                               \
TIMEOUT         22                              \
ECHO            ON                              \
ABORT           '\nBUSY\r'                      \
ABORT           '\nERROR\r'                     \
ABORT           '\nNO ANSWER\r'                 \
ABORT           '\nNO CARRIER\r'                \
ABORT           '\nNO DIALTONE\r'               \
ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
SAY             "Press CTRL-C to close the connection at any stage!"    \
SAY             "\ndefining PDP context...\n"   \
""              "\d" \
""              "atz" \
OK              "ate1" \
OK              'at+cgdcont=1,"ip","internet","0.0.0.0",0,0' \
TIMEOUT         22      \
OK              ATDT*99***1#    \
TIMEOUT         22              \
SAY             "\nwaiting for connect...\n"    \
CONNECT         ""                              \
SAY             "\nConnected." \
SAY             "\nIf the following ppp negotiations fail,\n"   \
SAY             "try restarting the phone.\n"

You will need to adjust the APN name "internet" in at+cgdcont line to match what your network operator provides.


Also good to have is /etc/ppp/peers/gprs-connect-chat (needs "chmod +x"):

#!/bin/sh

exec /usr/sbin/chat -V -s -S    \
ABORT           "BUSY"          \
ABORT           "ERROR"         \
ABORT           "NO DIALTONE"   \
SAY             "\nSending break to the modem\n"        \
""              "\K"            \
""              "\K"            \
""              "\K"            \
""              "+++ATH"        \
""              "+++ATH"        \
""              "+++ATH"        \
"NO CARRIER"    ""              \
SAY             "\nPDP context detached\n"

Then, after initializing GSM, you should be able to initialize GPRS by pppd call gprs. Good luck!

To dial in - and get verbose output - use pppd

pppd debug call gprs


Some APN names for reference:

Country Carrier Plan APN AT-CMD
USA T-mobile Anything less than full internet wap.voicestream.com
USA T-mobile Regular internet plan internet2.voicestream.com
USA T-mobile "VPN" internet plan internet3.voicestream.com
USA Cingular (AT&T) Less than full internet wap.cingular
Finland Sonera Behind NAT internet
Finland Sonera Public IP prointernet
Germany T-Mobile internet.t-mobile
Germany E-Plus BASE (and others?) internet.eplus.de 'AT+CGDCONT=1,"ip","internet.eplus.de"'
UK T-Mobile general.t-mobile.uk
Personal tools

You need to have GSM parts already initialized, with modem logged in to the network, for this to work. It is best to test it by doing test call.

You'll need /etc/ppp/chap-secrets: (I used tabs in this file, I hope that does not matter). Or /etc/ppp/pap-secret if you need PAP.

# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
  "gprs"        *       "gprs"                  *

## opt in for eplus
#  "eplus"       *       "gprs"                 *  


You'll need /etc/ppp/gprs:

# File:
# gprs
#
# Description:
# This file holds the serial cable and IrDA pppd options for GPRS phones

# To give some debug info
# debug

# Serial device to which terminal is connected;
/dev/ttySAC0
holdoff 3

# Serial port line speed
115200

# Hardware flow control needs to be used with serial cable.
# With IrDA it should be disabled with nocrtscts option.
crtscts  # serial cable
#nocrtscts # IrDA

# To keep pppd on the terminal
nodetach

# Connect script
connect /etc/ppp/gprs-connect-chat

# IP addresses:
# - accept peers idea of our local address and set address peer as 10.0.0.1
# (any address would do, since IPCP gives 0.0.0.0 to it)
# - if you use the 10. network at home or something and pppd rejects it,
# change the address to something else
:160.218.160.218

# pppd must not propose any IP address to the peer!
noipdefault

# Accept peers idea of our local address
ipcp-accept-local

# Ignore carrier detect signal from the modem
local

# No ppp compression
novj
novjccomp

# Disconnect script
disconnect /etc/ppp/gprs-disconnect-chat

# Add default route
defaultroute

#a neco pro udrzeni linky
lcp-echo-interval 300
lcp-echo-failure 40000

user "gprs"    ## opt out for eplus/pap
#name "eplus"  ## opt in for eplus/pap
#noauth        ## opt in for eplus/pap
#auth login +chap -pap

And you'll need /etc/ppp/gprs-connect-chat, probably needs "x" bit.

#!/bin/sh
#
# File:
# chat-gprs-connect
#
# Description:
# chat script to open Sonera GPRS service with GPRS phones. If ppp
# negotiation stalls, try restarting the phone. To try with other GPRS
# operator setting, change the PDP contex setting. The settings work with
# all Ericsson models, but Nokia 8310 does not suppor QoS parameters with
# AT commands, so just delete those lines and it'll work.
#
# Set PDP context CID=1, protocol=IP, APN=internet:
# AT+CGDCONT=1,"IP","internet","",0,0
#
# Set CID=1 QoS requirements from the network, not supported by 8310:
# AT+CGQREQ=1,0,0,0,0,0
#
# Set CID=1 minimum acceptable QoS parameters, not supported by 8310:
# AT+CGQMIN=1,0,0,0,0,0
#
# 'Call' CID=1 (activate PDP context one, perform GPRS attach):
# ATD*99***1#
#
# was "internet.open.s"
#
# V connectu bylo "ip","internet"
# The actual chat script:
exec chat                                               \
TIMEOUT         22                              \
ECHO            ON                              \
ABORT           '\nBUSY\r'                      \
ABORT           '\nERROR\r'                     \
ABORT           '\nNO ANSWER\r'                 \
ABORT           '\nNO CARRIER\r'                \
ABORT           '\nNO DIALTONE\r'               \
ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
SAY             "Press CTRL-C to close the connection at any stage!"    \
SAY             "\ndefining PDP context...\n"   \
""              "\d" \
""              "atz" \
OK              "ate1" \
OK              'at+cgdcont=1,"ip","internet","0.0.0.0",0,0' \
TIMEOUT         22      \
OK              ATDT*99***1#    \
TIMEOUT         22              \
SAY             "\nwaiting for connect...\n"    \
CONNECT         ""                              \
SAY             "\nConnected." \
SAY             "\nIf the following ppp negotiations fail,\n"   \
SAY             "try restarting the phone.\n"

You will need to adjust APN name in at+cgdcont line. Then, after initializing GSM, you should be to initialize GPRS by pppd file /etc/ppp/gprs. Good luck!

To dial in - and get verbose output - use pppd

pppd debug file /etc/ppp/gprs


Some APN names for reference:

Country Carrier Plan APN AT-CMD
USA T-mobile Anything less than full internet wap.voicestream.com
USA T-mobile Regular internet plan internet2.voicestream.com
USA T-mobile "VPN" internet plan internet3.voicestream.com
USA Cingular (AT&T) Less than full internet wap.cingular
Germany T-Mobile internet.t-mobile
Germany E-Plus BASE (and others?) internet.eplus.de 'AT+CGDCONT=1,"ip","internet.eplus.de"'
UK T-Mobile general.t-mobile.uk