if you are interested to contribute your LAB PROGRAM Please send mail to jkumaron@gmail.com

Update Hosts File - Hostname - Network IP - Gateway Without Rebooting Server

Object: To change The Hostname into client system For Particular Range of the Hostname Using Shell script.
Study:Without Rebooting the Linux Server We can change the Host name using Linux host name command
#hostname serverhostname
Now we are doing these Throught the Shell script.
Scenario : Now we have 10 nodes with hostname like node1,node2.. node10.
1)So using ssh connectivy  'ssh node1' it will login.then
2)hostname serverhostname - change their host name without reboot server
Shell Scripting
ssh node$i 'hostname node'$i'.redhat.in';
we have to add Symbol ' ' the variable $i
becuase it is already Inside the Phare of ' '
Wrong Format
ssh node$i 'hostname node$i.redhat.in';
Coorect Format
ssh node$i 'hostname node'$i'.redhat.in';
How to change Linux server Hostname without Rebooting the Linux Server.

Update Hosts file Without Rebooting
If we are adding any new host to the /etc/hosts file.Then to update this hostfile use hostname -F filename
#hostname -F /etc/hosts
To update the hosts file /etc/hosts.
hostname -d - Display Domain Name
hostname -a - Alias
hostname -i - IP Address

Configure IP and Gateway without restarting Network (or) Server
1)ifconfig eth0 IP netmask
2)route add -host gw

Related post