Create a static network configuration in linux - /etc/network/interfaces

Here we explain how to create a static network configuration in Linux. This is then immediately fixed again after a reboot.

In many cases, a DHCP server is sufficient to distribute IP addresses in the network. But just as often a fixed IP address is assumed on the network interface. Here is a simple network configuration example to set a fixed IP address on a specific interface.

Edit /etc/network/interfaces - IPv4

## Edit the file
nano /etc/network/interfaces

## Change the network config to your choise network configuration

auto eth0
allow-hotplug eth0
iface eth0 inet static
     address 192.168.10.10
     netmask 255.255.255.0
     gateway 192.168.10.1
     dns-nameservers 8.8.8.8 1.1.1.1

Edit /etc/network/interfaces - IPv6

## Edit the file
nano /etc/network/interfaces

## Change the network config to your choise network configuration

auto eth0
allow-hotplug eth0
iface eth0 inet6 static
     address 2001:dc8::daaa:beaf/64
     gateway 2001:dc8::dead:1