wb_editors
14 355
правок
(Новая страница: «In the standard software set of the Wiren Board controller connection settings in ppp protocol for MTS, MegaFon and Beeline mobile operators are included. If yo…») |
FuzzyBot (обсуждение | вклад) м (FuzzyBot переименовал страницу GSM/GPRS/en в Modem-stretch/en без оставления перенаправления: Часть переводимой страницы GSM/GPRS.) |
||
(не показано 39 промежуточных версий 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 : | *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]]. | ||
Строка 116: | Строка 116: | ||
==== | ==== Step-by-step instructions for setting up a permanent GPRS connection ==== | ||
* | *Connect the antenna to the GSM connector | ||
* | *Insert SIM card into micro-SIM slot 1 | ||
* | *Turn on the modem executing wb-gsm restart_if_broken | ||
* | *If your controller is equipped with 3G-modem, open file /etc/ppp/peers/your_provider (e.g. MTS) replace the <code>/dev/ttyGSM</code> with <code>/dev/ttyACM0</code> | ||
In the <code>/etc/networks/interfaces</code> file, comment out the section associated with <code>ppp0</code> and add the following lines: | |||
<pre> | <pre> | ||
auto ppp0 | auto ppp0 | ||
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 | ||
</pre> | </pre> | ||
* | *Run the <code>ifup ppp0 command</code> — after 15 seconds, the ppp0 interface will be available. | ||
* | *After rebooting, the interface will be automatically turning on and restore the connection after the cellular connection is lost. | ||
==== | ==== Full instruction ==== | ||
Access to the Internet via GPRS is provided via PPP using the [https://linux.die.net/man/8/pppd pppd] service. For its operation, you need to create a configuration file that corresponds to the settings of your operator. Configuration files for the "big three" rusian operators are pre-installed in the standard image. The files are stored in the /etc/ppp/peers and /etc/chatscripts directories. For other operators or special APNs, create your configuration files based on standard ones. To do this, use the '''pppconfig''' utility (installed with '''apt-get install pppconfig''') to create a connection configuration file with parameters for your operator (for example, MTS). You can also count on the [https://help.ubuntu.com/community/DialupModemHowto/SetUpDialer#Alternative_Way_2_.28using_pppconfig_.26_pon.2Fpoff.29 instructions]. Note the ''115200 nocrtsct settings'' that must be present in the configuration files. | |||
If you connect to the Internet via 3G, you should replace the UART port (/dev/ttyGSM (or /dev/ttyAPP0 in older controller models)) with the CDC-ACM port (/dev/ttyACM0) in the configuration file for your operator. This is necessary to ensure that the communication speed is not limited to the modem UART port bandwidth: | |||
[[ | [[File:GSM-ACM.png|File:GSM-ACM.png]] | ||
After creating the configuration file, start the connection by running | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
pon | pon connection name | ||
</syntaxhighlight> | </syntaxhighlight> | ||
or by editing ''/etc/network/interfaces'', as written above. | |||
For connection to restart itself when it breaks, and to execute it an unlimited number of times, add the following lines to the connection settings (the settings file of the selected operator is in the /etc/ppp/peers directory) : | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
persist | persist | ||
maxfail 0 | maxfail 0 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
if they're not written. In the latest versions of controllers, these settings are configured by default. | |||
The usage of the ppp0 interface configuration in ''/etc/network/interfaces'' file gives the most comprehensive ability to control establishing the connection to the Internet. The most popular option is the ability to execute commands before installing and after enabling/disabling the ppp0 interface. | |||
In the /etc/network/interfaces file, you can use the standard iface pre-up, up, post-up, down, pre-down, post-down options to configure ppp. They define the commands that will be executed on the various phases of initialization/de-initialization interface. Detailed features of their functioning are described in [http://manpages.ubuntu.com/manpages/trusty/man5/interfaces.5.html man interfaces], section IFACE OPTIONS . | |||
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 lang="bash"> | <syntaxhighlight lang="bash"> | ||
Строка 170: | Строка 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> | ||
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 and routing settings==== | ||
''' | '''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 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. | |||
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). | |||
Note that when you deinitialize the ppp0 interface, all created associated with this interface routes will be automatically deleted. | |||
==== | ==== 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: | |||
auto eth0 | auto eth0 | ||
iface eth0 inet dhcp | iface eth0 inet dhcp | ||
Строка 201: | Строка 198: | ||
metric 10 | metric 10 | ||
and for the interface — metric 100: | |||
auto ppp0 | auto ppp0 | ||
iface ppp0 inet ppp | iface ppp0 inet ppp | ||
Строка 210: | Строка 207: | ||
pre-up sleep 10 | pre-up sleep 10 | ||
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. | |||
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. | |||
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. | ||
# | #In case of problems, a backup connection is started and the default gateway settings are changed. | ||
# | #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 | ||
Строка 226: | Строка 223: | ||
<span id="низкоуровневая-работа с модулем через at-команды"></span> | <span id="низкоуровневая-работа с модулем через at-команды"></span> | ||
=== | === Low-level work with the module via AT-commands=== | ||
Read the instructions - [[Работа с последовательным портом из Linux/en|Working with a serial port from Linux]]. Note the settings: 115200, 8N2, '''no hardware flow control'''. | |||
For interactive mode: | |||
* | *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> | ||
[[ | [[Файл:Minicom_settings.png|Minicom Settings]] | ||
* | * 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 settings: ''Save setup as _dev_ttyGSM'' | ||
* | * Then run as '''minicom /dev/ttyGSM''' (all settings will be taken from the profile name ''/dev/ttyGSM'' that we previously created) | ||
* | * Your first command should be ''AAAAAAAAAT'' - the module automatically detects the communication speed (see [[Special:MyLanguage/SIM900R|SIM900R]]) | ||
* | * 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> | ||
* | * Signal strength (see [http://m2msupport.net/m2msupport/atcsq-signal-quality/ here]) | ||
<pre> | <pre> | ||
AT+CSQ | AT+CSQ | ||
</pre> | </pre> | ||
* | * Dialing +79154816102 | ||
<pre> | <pre> | ||
ATD+79154816102; | ATD+79154816102; | ||
</pre> | </pre> | ||
* | * Set baud rate port to a fixed value 115200 | ||
<pre> | <pre> | ||
AT+IPR=115200 | AT+IPR=115200 | ||
</pre> | </pre> | ||
* | * Request time from the built-in real-time clock (RTC) module | ||
<pre> | <pre> | ||
AT+CCLK? | AT+CCLK? | ||
Строка 276: | Строка 272: | ||
</pre> | </pre> | ||
* | * Get module IMEI-code (xxxxxx is a unique number) | ||
<pre> | <pre> | ||
AT+GSN | AT+GSN | ||
Строка 288: | Строка 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. | |||