Setting up a static IP address in your RHEL or CentOS is simple.

Prerequisite

This how-to guide requires that you have administrative access to the Linux operating system.

Steps

  1. Inside the RHEL Operating system, open the terminal and head to /etc/sysconfig/network-scripts. Using ls command, you can see the available network devices in the directory.

     cd /etc/sysconfig/network-scripts
     ls
    

imagen

  1. Use a text editor to edit the specific network device configuration

     vi ifcfg-ens192
    

A network configuration should look like similar to this imagen

  1. In this sample configuration, we will need to specifically change or add the following:
BOOTPROTO=none
ONBOOT=yes
IPADDR=x.x.x.x
PREFIX=n
GATEWAY=x.x.x.x
DNS1=x.x.x.x

Updated network scripts. Highlighted are those required entries.
imagen