🛠 Configuration Ethernet et accès SSH
Objectives
Install and use a Raspberry Pi 3 Model B "headless" (without a monitor or keyboard): prepare the card with SSH enabled, connect to it via SSH from a computer, configure a network hostname, and understand the peculiarity of the 3B's Ethernet port — a 10/100 Mbit interface via the LAN9514 chip, which shares the USB 2.0 bus with the 4 USB ports.
Hardware
- Raspberry Pi 3 Model B + microSD card (Raspberry Pi OS Lite)
- RJ45 Ethernet cable to the box/router (preferred) or Wi-Fi
- A computer with an SSH client (
sshon Linux/macOS, Open Client on Windows) - Raspberry Pi Imager on the computer
Complete Code
# 1) Graver l'image avec Imager ; dans les réglages personnalisés :
# hostname=raspberrypi, activer SSH, créer l'utilisateur, Wi-Fi si besoin.
# 2) Après boot, depuis l'ordinateur (mDNS fourni par avahi) :
ssh pi@raspberrypi.local
# ou trouver l'IP d'abord :
# avahi-browse -a | grep rasp / regarder le bail DHCP de la box
ssh pi@192.168.1.50
# 3) Sur le Pi : vérifier le lien Ethernet et le débit
ip -br addr show eth0 # ex. 192.168.1.50/24 UP
cat /sys/class/net/eth0/speed # 100 (Mb/s maximum sur le 3B)
# 4) Copier des fichiers par-dessus SSH
scp site/data/tutorials/model-3b.json pi@raspberrypi.local:~/
# 5) Clé publique pour ouvrir SSH sans mot de passe
ssh-copy-id pi@raspberrypi.local
Expected Verification
ssh pi@raspberrypi.local opens a session after the first password. ip -br addr show eth0 displays the IP address and the UP status; cat /sys/class/net/eth0/speed returns 100. scp transfers files without intervention. After ssh-copy-id, a new connection works without a password. A ping raspberrypi.local from the computer responds — mDNS resolution (avahi) is operational.
Common Errors
- SSH forgotten during flashing: the connection is refused; shut down, create an empty file
boot/firmware/sshon the FAT partition, and restart. - Expecting gigabit: the 3B is limited to 100 Mbit, and the LAN9514 shares the USB 2.0 link — a large USB transfer (disk, webcam) reduces network throughput.
Host key verification failedafter reinstallation: runssh-keygen -R raspberrypi.localand then reconnect.raspberrypi.localnot found on Windows: install Bonjour or use the direct IP.- Connecting as root: disabled by default on Raspberry Pi OS, use the created user and
sudo. - Weak power supply causing SSH disconnections and undervoltage warnings in
dmesg: use a 2.5 A power supply.
Other tutorials for this board
Code examples for this board
led_blink.pyPythonbutton_led.pyPythonservo_sweep.pyPythondht_temp.pyPythonoled_i2c.pyPythonmcp3008_read.pyPython