July 5, 2009 at 8:33 am #41767
Hi all !
is there a way to make the 3G hook up directly from command line (like using wvdial) ?
Here in Chile the APN`s uses authentification so its not enough to just type the APN in the web field. I follow this procedure to add the username and password to the connection (thanks mcumbee) :
…, but the thing is that the solution its very unstable (i only made it work once). I test the modem using minicom and comgt -d /udev/ttyUSB1 and it respond perfectly fine, but when i try to make the connection from the web interface it keeps showing me errors from the script:
09:01:51 pppd 2.4.3 started by root, uid 0
09:01:53 Connect script failed
And from the “chat” log:
09:34:20 abort on (NO CARRIER)
09:34:20 abort on (ERROR)
09:34:20 report (CONNECT)
09:34:20 timeout set to 15 seconds
09:34:20 send (AT^M)
09:34:20 expect (OK)
09:34:20 — got it
09:34:20 send (+cgdcont=1,^M)
09:34:20 expect (IP”,”web.tmovil.cl””)
09:34:40 abort on (BUSY)
09:34:40 abort on (NO CARRIER)
09:34:40 abort on (ERROR)
09:34:40 report (CONNECT)
09:34:40 timeout set to 15 seconds
09:34:40 send (AT^M)
09:34:40 expect (OK)
09:34:40 — got it
09:34:40 send (+cgdcont=1,^M)
09:34:40 expect (IP”,”web.tmovil.cl””)
minicom show me this:
Welcome to minicom 2.3
Compiled on Jun 13 2008, 15:25:50.
Press CTRL-A Z for help on special keys
AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
and comgt :
root@zeroshell root> comgt -d /udev/ttyUSB1
Enter PIN number: 9017
Waiting for Registration..(120 sec max)…
Registered on Home network: “73002”,2
Signal Quality: 14,99
Im using a HUAWEI E226 modem. Hope someone can help me.
rockmanchile.July 5, 2009 at 10:08 pm #48369
Ok… i figured out !
The modem needs the PIN number to connect to the network, but after you enter it with AT+CPIN=XXXX at the web field, you have to erase it inmediately after the modem logs into the net.
If you do that works perfectly, but its not very confortable for the regular user to do this every single time so i came out with this idea to automatize the process:
First of all you need to know if your APN needs authentification or not. In my case i do, so i need to create create a couple of files to provide that information.
Taking the example of mcumbee, i came to this (step by step):
First of all wake up the ppp0 interface and leave it like this:
Modem connected to : ttyUSB0
APN : web.tmovil.cl
Dial string : *99#
Optional AT string :
Autostart the connection at boot : Yes
Make this interface the Default Route : Yes
Enable NAT on this interface : Yes
Dial String and APN depends of your country and ISP provider. The modem can be connected in ttyUSB1 too, or maybe somewhere else, so i recommend that you type “dmesg | grep modem” once you put it into the USB port.
…then do this:
# cd /var/register/system/net/interfaces/ppp0
# touch USERNAME
# touch PASSWORD
Edit both files with VI and add the user and password of your APN (of course, each one in a different file). In my case, the user and password are the same : “web” (without the quotes)
Now, if we go to the web interface again and put “AT+CPIN=1234”, being 1234 the PIN code of the SIM card (without the quotes) in the “Optional AT string” of the 3G Modem configuration field, the Modem will register in the network. After that we have to reenter to he Modem configuration and erase the AT+CPIN=1234 sentence that we just write and save the changes. The modem will automatically make the hook up and retrieve a public IP from the ISP. It is important that the “Autostart the connection at boot :” is always set to “YES” as its show at the beggining.
As you can see this is a little tricky, so the ideal solution (at least for me) is that ZS can make all the process automatically at boot. In that case, if someone wants to connect a 3G modem to the router, all that he have to do is put the device in the USB port and reboot the machine (unplug the power and plug it back in).
To do this, we have to add the follow commands to the post boot script in the web interface or in the rc.local file inside the /etc folder:
comgt -d /udev/ttyUSB1 PIN
…once again, replace 1234 with the number of you SIM card`s PIN.
After that all that you have to do is reboot your ZS router with the 3G modem attached to the USB port and voila !
If you want to test the procedure from the command shell first you can always make :
# comgt -d /udev/ttyUSB0
comgt will ask you for the PIN code. This is equal to put the AT+CPIN=1234 in the web field.
If you already put the USERNAME and PASSWORD files in their place and you have the “Autostart the connection at boot :” at “YES”, the connection should start almost inmediately. The problem with this method is that you have to manually type the PIN number every time that you want to connect the modem. With “export COMGTPIN=”1234″ ” and “comgt -d /udev/ttyUSB1 PIN”, you edit the COMGTPIN variable before you register the modem to the network, so you don need to type it every time from the console or from the web page.
Hope this can help.
You must be logged in to reply to this topic.