Debian 10 static IP
30 Aug 2020Cheat sheet to set a static IP address on Debian, just because I can’t remember how to do it.
By default Debian use dhcp, so we need to edit /etc/network/interfaces
just open it with your favourite editor.
# 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 ens192
iface ens192 inet dhcp
on the last line change dhcp
to static
and add lines for address, netmask etc.
# 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 ens192
iface ens192 inet static
address 192.168.1.17
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
Restart networking
$ sudo systemctl restart networking
or just reboot your machine.