🛠 Configurer Ethernet et se connecter en SSH
Objectives
Install and use the Raspberry Pi 5 without a screen (headless): enable the SSH server, retrieve the IP address on the Gigabit local network, and connect from another computer. The Pi 5 features a Gigabit Ethernet controller (integrated MAC, driven by the RP1 chip), with PoE+ possible via a dedicated HAT.
Hardware
- Raspberry Pi 5 with official 27 W power supply (5 V / 5 A)
- microSD card with Raspberry Pi OS 64-bit (written with Raspberry Pi Imager)
- RJ45 Ethernet cable to a box/router
- A client computer (Linux, macOS, or Windows with OpenSSH)
Complete code
# 1) Préparer la carte : dans Raspberry Pi Imager, menu Options (Ctrl+Maj+X),
# cocher « Activer SSH » (utilisateur + clé) et le Wi-Fi si besoin.
# Alternative manuelle après écriture :
sudo touch /boot/firmware/ssh # active sshd au premier démarrage (Bookworm)
# 2) Démarrer, brancher le câble, puis trouver l'adresse IP depuis le Pi :
ip -4 addr show eth0 | grep inet
# ou sans écran, depuis le réseau :
arp -a | grep b8:27:eb # préfixe MAC courant de Raspberry Pi
ping -c3 raspberrypi.local # découverte par mDNS
# 3) Depuis le poste client :
ssh utilisateur@raspberrypi.local
# 4) Sur le Pi : sécuriser et fixer l'identité
sudo hostnamectl set-hostname labo-pi5
sudo apt update && sudo apt upgrade -y
sudo systemctl enable --now ssh
# 5) Débit Ethernet réel (test iperf3 contre une machine du réseau)
sudo apt install -y iperf3
iperf3 -c 192.168.1.10
Expected verification
ssh user@raspberrypi.local opens a remote session; the prompt displays the new hostname. iperf3 approaches 940 Mbit/s on a healthy Gigabit network. systemctl is-enabled ssh returns enabled.
Common errors
- Forgetting to enable SSH when writing the image: connection refused; rewrite the image or create the
sshfile in the boot partition. - Looking for
raspberrypi.localwithout an mDNS service on Windows: install Bonjour or use the raw IP. - Undersized power supply: with a power supply other than 5 V/5 A, the USB budget is limited to 600 mA and network drops may occur under load.
- SSH key permissions incorrect:
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys. - Confusing eth0 and wlan0: check the active interface with
ip linkbefore reading the IP.
Other tutorials for this board
Code examples for this board
led_blink.pyPythonbutton_led.pyPythonservo_sweep.pyPythondht_temp.pyPythonoled_i2c.pyPythonmcp3008_read.pyPython