How to change IP Address on Linux Redhat

Most of the time, I work in Windows environment. But I sometimes have to work on Linux platform, too. So I decide to note it down this topic to remind myself.

There are many ways to change IP Address on Linux. First one is the easiest way that configure on GUI because it’s like on Windows platform. The second way is configure on command-line but it is only temporary, it’ll reload to the old configuration when the network service is restart. And the last one is also configure on command-line to change IP Address permanently.

Section

  1. Configure on GUI (Permanently)
  2. Configure on commad-line (Temporary)
  3. Configure on commad-line by edit configuration file (Permanently)

Step-by-step to change IP Address on Linux RedHat

Configure on GUI (Permanently)

  1. Select Application -> System Settings ->Network.
    Open Network Configuration
  2. On Network Configuration and Devices tab, you’ll see available network card on the PC. In this example, the PC has 1 network interface card (NIC) and it’s currently inactive. Double click on the network interface card (NIC) that you want to configure to open its property.
    Select a network interface card to configure
  3. On Ethernet Device, you can configure the NIC to be either DHCP or static IP Address. When you finish, click OK.
    Change IP Address on Linux RedHat - Configure IP Address
  4. There is a pop-up message ask for activate the NIC. Click Yes to enable the NIC.
    Activate the NIC
  5. The NIC will be restarted to reload the new configurations and the NIC is active now.
    The NIC is actived

Back to top

Configure on commad-line (Temporary)

Note: This way change IP Address only temporary. When you restart network service, it’ll load from configuration file to replace this configuration.

  1. Open Terminal.
  2. Type
    ifconfig -a

    to list all network interface card on the current PC.
    List all NICs on the PC

  3. Type
    ifconfig eth0 192.168.125.10 netmask 255.255.255.0 up

    to configure IP Address on interface eth0.
    Change IP Address temporary

  4. Note: To configure gateway, type

    route add default gw [gateway address].

Back to top

Configure on commad-line by edit configuration file (Permanently)

  1. Open Terminal.
  2. Open network configuration file. In this example, it’ll configure on interface eth0. Type
    vi /etc/sysconfig/network-scripts/ifcfg-eth0

    Open NIC's configuration file

  3. The current configuration is DHCP.
    The NIC's configuration file
  4. Modify the file by press ‘i’ to enter insert mode. Change BOOTPROTO to static and add IP Address and Net mask as new lines if they’re not existed yet..

    BOOTPROTO=static
    IPADDR=192.168.125.10
    NETMASK=255.255.255.0

    Save the configuration file by press ESC + ‘:’ and type ‘wq’ to write and quit the editor.
    Edit the NIC's configuration file

  5. You can added these configuration to the config file. Replace [number] with your actual value.

    GATEWAY=[number]
    TYPE=Ethernet
    NETWORK=[number]
    BROADCAST=[number]

  6. Restart the network interface card. Type
    service network restart

    Restart network service

  7. Review the configuration. Type
    ifconfig

    . The IP Address has been changed permanently.
    List all NICs on the PC

Back to top

11 Responses to “How to change IP Address on Linux Redhat”

  1. IP

    Today it is easy updating IP Address when we are using GUI mode. Previous my favourite command was ifconfig down and ifconfig up.

  2. Dave P

    That was a excellent step by step instruction on how to change the IP.
    Most other sites get a bit too technical and spin off a load of jargon.
    I found this very easy to follow.
    Thanks

  3. MH

    Thank you saved me a lot of time in man pages.

    Thanks for being knowledgeable, concise, and comparative with the example and for helping others in an intelligent thoughtful manner.

  4. Lnx-NewBie

    Good info. One question though.. where do we put DNS entries (Primary and preferred)? usually in Windows and Linux GUI we can put those addresses right on same window?

  5. linglom

    To add DNS entries on Linux GUI, you can use comma to separate multiple DNS entries.

    To add DNS entries on Linux command-line, open network configuration file, for example, ifcfg-eth0, then add the following line:

    DNS1 = your-DNS-IP-ADDRESS
    DNS2 = your-DNS-IP-ADDRESS

    Save the file and restart network service.

Comments are now closed for this article. If you still have issue and would like to discuss, you can send me a message.