How To Configure Static IP Address in CentOS 8 / RHEL 8


The first task of an administrator who installs an operating system is bringing the server into the network after the OS installation. The server has to be configured with IP address so that it can be accessed over the network.

READ: How To Install CentOS 8 (With Screenshot)

READ: How To Install Red Hat Enterprise Linux 8 (With Screenshot)

Small organizations or home network sometimes uses DHCP enabled routers / DHCP server to assign an IP address to servers. But, bigger organizations use the static IP address for their servers.

Here, in this post, we will see how to configure static IP address in CentOS 8 / RHEL 8.

Configure Static IP Address

Let us configure the system for the following information.

IP Address:
Gateway (Router):
DNS Server 1:
DNS Server 2:
Domain Name: itzgeek.local

Check available network interfaces

Use any one of the below commands to list the available network interfaces on the system.

ifconfig -a


ip a

The output of ifconfig -a may look like below. Here, we will configure the static IP address for enp0s3.

Available Network Interfaces
Available Network Interfaces

Configure Static IP Address

We can set a static IP address to the network interface by using below methods.

1. Editing ifcfg file

2. Using nmtui tool

1. Editing ifcfg file

In this method, we will edit the network interface file ifcfg-ifname under /etc/sysconfig/network-scripts/ directory. For interface enp0s3, the file name would be ifcfg-enp0s3.

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

Set the IP address and other information as per your requirement.

BOOTPROTO=none  # Static IP Address
NAME=enp0s3    # Connection Name
DEVICE=enp0s3  # Device Name
ONBOOT=yes     # Activate on Boot
IPADDR=   # IP Address
NETMASK=   # NetMask
GATEWAY=  # Gateway / Router
DNS1=   # DNS Server 1
DNS2=   # DNS Server 2
DOMAIN=itzgeek.local   # Default Domain Search
Set IP Address
Set IP Address

In RHEL 8, if you make changes in the ifcfg file, NetworkManager needs to be informed. To do that, reload the connection profile using the following command.

To reload all profiles:

nmcli connection reload


To reload only changed file:

nmcli con load  /etc/sysconfig/network-scripts/ifcfg-enp0s3

Then, bring up the network connection with the below command.

nmcli con up enp0s3

2. Using nmtui Tool

You can also use nmtui – the text-based user interface for configuring network interfaces.


Select Edit a connection and press enter.

Edit Connection
Edit Connection

Choose the network interface and then press enter.

Choose Network Interface
Choose Network Interface

Tab to IPv4 CONFIGURATION and change it from Automatic to Manual.

Set Manual IPv4 Configuration
Set Manual IPv4 Configuration

Tab to Show and press enter.

Show IPv4 Configuration
Show IPv4 Configuration

Set the IP address to the interface as per your requirement.

Set Static IP Address
Set Static IP Address

Use down arrow key to scroll down, and tab to OK and press enter to finish the IP configuration.

Finish Configuration
Finish Configuration

Press ESC key go to the connections.

Select Activate a connection and press enter.


Select the network interface name and press enter to Deactivate the network interface.

Deactivate Network Interface
Deactivate Network Interface

Press enter again to Activate the network interface.

Activate Network Interface
Activate Network Interface

Verify Static IP Address

Use ifconfig -a command to verify the IP address.

Static IP
Static IP

Also, verify the DNS server entries.

cat /etc/resolv.conf


DNS Server Information
DNS Server Information


That’s All. You have successfully configured a static IP address to a network interface in CentOS 8 / RHEL 8. Please share your feedback in the comments section.

You might also like