Connecting APN using AT Commands
Asked Answered
N

3

10

I need to connect in internet with a usb 3g dongle using at commands.

My apn provider is:

APN = tim.br
Username = tim
Password = tim

How can I connect using only at commands? It's possible?

Thanks.

Nunuance answered 2/9, 2013 at 18:48 Comment(1)
Is this a programming question?Cilice
A
8

Try something like this:-

AT+CGDCONT=1,"IP","tim.br"
ATD*99***1#
Armipotent answered 2/9, 2013 at 18:51 Comment(4)
+1 What a blast from the past. I can't even remember AT commands anymore (except for ATD (or ATDT). I once had a 300 baud modem (thought I was cool) that only did pulse dialing (ATDP).Hayes
I try this, it responds "Ok" and "Connected", what I need to execute now? Or only this commands I establish a connection?Nunuance
I check in OS using ifconfig (Linux) but can't get IP address. Do you know if I need to run new command to release a IP?Nunuance
What happens to username and passsword?Vocalic
Z
4

To connect, you need to use AT commands:

AT+CGDCONT=1,"IP","tim.br"

to configure APN, and then

ATD*99***1#

to actually connect. This will open a PPP session, and the username and password is usually provided over PAP in the PPP session itself, so you'll need to put them in your PPP client.

Zacharyzacherie answered 17/2, 2014 at 14:52 Comment(0)
S
0

The steps to connect to internet using 3G modem are the following, assuming you will use a serial command which includes two programs: 'chat' for send AT commands to the modem; 'pppd' for managing the data connection and configure a interface that you can use for the IP packet communication.

STEPS:

  1. Put the USB device on modem mode, it is archieved with usb_modswitch, generally its automatic at USB plugging.

  2. Configure the AT comands using a chat script:

# cat /var/usb3g.chat
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'NO CARRIER'
ABORT DELAYED
ABORT 'COMMAND NOT SUPPORT'

SAY 'ola'
'' ''
'' 'ATZ'
SAY 'set APN...\n'
'OK' 'AT+CGDCONT=1,"IP","timbrasil.br"'

SAY 'dialing...\n\n'
'OK' 'ATD*99***1#'
#'OK' 'ATD*99#' # for 2G dialling
'CONNECT' ''

  1. Configure pppd to use the chat and negotiate the connection parameters:
# cat pppd.conf
hide-password
persist
nodetach
lcp-echo-interval 20
lcp-echo-failure 3
holdoff 2
connect-delay 100
noauth
/dev/ttyUSB0
115200
debug
defaultroute
ipcp-accept-local
ipcp-accept-remote
usepeerdns
crtscts
lock
noccp
noipdefault
user tim
password tim
mtu 1490
mru 1490

# disable compression if not getting IP
#novj

connect 'chat -v -t10 -f /var/usb3g.chat'

If you see valid IPs on the output when calling pppd file pppd.conf, in an network interface called ppp0, all should be working well.

The above configuration I just tested for TIM Brazil, using a E3131 3G modem, and all worked fine.

Stewardson answered 20/1 at 15:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.