mgonline
Posts: 5
Joined: Tue Mar 06, 2018 5:35 pm

CONNESSIONE SSH TRA DUE RASPBERRY P3

Tue Mar 06, 2018 5:55 pm

Buonasera, sono Marco e da poco mi sono affacciato al mondo Raspberry... Qualche competenza riguardo l'uso di sistemi Linux e Python l'ho già sviluppata in passato e per prima cosa volevo cimentarmi nel collegare due raspberry insieme per fare elaborare più processi in simultanea (ho sintetizzato molto).

I passaggi per configurare Raspbian, per impostare IP statico e collegare le due Raspberry al medesimo Router, attivare i servizi SSH e VNC per poterle programmare da PC senza usare per forza monitor, tastiera e mouse sono tutti processi che ho fatto abbastanza velocemente.

La compilazione di MPI e la creazione dei nodi mi ha fatto tirare un po' più di cancheri ma anche lì, una volta trovati i sorgenti più aggiornati, sono riuscito a mettere insieme il tutto e a testare il nodo su una singola raspberry...

Ora viene la parte più ostica... Una volta clonato la prima raspberry sull'altra raspberry, modificato il machinefile inserendo i due indirizzi IP delle raspberry e abilitata la connessione tra i due raspberry copiando la chiave di sicurezza dall'una all'altra, quando testo il funzionamento del nodo mi da accesso negato.

Non riesco a capire il perchè... Ci sto sbattendo la testa da giorni ma non ci salto fuori perchè apparentemente non mi sembra di sbagliare nulla.

Questi sono i passaggi finali della guida che sto seguendo che non mi riescono. Grazie per il vostro aiuto.

Using SSH instead of password login between the Pis
33. Sort out RSA to allow quick log in. This is the best thing to read:
http://steve.dynedge.co.uk/2012/05/30/l ... vate-keys/
In summary (working on the MASTER Pi node)
$ cd ~
$ ssh-keygen -t rsa –C “raspberrypi@raspberrypi”
This set a default location of /home/pi/.ssh/id_rsa to store the key
Enter a passphrase e.g. “myfirstpicluster”. If you leave this blank (not such good security) then no
further typing of passphrases is needed.
$ cat ~/.ssh/id_rsa.pub | ssh pi@192.168.1.162 "mkdir .ssh;cat >> .ssh/authorized_keys"
34. If you now log into your other Pi and do
$ ls –al ~/.ssh
You should see a file called “authorized_keys” – this is your ticket to ‘no login heaven’ on the nodes
35. Now let us add the new Pi to the machinefile. (Log into it and get its IP address, as above)
Working on the Master Raspberry Pi (the first one you built):
$ nano machinefile
Make it read
192.168.1.161
192.168.1.162
[or whatever the two IP addresses you have for the machines are]
36. Now to run a little C code again. In the examples subdirectory of where you built MPI is the famous
CPI example. First time you will need to enter the passphrase for the key you generated above
(unless you left it blank) and also the password for the second Pi.
$ cd /home/pi/mpi_testing
$ mpiexec -f machinefile -n 2 ~/mpich_build/examples/cpi
Output is
Process 0 of 2 is on raspberrypi
Process 1 of 2 is on raspberrypi
pi is approximately 3.1415926544231318, Error is 0.0000000008333387
If you repeat this a second time you won’t need to type any passwords in. Hurray

Return to “Italiano”