How to change your linux virtual  machines hostname and connect with ssh?

How to change your linux virtual  machines hostname and connect with ssh?

In this blog/video, I would like to demonstrate
the following by connecting hostnames with ssh:

Sometimes, we need to have hostnames differently.
When you use deployments using Ansible, etc. SCM tools
we can connect to the hostnames directly.
Now let us analyze and use the exercise as below:

By default we can find the hostname with;
$ ls -l /proc/sys/kernel/hostname
$ cat /proc/sys/kernel/hostname

We can also look into the details by using;
$hostnamectl

To change the new name use;
$hostnamectl set-hostname ‘ans-dbserver’
Step1: Checking the current  hostname.

Step2: Checking the host details in hostnamectl.

Step3: Changing the hostname.

Step4: Looking for new host details.

Step5: Reboot the machine and check its
connection with new hostname.

Step6: Now, let us try to connect to other machines
with ssh connectivity.

Step7: Making sure the renamed machine host is
being accessed by other machines also through ping.

Step8: Install openssh-server to connect through ssh in the newly named machine.

Step9: Connect through ssh from master machine to current hosts.

The attached video has the demonstration for all the above steps on Linux Virtual machines. Proved with a connectivity through ssh.

For SSH configuration please visit my blog, it has the demonstrated video also:

https://vskumar.blog/2018/05/26/27-devopsworking-with-ssh-for-ansible-usage/

 

https://tlk.io/a19e74

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s