This article assume that you have installed CentOS or RHEL with minimum packages by unchecked all the software during the installation. Therefore, you will not be able to perform TCP/IP configuration using system-config-network or setup command which provide GUI solution. With minimum packages installed, there is the simple way to change your DHCP IP to prefered static IP address. Just follow below steps that was tested on CentOS/RHEL. Lets say the linux ip address is 192.168.2.5, Netmask is 255.255.255.0 and the default gateway is 192.168.2.1.
The config file for interface “eth0” is located at “/etc/sysconfig/network-scripts/ifcfg-eth0”. If the adapter is configured to use DHCP, the content should be as below :
DEVICE=eth0 BOOTPROTO=dhcp HWADDR=00:xx:xx:xx:xx:xx ONBOOT=yes DHCP_HOSTNAME=[dhcphostname]
To change it to static IP address instead, please configure as below :
DEVICE=eth0 BOOTPROTO=none HWADDR=00:xx:xx:xx:xx:xx ONBOOT=yes TYPE=Ethernet NETMASK=255.255.255.0 IPADDR=192.168.2.5 GATEWAY=192.168.2.1
When configuration are done, please run /etc/init.d/network restart to apply the changes
Thats all. Hope this article useful for the beginner.