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
for((i=1;i<=10;i++)); do
ssh node$i 'hostname node'$i'.redhat.in';
done
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 255.255.255.0
2)route add -host 0.0.0.0 gw 10.154.0.100
0 Comments