Перейти к содержанию

Навигация

Modem-stretch/en: различия между версиями

м
FuzzyBot переименовал страницу GSM/GPRS/en в Modem-stretch/en без оставления перенаправления: Часть переводимой страницы GSM/GPRS.
(Новая страница: « As an example, we will give here the parameters that '''we recommend''' to use when setting up a ppp connection with mobile Internet providers. <syntaxhighlight…»)
м (FuzzyBot переименовал страницу GSM/GPRS/en в Modem-stretch/en без оставления перенаправления: Часть переводимой страницы GSM/GPRS.)
 
(не показано 28 промежуточных версий 2 участников)
Строка 5: Строка 5:
See the module description for the full list of features:
See the module description for the full list of features:
*3G modem in Wiren Board 5 and Wiren Board 6: [[SIM5300E/en|SIM5300E]]  
*3G modem in Wiren Board 5 and Wiren Board 6: [[SIM5300E/en|SIM5300E]]  
*2G modem in Wiren Board 4, 5 and 6 :[[Special:MyLanguage/SIM800|SIM800]] or [[M660A/en|M660A]];
*2G modem in Wiren Board 4, 5 and 6: SIM800  or [[M660A/en|M660A]];
*Wiren Board Smart Home 3.5, Wiren Board 4:
*Wiren Board Smart Home 3.5, Wiren Board 4:
[[SIM900R/en|SIM900R]].
[[SIM900R/en|SIM900R]].
Строка 168: Строка 168:
iface ppp0 inet ppp
iface ppp0 inet ppp
provider mts
provider mts
#рестартуем модем, если он завис
#restart modem if it's broken or frozen
pre-up wb-gsm restart_if_broken   
pre-up wb-gsm restart_if_broken   
#Затем ждем, пока он загрузится и найдет сеть.
#Then wait for it to load and find the network.
pre-up sleep 10
pre-up sleep 10
</syntaxhighlight>
</syntaxhighlight>




Для ppp-интерфейсов существуют директории, исполняемые файлы из которых также запускаются на разных фазах установления соединения. Но, если для, например, ethernet-интерфейсов эти скрипты должны находиться в директориях /etc/network/if-down.d, if-post-down.d, if-pre-up.d, if-up.d, то соответствующие директории для ppp-интерфейсов находятся в /etc/ppp/ip-down.d, ip-up.d и т.п (подробнее об их назначении и функционировании можно узнать в документе [http://citforum.ru/operating_systems/linux/HOWTO/PPP-HOWTO.shtml PPP HOWTO]).
For ppp-interfaces, there are directories, executable files from which are also run at different phases of connection establishment. But, if, for example, ethernet interfaces, these scripts must be located in the /etc/network/if-down directories.d, if-post-down.d, if-pre-up.d, if-up.d, then the corresponding directories for ppp interfaces are in /etc/ppp/ip-down.d, ip-up.d, etc. (for details on their purpose and function, see PPP HOWTO).




====Настройки DNS и маршрутизации====
====DNS and routing settings====


'''Важно!''' По умолчанию интерфейс ppp0 при инициализации '''не добавляет нового маршрута по умолчанию''' через ppp, в случае, если такой маршрут существует и настроен, скажем, через eth0. Если это требуется, то изменение таблицы маршрутизации можно выполнять через скрипты в директориях ip-down.d, ip-up.d. В простейшем случае, можно назначать шлюзам по умолчанию разные метрики, чтобы в случае падения одного начинал бы использоваться второй. Однако ситуация, когда интерфейс функционирует нормально, но трафик не проходит на уровне провайдера, делает такой механизм неработоспособным. Смотрите следующий раздел о том, как использовать ppp-соединение в качестве резервного.  
'''Important!''' By default, the ppp0 interface '''does not add a new default route via ppp during initialization''', if such a route exists and is configured, for example, via eth0. If required, you can modify the routing table through scripts in the ip-down.d, ip-up.d directories. In the simplest case, you can assign different metrics to the default gateways, so that if one falls, the second begins to be used. However, the situation, when the interface is operating normally but the traffic does not pass at the provider level, makes such a mechanism unusable. See the next section on how to use a ppp connection as a backup.  


Адреса DNS-серверов заменяются на те, которые были получены от провайдера мобильной связи. При использовании DHCP на ethernet-интерфейсах и интерфейсе ppp0 файл /etc/resolv.conf меняется при установлении соединения через каждый из этих  интерфейсов в соответствии с адресами DNS-серверов, полученными от провайдера.  
DNS server addresses are replaced with those that were received from the mobile provider. If you are using DHCP on the ethernet interfaces and the interface ppp0, the /etc/resolv.the conf changes when a connection is established through each of these interfaces according to the DNS server addresses received from the provider.  


В качестве дополнительной меры повышения надежности при наличии двух соединений можно предложить использование DNS-серверов, не зависящих от провайдера, например GoogleDNS (8.8.8.8, 8.8.4.4) и OpenDNS (208.67.222.222, 208.67.220.220). Очень часто эти сервера используются для определения работоспособности сетевого канала по определенному интерфейсу (ping -c5 -I eth0 8.8.8.8 или ping -c5 -I ppp0 8.8.4.4).
As a supplementary measure to improve reliability in the presence of two connections, we can offer the use of DNS servers that are independent of the provider, for example GoogleDNS (8.8.8, 8.8.4.4) and OpenDNS (208.67.222.222, 208.67.220.220). These servers are used frequently to determine the health of the network channel on a specific interface (ping -c5 -I eth0 8.8.8.8 or ping -c5 -I ppp0 8.8.4.4).


Обратите внимание, что при деинициализации ppp0 интерфейса все созданные маршруты, связанные с ним, будут автоматически удалены.
Note that when you deinitialize the ppp0 interface, all created associated with this interface routes will be automatically deleted.




==== Использование GPRS в качестве резервного канала ====
==== Using GPRS as a backup channel ====


Самый простой способ, обеспечить отказоустойчивость, это задать два маршрута по умолчанию с разными метриками, например:
The easiest way to ensure fault tolerance is to specify two default routes with different metrics, for example: for eth0 interface, specify metric 10:
для интерфейса eth0 указать метрику 10:
     auto eth0
     auto eth0
     iface eth0 inet dhcp
     iface eth0 inet dhcp
Строка 199: Строка 198:
     metric 10  
     metric 10  


а для интерфейса метрику 100:
and for the interface metric 100:
     auto ppp0
     auto ppp0
     iface ppp0 inet ppp
     iface ppp0 inet ppp
Строка 208: Строка 207:
     pre-up sleep 10
     pre-up sleep 10


В этом случае, если подключение через eth0 пропадет (обрыв кабеля, отключение коммутатора и т.п.), то маршрутом по умолчанию становится маршрут через интерфейс ppp0.
In this case, if the connection via eth0 is lost (cable disconnection, switch disconnection, etc.), the route via the ppp0 interface becomes the default route.


Для более сложных случаев, когда физическое соединение на интерфейсе eth0 не пропадает, рекомендуется применять скрипты, которые на основе доступности какого-либо сетевого уздла в интернете через один из интерфейсов переключают маршрут по умолчанию. В интернете предлагается множество решений решений такого рода задачи, можно выбрать одно из них.  
For more complex cases where the physical connection on the eth0 interface is not lost, it is recommended to use scripts (based on the availability of any network bridging on the Internet through one of the interfaces) that switch the default route. The Internet offers many solutions to this kind of problem, you can choose one of them.  


Если контроллер обычно подключён к Интернету через Ethernet или Wi-Fi, а GPRS должен использоваться только при неполадках основного канала, такой режим работы называется ''failover''. Обычно он работает так:
If the controller is normally connected to the Internet via Ethernet or Wi-Fi, and GPRS is to be used only in case of a main channel failure, this mode of operation is called ''failover''. It usually works like this:
# Организуется работа через основной канал.
#Work is organized through the main channel.
# Постоянно проверяется наличие доступа в Интернет через основной канал.
#The availability of Internet access through the main channel is constantly checked.
# В случае неполадок запускается запасное соединение, меняются настройки ''default gateway''.
#In case of problems, a backup connection is started and the default gateway settings are changed.
# Основное соединение постоянно проверяется, и если доступ в Интернет через него восстанавливается, система возвращается к работе через него, изменяя ''default gateway''.
#The main connection is constantly checked, and if the internet access is restored through it, the system returns to work via it, changing the ''default gateway''.


В качестве примера укажем две инструкции по организации такого режима работы:
As an example, we specify two instructions for the organization of such a mode of operation:
# http://lstein.github.io/Net-ISP-Balance/
# http://lstein.github.io/Net-ISP-Balance/
# https://serverfault.com/questions/360131/ubuntu-failover-from-ethernet-to-adsl-modem-to-usb-3g-dongle?rq=1
# https://serverfault.com/questions/360131/ubuntu-failover-from-ethernet-to-adsl-modem-to-usb-3g-dongle?rq=1
Строка 224: Строка 223:


<span id="низкоуровневая-работа с модулем через at-команды"></span>
<span id="низкоуровневая-работа с модулем через at-команды"></span>
=== Низкоуровневая работа с модулем через AT-команды ===
=== Low-level work with the module via AT-commands===


Ознакомьтесь с инструкцией - [[Special:MyLanguage/Работа с последовательным портом из Linux|Работа с последовательным портом из Linux]].
Read the instructions - [[Работа с последовательным портом из Linux/en|Working with a serial port from Linux]]. Note the settings: 115200, 8N2, '''no hardware flow control'''.
Обратите внимание на настройки: 115200, 8N2, '''no hardware flow control'''.


Для интерактивного режима:
For interactive mode:
* запускаем '''minicom''' с ключём, создающим профиль работы с портом (скорость передачи данных, чётность, и т.д.):
*run '''minicom''' with the following key that creats the job profile to the port (transmission speed, parity, etc.):
<pre>
<pre>
  $ minicom -s /dev/ttyGSM
  $ minicom -s /dev/ttyGSM
</pre>
</pre>
[[Special:MyLanguage/Файл:Minicom_settings.png|Настройки Minicom]]
[[Файл:Minicom_settings.png|Minicom Settings]]


* Зайти в настройки (нажать ''Ctrl+A'', затем ''O''), выбрать пункт ''Serial port setup'', там установить порт ''/dev/ttyGSM'', скорость и чётность - ''115200, 8N1'', ''Hardware flow control - No'', ''Software flow control - No''
* Go to settings (press ''Ctrl+A'', then ''O''), select ''Serial port setup'', set port ''/dev/ttyGSM'',set speed and parity - ''115200, 8N1'', ''Hardware flow control - No, Software flow control - No''
* Сохранить настройки: ''Save setup as _dev_ttyGSM''
* Save settings: ''Save setup as _dev_ttyGSM''
* Далее запускать как '''minicom /dev/ttyGSM''' (все параметры будут сразу браться из профиля с названием ''/dev/ttyGSM'', который мы ранее создали)
* Then run as '''minicom /dev/ttyGSM''' (all settings will be taken from the profile name ''/dev/ttyGSM'' that we previously created)
* Первой вашей командой должна стать ''AAAAAAAAAT'' - с её помощью модуль распознает скорость, с которой мы к нему обращаемся (смотрите [[Special:MyLanguage/SIM900R|SIM900R]])
* Your first command should be ''AAAAAAAAAT'' - the module automatically detects the communication speed (see [[Special:MyLanguage/SIM900R|SIM900R]])
* Второй командой выполните просто ''AT''. Вам должен прийти ответ '''OK'''
* With the second command, simply run ''AT''. You should get the answer '''OK'''.




==== Примеры команд ====
==== Command examples ====


(некоторые команды могут различаться в разных модулях, смотрите подробнее в документации на модуль)
(some commands may vary for some modules, see the module documentation for details)


* Синхронизовать скорость порта (не совсем команда)
* To synchronize the speed of the port (not a real command)
<pre>
<pre>
AAAAAAAAAAAAAT
AAAAAAAAAAAAAT
</pre>
</pre>
Список всех сетей
All networks list
<pre>
<pre>
AT+COPS=?
AT+COPS=?
</pre>
</pre>
Уровень сигнала (см. [http://m2msupport.net/m2msupport/atcsq-signal-quality/ здесь])
Signal strength  (see [http://m2msupport.net/m2msupport/atcsq-signal-quality/ here])
<pre>
<pre>
AT+CSQ
AT+CSQ
</pre>
</pre>
* Звонок на номер +79154816102
* Dialing +79154816102
<pre>
<pre>
ATD+79154816102;
ATD+79154816102;
</pre>
</pre>
* Установка baud rate порта в фиксированное значение 115200
* Set baud rate port to a fixed value 115200
<pre>
<pre>
AT+IPR=115200
AT+IPR=115200
</pre>
</pre>


* Запрос времени со встроенных в модуль часов реального времени (RTC)
* Request time from the built-in real-time clock (RTC) module
<pre>
<pre>
AT+CCLK?
AT+CCLK?
Строка 274: Строка 272:
</pre>
</pre>


* Получить IMEI-код модуля (xxxxxx - уникальный номер)
* Get module IMEI-code (xxxxxx is a unique number)
<pre>
<pre>
AT+GSN
AT+GSN
Строка 286: Строка 284:




===Мультиплексирование===
===Multiplexing ports===


Модем поддерживает режим мультиплексирования - создание виртуальных портов, через которые можно одновременно работать с модемом.
The modem supports multiplexing mode which creates virtual ports,you can simultaneously work with the modem via these ports. For example, one port can be used to open a PPP session for GPRS, another - to receive and send SMS, check the balance, etc. see [[Special:MyLanguage/CMUX|CMUX]] for details. This mode is not supported for 2G modems.
Например, через один порт можно открыть сессию PPP для GPRS, а через другой получать и отправлять SMS, проверять баланс и т.д.
Подробнее смотрите [[Special:MyLanguage/CMUX|CMUX]]. Этот режим не поддерживается для 2G-модемов.
wb_editors
14 355

правок