Ressources informatiques

Ressources informatiques

Ressources informatiques

Installer Raspberry Pi OS

Créer la carte SD (Windows)

Télécharger l'archive

Créer la carte SD avec Rufus

Installer RaspberryPi Installer RaspberryPi

Effectuer la post installation (avec un clavier et une souris)

Activer le serveur ssh

Il faut utiliser la commnde systemctl

x@raspberrypi:~ $ sudo systemctl enable ssh
x@raspberrypi:~ $ sudo systemctl start ssh

Renommer le RPi

Dans l'exemple ci-dessous le nouveau nom du Raspberry Pi est : rpiX

x@raspberrypi:~ $ sudo hostnamectl set-hostname rpiX
x@raspberrypi:~ $ sudo nano /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       rpiX
x@raspberrypi:~ $ sudo shutdown -r now
x@rpiX:~$

Effectuer la configuration IP

Par défaut, le Raspberry Pi utilise NetworkManager, nous allons utiliser le dépôt ifupdown pour être

Affecter une adresse IP, l'adresse du serveur DNS et l'adresse de la passerelle au Raspberry pi avec NetworkManager

Visualiser les connexions existantes
x@rpiX$ nmcli connection show
NAME                UUID                                  TYPE      DEVICE
Wired connection 1  c7bf5235-1432-345a-849c-cda9ba0f2ff7  ethernet  eth0
lo                  c59015c7-dbee-40db-87b5-25af9d227b09  loopback  lo

La connexion s'appelle Wired connection 1

Effectuer la configuration IP

Ci-dessous la configuration choisie est :

x@rpiX:~$ sudo nmcli connection modify "Wired connection 1" ipv4.method manual ipv4.
addresses 192.168.1.100/24 ipv4.gateway 192.168.1.254 ipv4.dns "192.168.1.254"
Activer la configuration
x@rpiX:~$ sudo nmcli connection up ""Wired connection 1"
Visualiser le résultat
x@rpiX:~$ nmcli
eth0: connected to Wired connection 1
        "Microchip SMSC9512/9514"
        ethernet (smsc95xx), B8:27:EB:AA:BB:CC, hw, mtu 1500
        ip4 default, ip6 default
        inet4 192.168.1.100/24
        route4 192.168.1.0/24 metric 100
        route4 default via 192.168.1.254 metric 100
        inet6 ...
        inet6 ...
        route6 ...
        route6 ...
        route6 ...

lo: connected (externally) to lo
        "lo"
        loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
        inet4 127.0.0.1/8
        inet6 ::1/128

wlan0: unavailable
        "Broadcom BCM43438 combo and Bluetooth Low Energy"
        wifi (brcmfmac), B8:27:EB:AA:BB:CC, sw disabled, hw, mtu 1500

DNS configuration:
        servers: 192.168.1.254
        interface: eth0

        servers:...
        domains: lan
x@rpiX:~$ ip a | grep -A3 eth0:
2: eth0:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:aa:bb:cc brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.100/24 brd 192.168.1.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
x@rpiX:~$ ip r
default via 192.168.1.254 dev eth0 proto static metric 100
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100 metric 100 
x@rpiX:~$ cat /etc/resolv.conf
# Generated by NetworkManager
search lan
nameserver 192.168.1.254

Affecter une adresse IP, l'adresse du serveur DNS et l'adresse de la passerelle au Raspberry pi avec ifupdown

Installer le dépôt ifupdown
x@rpiX:~$ sudo apt install ifupdown

Creating /etc/network/interfaces.
Created symlink /etc/systemd/system/multi-user.target.wants/networking.service → /lib/systemd/system/networking.service.
Created symlink /etc/systemd/system/network-online.target.wants/networking.service → /lib/systemd/system/networking.serv
ice
Modifiez la configuration IP

Il est conseillé de copier le fichier /etc/network/interfaces d'origine.

homogène avec une configuration Debian

x@rpiX:~$ sudo cp /etc/network/interfaces /etc/network/interfaces.origin
Modifier le fichier /etc/network/interfaces

Modifiez le fichier /etc/network/interfaces à l'aide de l'éditeur de votre choix : nano, ...

Ci-dessous la configuration choisie est :

x@rpiX:~$ sudo nano /etc/network/interfaces

Résultat de la modification :

x@rpiX:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
# interface eth0
auto eth0
iface eth0 inet static
address 192.168.1.11/24
gateway 192.168.1.254
dns-nameservers 192.168.1.254
Installez le dépôt resolvconf
x@rpiX:~$  sudo apt install resolvconf
Redémarrez l'interface réseau
x@rpiX:~$ sudo ifdown eth0; sudo ifup eth0
Valider la configuration
x@rpiX:~$ ip a | grep -A2 eth0:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet  192.168.1.11/24 brd 192.168.1.255 scope global eth0
La passerelle
x@rpiX:~$ ip r
default via 192.168.1.254 dev eth0 onlink
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.11
La configuration DNS
x@rpiX:~$ sudo cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.

nameserver 192.168.1.254

Tester

Tester la configuration IP

en effectuant un ping vers la passerelle
pi@raspberrypi:~ $ ping -c1 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
64 bytes from 192.168.1.254: icmp_seq=1 ttl=64 time=1.37 ms
en effectuant un ping vers un hôte d'internet
x@rpiX:~ $  ping -c1 -W1 195.83.96.84
PING 195.83.96.84 (195.83.96.84) 56(84) bytes of data.
64 bytes from 195.83.96.84: icmp_seq=1 ttl=242 time=22.5 ms

--- 195.83.96.84 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 22.453/22.453/22.453/0.000 ms

Tester la résolution de noms (client DNS)

x@rpiX:~ $ ping -c1 -W 1 lyc-michelet-arpajon.ac-versailles.fr
PING spip-lyc.nat-vip.ac-versailles.fr (195.83.96.84) 56(84) bytes of data.
64 bytes from 195.83.96.84 (195.83.96.84): icmp_seq=1 ttl=242 time=21.9 ms

--- spip-lyc.nat-vip.ac-versailles.fr ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 21.853/21.853/21.853/0.000 ms
x@rpiX:~ $ sudo apt install dnsutils
x@rpiX:~ $ nslookup ressourcesinformatiques.com
Server:		192.168.1.254
Address:	192.168.1.254#53

Non-authoritative answer:
Name:	ressourcesinformatiques.com
Address: 213.186.33.16
x@rpiX:~ $ host www.ressourcesinformatiques.com
www.ressourcesinformatiques.com is an alias for ressourcesinformatiques.com.
ressourcesinformatiques.com has address 213.186.33.16
ressourcesinformatiques.com mail is handled by 100 mxb.ovh.net.
ressourcesinformatiques.com mail is handled by 5 mx2.ovh.net.
ressourcesinformatiques.com mail is handled by 1 mx1.ovh.net.