RedHat UNIX

Setting an static IP address in RHEL (the old way)

In RHEL8, you use NetworkManager or NMCLI to configure the networking, but in RHEL7 and before, you had to do it a different way.
In this post I show you which files you need to configure to be able set a static IP in REHL7.

1) Edit the network card configuration file, which will be something like the following
/etc/sysconfig/network-scripts/ifcfg-ens33
2) Add the network mask, and IP address. Remove any reference to DHCP that may or may not be in there.
Like this:
IPADDR=192.168.1.132
NETMASK=255.255.255.0

3) Edit the network configuration file
/etc/sysconfig/network
4) Add a line configuring the gateway, like this
GATEWAY=192.168.1.1
5) restart the network
systemctl restart network.service
NOTE : This assumes that the NetworkManager.service has been stopped and disabled.