Apr 302008

Adding the IP Address in Redhat Enterprise Linux can be done by using the netconfig tool or by editing the network-scripts or by using the ifconfig command. While this procedure is tested on Redhat Enterprise Linux, I'm sure it should work on CentOS, Fedora and older Redhat versions.

Set IP Address using Netconfig

Netconfig is a utility in Redhat Enterprise Linux which allows you to add/modify the IP Address the system, the Netmask, default gateways and the Name Servers.

Launch Netconfig,

rhel5# /usr/bin/netconfig

This launches a window as follows:

Redhat Linux Netconfig

For static IP uncheck the "Use Dynamic IP configuration(BOOTP/DHCP)"

Now, enter the IP Address, netmask, Default Gateway & Primary Name Server.

Once done, restart the networking service

rhel5# service network restart

or to just reread the interface config files

rhel5# service network reload

This should set the IP Address.

Manually edit Interface configuration files

You can also manually edit the interface configuration files and add/modify the IP Address.

The Network interface configuration files are found in the directory


Let's say there are 2 interfaces eth0 & eth1. The files to edit will be

ifcfg-eth0 – For interface eth0

ifcfg-eth1 – For interface eth1

To add the IP Address for interface eth0, edit ifcfg-eth0

rhel5# cd /etc/sysconfig/network-scripts

rhel5# vi ifcfg-eth0

Enter the following Parameters



DEVICE indicates the interface
BOOTPROTO indicates if it is static IP or uses DHCP/BOOTP

The above sets the IP Address, Broadcast address, Network, Netmask etc.

Once done, save the file and restart the network service for the changes to take effect.

rhel5# service network restart

or to just reread the interface config files

rhel5# service network reload

Using ifconfig

This is dynamic and the change take effect instantly.

rhel5# ifconfig eth0 netmask gw up

This sets the IP Address, Netmask and the default gateway on the interface. For information on how to add Static Routes in Redhat Enterprise Linux, click here

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

  6 Responses to “How to add/modify IP Address in Redhat Enterprise Linux”

  1. Thank you very much!, it really helps me a lot as a beginner in RedHat Linux user.

  2. Proper explonation.Its really useful

  3. i have installed fedora7 OS in my laptop, but default it does not have netconfig command, i tried in superuser mode also, can you please tell me where can i download open source of netconfig command in linux

    Thanks & Regards,
    Laxman Masadi.

  4. This helps me a lot as a beginner of using Red Hat Linux..

  5. Thanks so much! The router arbitrarily re-assigned the IP address and all of the devices accessing the linux server barfed. This allowed me to set it as a static IP and the devices started working again. Life is good.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>