Posted on October 9, 2020 - 1 minute read

How to Set Static IP Address on Linux

Different from desktop machines where you can use dynamic IP addresses, static IP address are often required on a server infrastructure.

RHEL / CentOS / Fedora:

You will need to edit:


Where ifcfg-eth0 relates to your network interface eth0. If your interface name is enp1s0 then the file that you will need to edit is ifcfg-enp1s0.

Add the following fields:


Debian / Ubuntu:

To setup static IP address in Debian/ Ubuntu, edit the following file:


You may see a line looking like this:

auto eth0
iface eth0 inet dhcp

Change it so it looks like this:

auto eth0
iface eth0 inet static

Restart the networking on your system:

SysVinit: /etc/init.d/network restart

SystemD: systemctl restart network

If unsure of what which system manager your distro uses, try this:

pidof systemd && echo "systemd" || echo "sysvinit"


You now know how to configure a static IP address on a Linux distro.