Set Static IP Address
ifupdown2
First install the ifupdown2
package:
sudo apt install ifupdown2
It will generate the file /etc/network/interfaces
if it doesn't exist.
Then edit /etc/network/interfaces
and add the following:
auto eth0 iface eth0 inet static address 172.16.1.20/24 gateway 172.16.1.1 nameserver 172.16.1.1
Adjust the interface name, here eth0
, to your configuration.
Finally enable the interface by running:
ifup eth0
Sourced from wiki.debian.org/NetworkConfiguration