Reputation: 903
I have created a VM in azure named hostmaster
having a private IP address and can be accessible by supermaster
(Another VM in azure within the same subnet). The hostname of the VM is master_machine
. I followed the steps from this link - https://blog.kloud.com.au/2017/06/09/the-quickest-way-to-create-new-vms-in-azure-from-existing-vm-snapshots-mostly-with-powershell/ to create a snapshot and recreate a new VM while the old one is existing.
The new VM is created successfully and it's name is hostmaster_copy
. However, the hostname is same i.e. master_machine
. This is having a different IP from a different subnet than the old VM. I tried to do ssh from supermachine
and gave ssh master_machine
and I am logged into the new VM but not the old one.
I am able to login to the old VM only through the IP from supermaster
. All the DNS settings are gone for the old one. Is there a way to restore or reset the DNS settings of the old VM?
Upvotes: 1
Views: 623
Reputation: 13954
All the DNS settings are gone for the old one. Is there a way to restore or reset the DNS settings of the old VM?
If you want to reset the private DNS, we can modify the /etc/hostname
and reboot this VM, after this server reboot completed, we can use the new hostname to access this VM in the same subnet.
Update:
As we know, snapshot will not generalize this VM, so when we use this to create new VM, the new VM's settings same as your original VM.
If you want to use this VM as an image to create more VMs, we should prepare(generalize) this VM, and use this VM to create a new image, after that we can use this new image to create VMs, in this way new VMs will get the new private DNS automatically.
About create Azure image, please refer to this link.
Update2:
In your scenario, here a workaround:
We can modify your VM hostname to master_machine1
and restart it. After it running, modify the hostname to master_machine
and restart it again, in this way, the private DNS will work correctly.
Snapshot only work for a signal disk, if your VM have os disk and a data disk, we should create snapshots for them.
After snapshots created, we can use snapshots to create new VM and new data disk, then attach data disk to new VM.
Also we can copy Snapshots to another storage account as a blob to keep backups of the base blob. You can also copy a snapshot over its base blob, which is like restoring the blob to an earlier version. When a snapshot is copied from one storage account to another, it occupies the same space as the base page blob. Therefore, copying whole snapshots from one storage account to another is slow and consumes much space in the target storage account.
More information about Azure snapshot, please refer to this link.
Upvotes: 2