Geek magazine hacker daily blog

2 years, 11 months ago
On the eve of New Year's holidays it was required to leave the capital a bit earlier, to leave it in the direction of such places in which the Internet happens quite seldom. For absence at work I promised workmates to be in touch. And as my kind of activity is directly connected with web, I decided to experiment with availability of the Internet in the planned place of stay.

Essence of a task was as follows:

  1. To reach the comfortable speed of the Internet.
  2. To distribute the Internet not only for itself, but also for the spouse.

We had 2 modems, 750 megabytes of the paid Internet, 3 notebooks, several phones and the whole set of sim cards of all sorts and coloring, access point with OpenWRT, usb hub, a flash card and the antenna. Not that it was the necessary stock for a trip, but if began to collect pieces of iron, it becomes difficult to stop. The only thing that caused in me concern - it is the antenna. Nothing in the world happens more helpless, irresponsible and weak, than the signal from the antenna which passed a cable through 3-meter usb. I knew that sooner or later we will pass also to this rubbish.

Candidate solutions at me was a little:

  1. To use the Huawei 5776 modem which is available for me, having bought to it the antenna.
  2. To gather more pieces of iron and to collect something more powerful.

As about a possibility of connection of the antenna in the E5776 I remembered too late, the first option of the choice at me actually and was not.

From nebkhodimy at me was:

  1. TP-Link TL-WR1043ND with a firmware of OpenWRT 15.05
  2. The Connect 2.0 antenna (with 3-meter usb a cable without ferrite rings).
  3. USB Hub

For the broad picture I lacked modem usb, the choice fell on Huawei 3372h.

Assembly of the designer

On TP-Link I had an USB port one, and he was already busy with the drive under root file system, plus to everything caused suspicion a long wire in the antenna. I was tormented by doubts that the access point will be able to power the modem through a 3-meter wire therefore connection through USB hub was the only solution.

As a hub used old kind D-Link Dub-104 (a beautiful compact hub with incredibly huge power supply unit).

Intermediate option:

We squeeze out an Internet maximum of rural cells

Installation of necessary software on access point

As we went to the village in which all phones hardly worked in the GPRS mode, all softwares I decided to put still being in the big city therefore put to the maximum on site to catch already a minimum of adventures. Scooped knowledge on setup from this article:

ssh root@<точка доступа>

opkg update
opkg install comgt kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch usb-modeswitch-data

In general, after that it is possible to try to insert the modem and to look whether type/dev/ttyUSB* devices appeared. In my case usb_modeswitch made all work and devices appeared. If it is not your case, it is worth reading in detail article on usb_modeswitch.

Setup of parameters of connection

Let's configure the wan settings:

vim /etc/config/network

config interface 'wan'
        option device /dev/ttyUSB0
        option username 'gdata'
        option password 'gdata'
        option apn 'internet'
        option service 'umts'
        option maxwait '0'
        option dialnumber '*99#'
        option proto '3g'

In my case the sim card was from Megafon therefore parameters were selected specially under it.

Still I added a line to chatscript to see the signal level from a tower at connection:

vim /etc/chatscripts/

""      "AT+CSQ"
""      "AT&F;"
OK      "ATE1"
OK      'AT+CGDCONT=1,"IP","$USE_APN"'
SAY     "Calling UMTS/GPRS"


Now we do ifup wan, we watch iiiya logread … If you were lucky, then you will see something like it:

Wed Dec 30 21:47:01 2015 chat[30352]: CONNECT
Wed Dec 30 21:47:01 2015 chat[30352]:  -- got it
Wed Dec 30 21:47:01 2015 chat[30352]: send ( ^M)
Wed Dec 30 21:47:01 2015 pppd[30347]: Serial connection established.
Wed Dec 30 21:47:01 2015 kernel: [98634.870000] 3g-wan: renamed from ppp0
Wed Dec 30 21:47:01 2015 pppd[30347]: Using interface 3g-wan
Wed Dec 30 21:47:01 2015 daemon.notice pppd[30347]: Connect: 3g-wan <--> /dev/ttyUSB0
Wed Dec 30 21:47:02 2015 pppd[30347]: CHAP authentication succeeded: Welcome!!

If your operator is absent also Megafon, then we go further.

Dancings with a tambourine

I at execution by the modem of the ATD command had an error. It is a little posherstiv forums, Megafon found interesting feature of the operator. At one of forums it was offered to disconnect manually on the modem all superfluous and to leave only functions of the modem and card sd is possible. On another — to pereproshit the modem with the factory (not branded) firmware (in my case the firmware was from Megafon too).

The fact that at connection to the notebook with Windows OS, the modem worked regularly was surprising. It was worth connecting to Linux — received an error.

At first I decided to check whether really it is connected with Megafon. I took from stocks a sim card with Tele2, is sensitive corrected a connection configuration:

vim /etc/config/network

config interface 'wan'
        option device /dev/ttyUSB0
        option apn ''
        option service 'umts'
        option maxwait '0'
        option dialnumber '*99#'
        option proto '3g'

Iiiya, everything earned. At once. OK, we will go at first in the simplest way and pootklyuchay all superfluous on the modem:

ssh root@<точка доступа>

picocom -b 9600 -f n -p n -d 8 -r /dev/ttyUSB1

We leave a combination:


Now we switch off usb_modeswitch as superfluous:

/etc/init.d/usbmode stop
/etc/init.d/usbmode disable

Perevtykayem the modem, we wait so far it will be loaded and we lift wan the interface:

ifup wan

In my case now everything earned. Hurrah!


Primary setup was carried out without connection of the antenna, now it was interesting to look whether there will be from it an effect.

The signal level without antenna:

gcom sig -d /dev/ttyUSB1
Signal Quality: 15,99

And now with the antenna:

gcom sig -d /dev/ttyUSB1
Signal Quality: 21,99

Looked so abruptly that I scented a dirty trick. And the dirty trick really was. For me became opening that the good signal from a base station still means nothing.

Below a ping for the first and second option:

root@OpenWrt:~# ping
PING ( 56 data bytes
64 bytes from seq=0 ttl=44 time=986.652 ms
64 bytes from seq=1 ttl=44 time=327.628 ms
64 bytes from seq=2 ttl=44 time=246.212 ms
64 bytes from seq=3 ttl=44 time=265.568 ms
64 bytes from seq=4 ttl=44 time=285.271 ms

64 bytes from seq=233 ttl=45 time=1567.306 ms
64 bytes from seq=234 ttl=45 time=1126.106 ms
64 bytes from seq=235 ttl=45 time=569.993 ms
64 bytes from seq=236 ttl=45 time=1403.010 ms
64 bytes from seq=237 ttl=45 time=428.891 ms

And here for me the new marvelous world of mobile communication opened.

I opened that my modem supports scanning of the district regarding base stations, and optional that operator whose the card in it is installed to these.

It became the following command:


20 — how many towers to display
- 110 — a minimum level of a signal
0/1 — 0 — 2G towers, 1 — 3G towers. With LTE so far in any way.

The list is sorted by the signal level and looks as follows:

^NETSCAN: 10638,,,1e7e,250,02,0,-78,8b77,400000
^NETSCAN: 10687,,,1e7e,250,02,0,-79,d5c8,400000
^NETSCAN: 10662,,,1e7e,250,02,0,-82,8ade,400000
^NETSCAN: 10587,,,4cf8,250,20,0,-105,d4fc,400000
^NETSCAN: 10563,,,4cf8,250,20,0,-106,d4f9,400000

1e7e — LAC stations
250 — the MCC (Russia)
02 — MNC (In this case — MTS)
- 78 — the signal level of this base station
8b77 — CID stations
400000 — the range in which the signal of a base station is accepted (as in command ^syscfgex)

Now, having these data, it is possible to visit the website and to look where these towers are located concerning themselves.

As a rule, if there is a directional antenna, then it should be directed to the next base station — I so thought. Here I was waited by the following opening. Even if we will direct to it the antenna, not the fact that there will take place registration on this base station. And if passes, then not the fact that data transmission rate will be higher, than through the tower which is twice further it. So I walked on the nearest stations in a radius from 1.5 kilometers up to 3 and all of them at a good signal transferred data with a big delay. Ping on average was ~ 300ms.

Experimenting, I accidentally got on a tower which was at distance of 6-7 kilometers from me. Having connected to it, time of a ping fell to ~ 90ms while the signal level fell together with it.

For comparison, the signal level from:

nearby towers: 13-20
from a remote tower: 5-12

(measurements were taken by the utility of gcom sig - d/dev/ttyUSB1 where as value there can be digit from 0 to 99).

Nevertheless I carried out high-speed tests on the best near tower and on deleted, results:
one of the nearest stations — 2/0.35 Mbit.

We squeeze out an Internet maximum of rural cells

Remote station — 4.28/1.68 Mbit.

We squeeze out an Internet maximum of rural cells

Frankly speaking, I also was stunned by two megabits since when using normal phone even Google Play Market did not open. And here, it appears, it is possible also to disperse to the 4th!


Such results for me appeared enough. I left the antenna to look in the direction of the most remote tower in hope always to hold with it communication, but my hopes were naive. There was new and still unresolved problem. It consists that from time to time there is a registration on other base station even if it is located in the opposite side concerning the direction of the antenna. At such moments of a delay at data transmission increase and as to overcome it — I did not find yet.

On the Internet on a type question: whether "the modem with what tower to work" can specify answer that not you select a tower, but it you. Perhaps aware people will prompt whether there are solutions for such situations?

On it all. Thanks to all those who read up to the end.

Here the sim card of Beeline came to hand, its towers are the closest to us and after connection the test of speed showed even 20/2 Megabits. I give a configuration for Beeline:

vim /etc/config/network

config interface 'wan'
        option device /dev/ttyUSB0
        option username 'beeline'
        option password 'beeline'
        option apn ''
        option service 'umts'
        option maxwait '0'
        option dialnumber '*99#'
        option proto '3g'

The used resources

This article is a translation of the original post at
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here:

We believe that the knowledge, which is available at the most popular Russian IT blog, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.