Wirenboard6:InstallingOnTheRemoteSite/en: различия между версиями

Нет описания правки
(Новая страница: «On the server in the configuration file (<code>/etc/vpn/server.conf</code>) see which client-address match file is specified in the <code>ifconfig-pool-persist <…»)
 
(не показано 28 промежуточных версий этого же участника)
Строка 247: Строка 247:
On the server in the configuration file (<code>/etc/vpn/server.conf</code>) see which client-address match file is specified in the <code>ifconfig-pool-persist < /code> parameter and add the address for the client-controller from the network address range described in the <code>server</code> parameter of the configuration file to this file.
On the server in the configuration file (<code>/etc/vpn/server.conf</code>) see which client-address match file is specified in the <code>ifconfig-pool-persist < /code> parameter and add the address for the client-controller from the network address range described in the <code>server</code> parameter of the configuration file to this file.


Например,  
For example,  
<pre>
<pre>
service openvpn stop
service openvpn stop
mcedit /etc/openvpn/ipp.txt
mcedit /etc/openvpn/ipp.txt
</pre>
</pre>
Добавляем строку <code>A7ZO7UCC,10.8.0.48</code>
Add the line <code>A7ZO7UCC,10.8.0.48</code>
<pre>service openvpn start</pre>
<pre>service openvpn start</pre>




Для второго экземпляра сервера такую же операцию выполняем с его конфигурационными файлами, IP-адреса должны различаться, например, добавляем запись
For the second server instance, we perform the same operation with its configuration files, the IP addresses should be different, for example, add an entry
<code>A7ZO7UCC,10.9.0.48</code>
<code>A7ZO7UCC,10.9.0.48</code>




Конфигурационные файлы для клиента на контроллере для двух соединений будем хранить в файлах <code>/etc/openvpn/client.conf</code> и <code>/etc/openvpn/client1.conf</code>.
The configuration files for the client on the controller for the two connections will be stored in the <code>/etc/openvpn/client files.conf</code> and <code>/etc/openvpn/client1.conf</code>.


Содержимое файла настройки клиента:
Contents of the client configuration file:
<pre>
<pre>
client
client
Строка 279: Строка 279:
link-mtu 1542
link-mtu 1542
keysize 128
keysize 128
#keysize 128 -- для совместимости с имеющимися клиентами
#keysize 128 - for compatibility with existing clients
</pre>
</pre>


В файле конфигурации второго vpn-подключения <code>сlient1.conf</code> замените <code>proto udp</code> на <code>proto tcp</code> и укажите второй IP-адрес сервера в параметре <code>remote</code>.  
In the configuration file of the second vpn connection, <code>CLIENT1.conf</code> replace <code>proto udp</code> with <code>proto tcp</code> and specify the second IP address of the server in the <code>remote</code>parameter.  


Автозагрузка сервиса OpenVPN на контроллере включается командой:
Startup of the OpenVPN service on the controller is enabled by the command:
<pre>update-rc.d openvpn defaults</pre>
<pre>update-rc.d openvpn defaults</pre>
   
   
Проверяем доступность сервера
Check server availability
<code>ping 10.8.0.1</code>
<code>ping 10.8.0.1</code>


Строка 293: Строка 293:
== AutoSSH ==
== AutoSSH ==


Еще одно резервное подключение к контроллеру сделаем на основе <code>AutoSSH</code>. Механизм работы таков: с контроллера устанавливается ssh-соединение к серверу, при этом ssh-порт контроллера пробрасывается на один из свободных портов на localhost сервера. Сервис аutossh следит за тем, что ssh-соединение не разорвано, и в случае разрыва восстанавливает его. Восстановление происходит не мгновенно какое-то время порт, используемый на <code>localhost</code> сервера удерживается демоном <code>sshd</code>.  
Another fallback controller connection will be based on the <code>AutoSSH</code>. The mechanism of work is as follows: SSH-connection from the controller to the server is established, and the ssh-port of the controller is forwarded to one of the free ports on the localhost server. Service аutossh ensures that the ssh connection is not broken, and in case of the gap restores it. Recovery is not instantaneous for a while, the port used on the server's <code>localhost</code> is held by the <code>sshd</code>daemon.  


Устанавливаем на контроллере <code>apt-get install autossh</code>. Генерируем пару ключей для пользователя <code>root</code>:
Install on the controller <code>apt-get install autossh</code>. Generate a key pair for the user <code>root</code>:
<pre>ssh-keygen </pre>
<pre>ssh-keygen </pre>
Пароль — пустой.
Password is empty.


Для обслуживания удаленных подключений создаем пользователя <code>remote</code> на сервере с оболочкой <code>/bin/false</code>:  
To maintain remote connections, create a user <code>remote</code> on the server with the shell <code>/bin/false</code>:  


<pre>adduser --home /home/remote --shell /bin/false remote </pre>
<заранее>команду adduser --Home /для дома/дистанционный --оболочку /bin/false в удаленных и </pre>


В файл <code>/home/remote/.ssh/authorized_keys</code> на сервере добавляем созданный на контроллере ключ <code>/root/.ssh/id_rsa.pub</code> с преамбулой
Here, in file <code>/home/remote/.ssh/authorized_keys</code> on the server, we add key created on the controller <code>/root/.ssh/id_rsa.pub</code> with the preamble


<code>no-agent-forwarding,no-X11-forwarding,permitopen="localhost:62001" </code>
<code>no-agent-forwarding,no-X11-forwarding,permitopen="localhost:62001" </code>


что обеспечит дополнительную безопасность сервера при подключении контроллера. Порт 62001 — порт localhost-сервера, на который будет перенаправлен ssh-порт данного контроллера.  
this will provide additional security for the server when the controller is connected. Port 62001 is the port of the localhost server to which the ssh port of this controller will be redirected.  


Первый раз подключаемся с контроллера на сервер вручную:
The first time we connect from the controller to the server manually:
<pre>ssh remote@vpn.mydomain.com </pre>
<pre>ssh remote@vpn.mydomain.com </pre>


На контроллере создаем файл <code>\etc\systemd\system\autossh.service</code> для запуска <code>autossh</code> в качестве сервиса:
On the controller, create a file <code>\etc\systemd\system\autossh.service</code> to run it <code>autossh</code> as a service:




Строка 335: Строка 335:
WantedBy=multi-user.target
WantedBy=multi-user.target
</pre>
</pre>
Включаем сервис а автозагрузку на контроллере:
Add service to autorun on the controller
<pre>systemctl enable autossh.service</pre>
<pre>systemctl enable autossh.service</pre>


После запуска сервиса мы можем подключиться к контроллеру на сервере с помощью команды
After starting the service, we can connect to the controller on the server using the command
<pre>ssh 127.0.0.1 -p 62001</pre>
<pre>ssh 127.0.0.1 -p 62001</pre>




== Передача данных  с контроллера в облако ==
== Data transfer from controller to the cloud ==


Для передачи MQTT-сообщений с контроллера в облачный сервис используется MQTT-бридж, конфигурация которого настраивается на контроллере в файле <code>\mnt\data\etc\mosquitto\conf.d\bridge.conf</code>
To send MQTT messages from the controller to the cloud service, the MQTT bridge is used, the configuration of which is configured on the controller in the file <code>\mnt\data\etc\mosquito\conf.d\bridge.conf</code>
<pre>
<pre>
connection wb_devices_cloud.wb_A7ZO7UCC
connection wb_devices_cloud.wb_A7ZO7UCC
Строка 359: Строка 359:
</pre>
</pre>


Затем выполните команду
Then run the command


<pre>
<pre>
Строка 366: Строка 366:




Если вы хотите передавать данные на несколько серверов одновременно, создайте несколько разделов <code>connection</code>.
If you want to transfer data to multiple servers at the same time, create multiple <code>connection</code>partitions.




== Возможные неполадки GPRS-соединения ==
== Possible GPRS connection problems ==


Возможных причин отсутствия GPRS-подключения может быть несколько.  
There can be several possible reasons for the lack of GPRS connection.  
* Закончился оплаченный лимит трафика.  
* The paid traffic limit has ended.  
* Низкий уровень сигнала, плохой контакт антенны.  
* Low voltage, poor contact to the antenna.  
* СИМ-карты некоторых операторов рассчитаны только на 4G-сети, 3G-подключение установить с ними не получится.  
* SIM cards of some operators are designed only for 4G-network, 3G-connection to install them will not work.  
* Проверьте, правильно ли вставлена СИМ-карта в слот.  
* Check if the SIM card is inserted correctly into the slot.  
* Возможно, СИМ-карта нерабочая.  
* The SIM card may not be working.  
* Ваш тарифный план не предусматривает пакетную передачу данных.  
* Your data plan does not include packet data.  


Прежде чем идти в личный кабинет и звонить провайдеру, можно выполнить ряд простых проверок.
Before you go to your personal account and call the provider, you can perform a number of simple checks.




Запустите команду
Run the command


<pre>gammu networkinfo</pre>
<pre>gammu networkinfo</pre>
Строка 396: Строка 396:
</pre>
</pre>


Важно, что контроллер подключен к пакетной сети передачи данных <pre>(GPRS                 : attached)</pre> и GPRS-соединение установлено.  
It is important that the controller is connected to the packet data network <pre>(GPRS : attached)</pre> and GPRS connection is established.  


После этого оцените уровень сигнала в minicom командой <code>AT+CSQ</code>
Then evaluate the signal strength in minicom with <code>AT+CSQ</code>
Вы получите результат в виде <code>13,99</code>
You will get the result as <code>13.99</code>


Первая цифра показывает мощность сигнала: > 9 — удовлетворительный, > 14 — хороший, > 19 — отличный. Низкие и нестабильные значения CSQ означают, что антенна плохо расположена, неаккуратно подключена, радиообстановка неблагоприятная.
The first digit shows the signal strength: > 9 — satisfactory, > 14 — good, > 19 — excellent. Low and unstable CSQ values mean that the antenna is poorly positioned, carelessly connected, radio placement is unfavorable.


Если обе проверки пройдены, но связи нет, обратитесь к провайдеру (загляните в личный кабинет), можете проверить СИМ-карту в смартфоне.
If both checks are passed, but there is no connection, contact your provider (check in your personal account), you can check the SIM card in your smartphone.
12 063

правки