Thursday, July 07, 2011

How to change IP Address on Linux Redhat

Introduction:

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

Configure on GUI (Permanently)

1. Select Application -> System Settings -> Network.


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.


3. On Ethernet Device, you can configure the NIC to be either DHCP or static IP Address. When you finish, click OK.


4. There is a pop-up message ask for activate the NIC. Click Yes to enable the NIC.


5. The NIC will be restarted to reload the new configurations and the NIC is active now.



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.


3. Type ifconfig eth0 192.168.125.10 netmask 255.255.255.0 up to configure IP Address on interface eth0.


4. Note: To configure gateway, type route add default gw [gateway address].


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

[root@BKKLINUX01 ~]# vi /etc/sysconfig/network-scripts/ifconfig-eth0

3. The current configuration is DHCP.


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.


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.


7. Review the configuration. Type ifconfig.

The IP Address has been changed permanently.



Done ...

4 comments:

  1. Thanks for your information. I followed your steps then changed my ip address. After i have checked my ip address from this site Ip-details.com

    ReplyDelete
  2. Hello guys!

    I apologize for late response, I've been too busy with my other works and online business this past few years that's why I can't be able to update my site.

    Btw, Thank you all for the good comments. I hope everyone will stay and follow this site. ;)

    ReplyDelete
  3. The generated IP address will show the computer is connected from another country altogether. How to Hide your IP

    ReplyDelete