3 Ways to Set a Static IP Address in RHEL 8

RHEL 8 (Red Hat Enterprise Linux 8) is a popular Linux-based operating system used by many organizations for their servers and workstations. In RHEL 8, IP (Internet Protocol) addresses can be set dynamically or statically. A dynamic IP address is assigned automatically by a DHCP (Dynamic Host Configuration Protocol) server, while a static IP address is manually configured by the user. In this article, we will discuss three ways to set a static IP address in RHEL 8.

Using Network Manager GUI

The Network Manager GUI is a graphical user interface that makes it easy to manage network settings, including setting a static IP address. Here are the steps to follow

Step 1 Open Network Manager GUI

Click on the network icon in the system tray (the icon that looks like two arrows pointing up and down). Then click on the gear icon to open Network Manager settings.

Step 2 Select Network Interface

In Network Manager settings, select the network interface that you want to set a static IP address for. This could be your Ethernet connection or a Wi-Fi connection.

Step 3 Click on IPv4 Tab

Click on the IPv4 tab in Network Manager settings to configure IPv4 settings for the selected network interface.

Step 4 Select Manual Method

Under the IPv4 tab, select "Manual" method for the "Addresses" setting.

Step 5 Add Static IP Address

In the "Addresses" section, click on the "+" button to add a new IP address. Enter the IP address, subnet mask, and gateway address for your network.

Step 6 Save Changes

Click on the "Apply" button to save changes and set the static IP address for the selected network interface.

Using nmcli Command Line Tool

The nmcli command line tool is a powerful way to manage network settings in RHEL 8. Here are the steps to follow

Step 1 Open a Terminal Window

Open a terminal window by pressing "Ctrl+Alt+T" or by clicking on the terminal icon in the system tray.

Step 2 List Available Network Connections

Run the following command to list available network connections

nmcli connection show

This will show a list of available network connections on your system.

Step 3 Set Method to Manual

Run the following command to set the network interface to use manual IP configuration

nmcli connection modify <interface> ipv4.method manual

Replace <interface> with the name of the network interface that you want to configure. For example, if you want to configure your Ethernet connection

nmcli connection modify eth0 ipv4.method manual

Step 4 Add Static IP Address

Run the following command to add a static IP address

nmcli connection modify <interface> ipv4.addresses <ip_address>/<prefix> ipv4.gateway <gateway_address>

For example, if you want to set the IP address to "192.168.1.100", subnet to "/24", and gateway to "192.168.1.1"

nmcli connection modify eth0 ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1

Step 5 Set DNS Server

Run the following command to set the DNS server for the network interface

nmcli connection modify <interface> ipv4.dns <dns_server>

For example, if your DNS server's IP address is "8.8.8.8"

nmcli connection modify eth0 ipv4.dns 8.8.8.8

Step 6 Apply Changes

Run the following command to apply the changes

nmcli connection up <interface>

For example, if you configured your Ethernet connection

nmcli connection up eth0

Using Network-scripts Configuration Files

The network-scripts configuration files are a set of files that define network interface configurations in RHEL 8. Here are the steps to follow

Step 1 Open Network-scripts Directory

Navigate to the network-scripts directory by running the following command

cd /etc/sysconfig/network-scripts/

Step 2 Edit Network Interface Configuration File

Run the following command to edit the network interface configuration file

sudo nano ifcfg-<interface>

Replace <interface> with the name of the network interface. For example

sudo nano ifcfg-eth0

Step 3 Set Static IP Configuration

Add the following lines to the configuration file

BOOTPROTO=none
IPADDR=<ip_address>
NETMASK=<subnet_mask>
GATEWAY=<gateway_address>
DNS1=<dns_server>
ONBOOT=yes

For example, to set IP address to "192.168.1.100", subnet mask to "255.255.255.0", gateway to "192.168.1.1", and DNS server to "8.8.8.8"

BOOTPROTO=none
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
ONBOOT=yes

Step 4 Save Changes

Save changes to the configuration file and exit the text editor by pressing Ctrl+X, then Y, then Enter.

Step 5 Restart Network Service

Run the following command to restart the network service

sudo systemctl restart NetworkManager

Verification

After configuring the static IP address using any of the above methods, you can verify the configuration by running

ip addr show

This will display all network interfaces and their configured IP addresses.

Conclusion

In this article, we discussed three effective ways to set a static IP address in RHEL 8. The Network Manager GUI provides an easy-to-use graphical interface, while the nmcli command line tool offers more flexibility for advanced users and automation scripts. Network-scripts configuration files provide direct control over interface settings for traditional system administrators.

Updated on: 2026-03-17T09:01:38+05:30

22K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements