H
H
hethclif2020-02-05 17:03:12
linux
hethclif, 2020-02-05 17:03:12

How to control multiple Raspberry pi connected to different routers via ssh (or other way)?

There are several Raspberry pi connected to different routers, and there is a laptop that is also connected to its own router, how can you manage Raspberry connected to different routers from a laptop via ssh (or other way)? The main task is parallel work, i.e. I enter the command to start the video from the laptop, after the video it starts simultaneously on all Raspberries.
5e3ac981afb4e965179782.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Karpion, 2020-02-06
@Karpion

Virus bot writers use something like this:

  1. After infecting a computer, the virus contacts an IRC server or something. Instead of "infecting" you need to "legally install the program".
  2. The virus "listens" to the chat. All commands that come into the chat are either executed by the built-in interpreter or passed to an external interpreter (for example, a shell).
  3. The control machine (you have a laptop) connects to the same IRC server and sends commands to the chat.
Like everything. An IRC server can be run on a laptop.
The advantages of this scheme are that there is no need to set up "mutual visibility" of raspberries, block VPN, etc. Everything works great with minimal movement.
Please note that when the connection to the IRC server is broken, the raspberries must restore it themselves. But if the server shuts down tightly - you don't have to hit Judas every second, you need to make a reasonable interval like "when the server breaks, make three attempts in a row, and if it fails, then every ten seconds."
Not only the server, but also the router can turn off. And a specific channel can "lie down".
Please note that a situation is possible when the raspberries are out of sync - some received a command, others missed it. In this case, I can offer a different algorithm:
  1. There is a server - file, FTP, Web, RSync, etc. On a laptop or whatever.
  2. A certain file is uploaded to the server, in which it says "as it should be" - for example, "now we are playing such and such a video."
  3. Raspberries read this file. If the current state is what you need - wait. If there are differences, we start / stop the necessary programs.
A separate question is whether it is necessary to twist the video synchronously.

D
Drno, 2020-02-05
@Drno

Connect them all to the same vpn network?

L
lubezniy, 2020-02-05
@lubezniy

I looked at the diagram.
If raspberries from different subnets do not ping each other, then you must first configure the routing. As an option, on the main router (which is Internet) register along a static route to each subnet. Each route specifies the IP space of the network (for example, for a subnet mask of 255.255.255.0, it can be 192.168.0.0, 192.168.1.0, 192.168.2.0, etc.), the subnet mask, and as the gateway, the IP address of the router (in router network), on which the described subnet hangs. NAT on routers other than the main one must be turned off.
After the "visibility" of the raspberries among themselves is ensured, the control machine will also see them, and you can begin to solve the main problem. There are already many different options available. For example, raspberries themselves periodically knock on the control web server, where they somehow put commands that need to be executed, take these commands and execute them. Or the control machine kicks each raspberry in turn and tells it what to do. If we are only talking about video playback, I would probably try to put a small server for distributing a video stream on the network and set up a connection to this server (for example, a browser) to automatically download raspberries and show what it outputs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question