How to change hostname, IP Address in Linux CentOS/Redhat

Change hostname of your system:

Hostname is a label that is assigned to a device connected to a computer network and that is used to identify the device in various forms of electronic communication such as the World Wide Web, e-mail or Usenet.

Keyword hostname followed by name will set the hostname temporarily.


 The new host name can be checked with the command hostname.


 To survive the reboot, you need to make some changes in the /etc/sysconfig/network file.


As shown in the above screenshot, just change the HOSTNAME field as required.

Also if you have entries in the /etc/hosts file, make sure you make proper changes in the file.


Change your old hostname to the current one; like its localhost to host1.coolcoder.com in this case.


Now, restart the network service or reboot depending on whether its a client or server system.


Change the IP address of your system:

The IP address of any particular interface can be changed temporarily using the ifconfig command.


The above command will change the ip address for eth0 interface to 192.168.0.1

To change the IP address of any interface permanently, you need to make changes to the interface related file under /etc/sysconfig/network-scripts. For example, for interface eth0, the file will be ifcfg-eth0.

Modify the ifcfg-eth0 file and change the IPADDR field accordingly.


Also, if you have any entries in the /etc/hosts file, make sure you make the changes accordingly.



Now, restart the network service or reboot depending on whether its a client or server system.

Read more:

5 best email clients for open source environment
Track each and every process with PSACCT in linux


Related

open source 2191953193774998363

Post a Comment

emo-but-icon

Translate

 

Recent Posts

comments

Recent Comments Widget

Join Us

 

Sponsored By

Recommended for you

get social

item