reseau-ethernet.sh
In a fixed installation, a static IP avoids hunting the board in the DHCP lease list. The script creates (or fixes) a manual NetworkManager profile on the Ethernet port, then pings the gateway to verify.
Hardware required
A Libre Computer « Le Potato » (Amlogic S905X, 2 GB) running Armbian, powered by 5 V/2.5 A micro-USB, with its Raspberry-Pi-compatible 40-pin header. One Ethernet cable to the router/switch.
Wiring
RJ45 cable on the board Ethernet port. Pick an address outside the DHCP range to avoid conflicts.
How it works
nmcli connection add sets ipv4.method manual with address/gateway/DNS; connection up applies it. The control ping validates layer 3 immediately. On Armbian: sudo apt install gpiod libgpiod-utils python3-gpiod; header pins are named « 7J1 Header PinN » in gpioinfo. 3.3 V only, no 5 V-tolerant pin.
Going further
Add a second DNS, a search domain (ipv4.dns-search), or flip the profile back to DHCP when moving (ipv4.method auto).
reseau-ethernet.sh
#!/bin/bash
# IP statique sur Ethernet via nmcli (plus propre que ifconfig a la main).
# Usage : ./reseau-ethernet.sh 192.168.1.50/24 192.168.1.1 8.8.8.8
set -e
IP="${1:?Usage: $0 IP/prefixe passerelle DNS [interface]}"
PASSERELLE="${2:?passerelle requise}"
DNS="${3:?DNS requis}"
echo "== Interfaces =="
ip -brief link
DEV="${4:-$(ip -brief link | awk '$2=="up" && $1!~"lo|wl"{print $1; exit}')}"
[ -n "$DEV" ] || { echo "aucune interface up"; exit 1; }
echo "== Profil statique sur $DEV =="
nmcli connection add type ethernet con-name statique-$DEV ifname "$DEV" \
ipv4.method manual ipv4.addresses "$IP" \
ipv4.gateway "$PASSERELLE" ipv4.dns "$DNS" || \
nmcli connection modify statique-$DEV \
ipv4.addresses "$IP" ipv4.gateway "$PASSERELLE" ipv4.dns "$DNS"
nmcli connection up statique-$DEV
echo "== Resultat =="
ip -4 -brief addr show "$DEV"
ping -c 2 -W 2 "$PASSERELLE" && echo "passerelle joignable"