[How to] Configure static IP on Red Hat Linux

In case, you are working with set of Static IP’s and want to associate a static IP to your Red Hat instance, here is what can be done.

 

First is to identify the Interface to which you want to assign the Static IP. Let’s say it is eth0. Then open the file /etc/sysconfig/network-scripts/ifcfg-eth0 as root user in Redhat.

pre>By default, the file will look similar to the below example:


DEVICE=eth0
BOOTPROTO=STATIC
ONBOOT=yes
Update the file and add the below lines: 
IPADDR=192.168.0.2
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
Once updated, the file should look like below:
DEVICE=eth0
BOOTPROTO=STATIC
IPADDR=192.168.0.2
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes
Save this file and restart the services using:
service network restart

Try to reach the static IP you just assigned from the external system. If it still does not reach, try rebooting the machine. It might take few minutes for the IP table to be updated. To force the update, you can try pinging the gateway or another IP in the same network. This should get you going.

Leave a Reply

Your email address will not be published. Required fields are marked *