How to set static IP address on Red Hat

This is a quick blog on how to change the IP allocation on your Red Hat machine from Dynamic to Static.

Go to the /etc/sysconfig/network-scripts and open the ifcfg-eth0 file for editing

change

BOOTPROTO=DYNAMIC

to

BOOTPROTO=STATIC

add a new line

IPADDR=(type ip address here)

Save and Close ifcfg-eth0.

To flush IP address use the following command

/etc/init.d/network stop

then

/etc/init.d/network start

To check that the IP address has taken type

/sbin/ifconfig.

Advertisements

9 thoughts on “How to set static IP address on Red Hat

  1. I was wondering what the advantage of having a static IP is? Doesn’t that leave one open to be hacked? There is recent trend to Change IP dynamically and use multiple private proxies to effectively hide your IP to surf securely and anonymously.

  2. In this case the server has a static IP and is registered with our DNS so that it can be located.
    If you are serving content that you would like people to find and a static IP is available then it is best to use that otherwise you have to keep updating DNS with some sort of dynamic dns service so that your human readable server name can be converted into your ever changing IP address.

    If you are not serving any content and do not wish to be found then I guess having a dynamic IP that is reassigned everytime you connect is ok. However as far as being hacked changing your IP is not much of a defence. It would be like changing your street address every day, if one day an opportunist sees an unlocked door they will try it regardless of if you just moved there yesterday.

  3. In my experience, setting the network interface to DYNAMIC does not supply a periodical change of the ip address. Once the machine has requested an ip address from the DHCP server, the submitted MAC address is used by the DHCP server to reasign always the initial released ip address.

  4. thanks man
    i followed the steps but i was not able to access the internet after that now its back on dhcp
    should add an entry for Gateway

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s