Ressources informatiques

Ressources informatiques

Ressources informatiques

Effectuer la configuration IP

Effectuer la configuration IP avec /etc/network/interfaces

La partie ci-dessous nécessite d'avoir déjà un accès Internet de configuré avec un autre gestionnaire réseau comme Networkmanager et si besoin d'avoir configuré le proxy.

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

Installez le dépôt resolvconf

x@rpiX:~$  sudo apt install resolvconf
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

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

Remarque : si la configuration ne semble pas avoir été modifié vous pouvez redémarrer le Raspberri Pi à l'aide de la commande suivante :

x@rpiX:~$ sudo shutdown -r now

Vous pouvez alors vous reconnecter et re-tester la configuration IP avec la commande : ip a | grep -A2 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.