It is fairly simple to configure a static IP address in Red Hat Enterprise Linux 7.
First one needs to stop & disable the Network Manager service. We do so since we are going to manually enter our network parameters.
To stop & disable the Network Manager service issue;
#systemctl stop NetworkManager.service
#systemctl disable NetworkManager.service
Next issue the following command if you are not sure of the name of the interface you want to set the static IP for. [If you have a single network interface card(NIC) installed in your system, there would be only a single file with the NIC name in network-scripts directory & hence issuing this command is avoidable.]
#ipconfig -a
Next we need to edit manually the interface file. It is recommended you take a backup of this file first before editing.
#vi /etc/sysconfig/network-scripts/ifcfg-p2p1
Keep the default file parameters as they are & simply make the below changes.
BOOTPROTO=STATIC
ONBOOT=yes
IPADDR=192.168.1.71
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
Save the file & quit Vi.
You should keep a note in your mind. Whenever you edit a network interface file, you must restart the network service for the changes to take effect. Since RHEL 7 uses ‘systemd’ to manage the services we issue the following command to restart the network service.
#systemctl restart network
(Though one can even use the old #service network restart)
Once the network service is restarted successfully, you can verify the new IP by;
$ifconfig