How to set the O2 APN “surfo2” when connecting with Linux and an Option GlobeTrotter 3G+ UMTS card?

Opening a connection and data transfer is also possible with the APN set to nonsense, like the string “nothing”. But it’s nonetheless very important to get this setting right, because with the O2 Genion contracts it decides if you pay 0,03 EUR/min or 9,27 EUR/MB.

The best alternative is to use comgt and a custom script.

As the APN value is not stored on the SIM card, but on the mobile phone resp. the modem software, it is not possible to use a UMTS phone to set the APN value, or to use a Windows notebook and the O2 connection manager (download from http://www.o2online.de/goto/connectionmanager ), or a settings SMS, which might be requestable from http://www.o2online.de/goto/interneteinstellungen .

comgt (the newest version) has an internal script to set the APN for the connection. This script is buggy, but I developed a functional version based on it.

###########################################################################
#
# local_apn - comgt script to set the APN, as the internal one is buggy
#
# Copyright (C) 2009 Matthias Ansorg <matthias@ansorgs.de>
#
###########################################################################
# All labels were changed compared to the internal APN script, as else there
# is a "Duplicate label" error.

opengt
print "nsetting APN ... "
set com 115200n81
set senddelay 0.05
waitquiet 1 0.2
:startlocal
flash 0.1
:getapnlocal
let $x=$env("COMGTAPN")
let a=len($x)
if a=0 goto apnerrorlocal
if a>32 goto apnerrorlocal
:enterapnlocal
# send "AT+CGDCONT=1,"IP"," # original; wrong, closing " is necessary for string
# send $c # original; wrong, $c is the name of current network
send "AT+CGDCONT=1,"IP",""
send $x
send ""^m"
waitfor 20 "OK","ERR"
if % = -1 goto timeerrorlocal
if % = 0 goto OKlocal
if % = 1 goto apnerrorlocal
:apnerrorlocal
print "ERROR entering APNn"
# print "The COMGTAPN env variable is not setn" # original; wrong, that's not the only reason to be here
print "The COMGTAPN env variable is possibly not setn"
exit 1
:timeerrorlocal
print "ERROR entering APNn"
print "The device timeout.n"
exit 1
:OKlocal
print "APN was successfully set to "
print $x
print "n"
exit 0

With this script, set the APN value before connecting. Then connect, using kppp or another ppp tool of your choice.

Another, instantly working alternative is to use the program UMTSmon and configure the desired APN in th active profile (which will be used when connecting). UMTSmon is also capable of connecting you to the Internet.

Another (here untested) alternative would be to integrate the AT command for setting the APN into the chat script that connects the modem. The whole chat script would be something like:

TIMEOUT 120
ABORT 'BUSY'
ABORT 'ERROR'
ABORT 'NO CARRIER'
'' 'ATE1'
OK AT+CGDCONT=1,"IP","surfo2"
OK ATD*99***1#
# or OK ATD*99#
CONNECT dc

When changing the APN setting while a connection is open, the connection still works. It is not yet known if this change has any effect, e.g. on accounting (O2 Surf option’s time based resp. traffic based accounting is normally controlled by the APN you use).


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.