Aller au contenu

Debian

IP static

Copier le fichier de configuration actuel :

cp /etc/network/interfaces /etc/network/interfaces.bak

Éditer le fichier :

nano /etc/network/interfaces

Remplacer le contenu de base :

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens18
iface ens18 inet dhcp

Par ceci :

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug ensens<number>
auto ens<number>
iface ens<number> inet static
address <ip>
netmask 255.255.255.0
gateway <ip-gateway>
dns-nameservers <dns1> <dns2>

Redémarrer le service réseau :

systemctl restart networking