Dans cette section, on s'intéresse à la préparation des systèmes cibles.
Cette préparation concerne :
L'architecture du lab ne s'appuie pas sur des enregistrements DNS. Aussi, pour plus de simplicité, il est nécessaire de normaliser les noms.
Sur chacun des noeuds (VSTOCK01, VSTOCK02, VSTOCK03), nous allons éditer le fichiers /etc/hosts pour y ajouter les éléments suivants:
# LAB
192.168.50.31 vstock01
192.168.50.32 vstock02
192.168.50.33 vstock03
192.168.50.40 srvcli01
192.168.120.1 vstock01-sto
192.168.120.2 vstock02-sto
192.168.120.3 vstock03-sto
root@vstock01:/home/guillaume# vim /etc/hosts
guillaume@vstock01:~$ ping vstock02
PING VSTOCK02 (192.168.50.32) 56(84) bytes of data.
64 bytes from VSTOCK02 (192.168.50.32): icmp_seq=1 ttl=64 time=0.287 ms
--- VSTOCK02 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.287/0.287/0.287/0.000 ms
guillaume@vstock01:~$ ping vstock03
PING VSTOCK03 (192.168.50.33) 56(84) bytes of data.
64 bytes from VSTOCK03 (192.168.50.33): icmp_seq=1 ttl=64 time=0.200 ms
--- VSTOCK03 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.200/0.200/0.200/0.000 ms
guillaume@vstock01:~$ ping vstock02-sto
PING VSTOCK02-STO (192.168.120.2) 56(84) bytes of data.
64 bytes from VSTOCK02-STO (192.168.120.2): icmp_seq=1 ttl=64 time=0.465 ms
--- VSTOCK02-STO ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.465/0.465/0.465/0.000 ms
guillaume@vstock01:~$ ping vstock03-sto
PING VSTOCK03-STO (192.168.120.3) 56(84) bytes of data.
64 bytes from VSTOCK03-STO (192.168.120.3): icmp_seq=1 ttl=64 time=0.244 ms
--- VSTOCK03-STO ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.244/0.244/0.244/0.000 ms
guillaume@vstock01:~$ ping srvcli01
PING SRVCLI01 (192.168.50.40) 56(84) bytes of data.
64 bytes from SRVCLI01 (192.168.50.40): icmp_seq=1 ttl=64 time=0.434 ms
--- SRVCLI01 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.434/0.434/0.434/0.000 ms
Sur SRVCLI01, il est nécessaire d'éditer le fichier /etc/hosts de la même manière mais pour y ajouter seulement les informations suivantes :
# LAB
192.168.50.31 vstock01
192.168.50.32 vstock02
192.168.50.33 vstock03
192.168.50.40 srvcli01
Enfin, depuis SRVLI01, on réalise les tests de ping via les noms :
guillaume@srvcli01:~$ ping vstock01
PING VSTOCK01 (192.168.50.31) 56(84) bytes of data.
64 bytes from VSTOCK01 (192.168.50.31): icmp_seq=1 ttl=64 time=0.852 ms
--- VSTOCK01 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.852/0.852/0.852/0.000 ms
guillaume@srvcli01:~$ ping vstock02
PING VSTOCK02 (192.168.50.32) 56(84) bytes of data.
64 bytes from VSTOCK02 (192.168.50.32): icmp_seq=1 ttl=64 time=0.355 ms
--- VSTOCK02 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.355/0.355/0.355/0.000 ms
guillaume@srvcli01:~$ ping vstock03
PING VSTOCK03 (192.168.50.33) 56(84) bytes of data.
64 bytes from VSTOCK03 (192.168.50.33): icmp_seq=1 ttl=64 time=0.385 ms
--- VSTOCK03 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.385/0.385/0.385/0.000 ms
L'objectif de cette partie est de permettre la connexion ssh via le compte root entre les 3 noeuds du cluster. Cette connexion s'appuiera au final que sur une authentification par échange de clefs.
Cette opération est à réaliser sur VSTOCK01, VSTOCK02, VSTOCK03. Ici la démarche est illustrée uniquement sur le serveur VSTOCK01.
root@vstock01:~# vim /etc/ssh/sshd_config
#PermitRootLogin prohibit-password
par :
PermitRootLogin yes
root@vstock01:~# systemctl restart ssh
root@vstock01:~# systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/usr/lib/systemd/system/ssh.service; disabled; preset: enabled)
Active: active (running) since Sun 2025-12-28 09:51:35 UTC; 6s ago
TriggeredBy: ● ssh.socket
Docs: man:sshd(8)
man:sshd_config(5)
Process: 1208 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 1209 (sshd)
Tasks: 1 (limit: 4603)
Memory: 1.2M (peak: 1.3M)
CPU: 93ms
CGroup: /system.slice/ssh.service
└─1209 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
déc. 28 09:51:35 vstock01 systemd[1]: Starting ssh.service - OpenBSD Secure Shell server...
déc. 28 09:51:35 vstock01 sshd[1209]: Server listening on 0.0.0.0 port 22.
déc. 28 09:51:35 vstock01 sshd[1209]: Server listening on :: port 22.
déc. 28 09:51:35 vstock01 systemd[1]: Started ssh.service - OpenBSD Secure Shell server.
root@vstock01:~# passwd
New password:
Retype new password:
passwd: password updated successfully
root@vstock01:~# ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -N ""
Generating public/private ed25519 key pair.
Your identification has been saved in /root/.ssh/id_ed25519
Your public key has been saved in /root/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:0yNJEDKX0TGFkyKP6ka0LfWYYDHbo2+YC6mgUGfn3Z4 root@vstock01
The key's randomart image is:
+--[ED25519 256]--+
| o ==o=. |
| o .+o.=. |
| = + ... |
| = = .. o |
| o.Bo=. S o |
| o*o+o.. + . |
|=o = . . . |
|=.= o . . |
|o..o E |
+----[SHA256]-----+
root@vstock01:~# ls -l /root/.ssh
total 8
-rw------- 1 root root 0 déc. 27 13:22 authorized_keys
-rw------- 1 root root 399 déc. 28 09:58 id_ed25519
-rw-r--r-- 1 root root 95 déc. 28 09:58 id_ed25519.pub
root@vstock01:~# ssh-copy-id -i /root/.ssh/id_ed25519.pub root@vstock02
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_ed25519.pub"
The authenticity of host 'vstock02 (192.168.50.32)' can't be established.
ED25519 key fingerprint is SHA256:f7h8CmtAuU+8GAaAKuOqaSsFovjoEsgQzKn9x2aldOU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@vstock02's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@vstock02'"
and check to make sure that only the key(s) you wanted were added.
root@vstock01:~# ssh-copy-id -i /root/.ssh/id_ed25519.pub root@vstock03
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_ed25519.pub"
The authenticity of host 'vstock03 (192.168.50.33)' can't be established.
ED25519 key fingerprint is SHA256:YrNByXJSxdf1mU0/TcEgivScy3Y85sFyHBWmqkpQgiI.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@vstock03's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@vstock03'"
and check to make sure that only the key(s) you wanted were added.
root@vstock01:~# ssh root@vstock02
root@vstock01:~# ssh root@vstock03
root@vstock01:~# vim /etc/ssh/sshd_config
PermitRootLogin yes
par :
PermitRootLogin prohibit-password
root@vstock01:~# systemctl restart ssh
root@vstock01:~# ssh root@vstock02
root@vstock01:~# ssh root@vstock03