DNS problem when creating VM from deprovisioned Linux VM image in DevTest Lab - azure

I tried many times. It looks like a bug in Azure DevTest Labs.
Here is the steps to reproduce the problem:
Create a VM from Ubuntu Linux 18.04 LTS
Create custom image from this VM with Run deprovision on virtual machine..
Create a new VM from this new image.
SSH to this VM.
Run host www.google.com will fail.
Are these steps wrong?

There is no step wrong which you have done. But the reason that you fail running host www.google.com is the second step. The deprovision will do some things when you execute the command waagent -deprovision+user:
When you create a VM from the deprovision custom image, there is no resolv.conf file in it. So you fail in running host www.google.com. The solution is that create a resolv.conf file in the directory /etc/.
The content of file resolv.conf will be different for the VM in the different locations. For example, the file resolv.conf will be like this if your VM in the location Japan East:
nameserver 127.0.0.53
search bbuuanmggeiengfg01a443drie.lx.internal.cloudapp.net

Related

Proxmox Cloud-init is not letting the SSH restart when the IP is changed after cloning the template

I am facing the problem in proxmox cloud-init config file.
I am installing a CentOS8 Stream and installing the cloud-init in it.
I have converted it to a template, later when I am cloning that template into a VM, and assigning, the IP in the cloud-init after the IP is assigned the SSH is not accessible and it is not started, when I am trying to restart the SSH it is not restarting and getting the following error as in the image below.
This is the error log I am getting.

Can't connect to "Jenkins-On-Azure"

I created a Jenkins linux vm on Azure on a new resource group.
I followed the steps described here:
Create a Jenkins server on an Azure Linux VM from the Azure portal.
So I ran the command ssh -L 127.0.0.1:8080:localhost:8080 jenkinsadmin#jenkins2517454.eastus.cloudapp.azure.com
(changed the username and dns name to my own) on my linux vm and it seems fine (no errors).
Now whenever I try to connect from my own computer (not on azure) on port 8080 I get on the linux vm the following message: channel 2: open failed: administratively prohibited: open failed and It doesn't let me log in into Jenkins.
How can it be solved?
Thank you
This is not a NSG issue. You don't need add port 8080 on Azure NSG rules.
If you want to connect from your computer with http://localhost:8080/, you should need create a SSH tunnel on your local computer. You could do it with putty.
Configure the Tunnel
Also, you could install Linux on Windows. Please refer to the following steps:
1.Install Linux on Windows.
2.Open Power shell on execute bash
3.Execute sudo -i and ssh -L 127.0.0.1:8080:localhost:8080 jenkinsadmin#jenkins2517454.eastus.cloudapp.azure.com
Now, I could access http://localhost:8080/ on my local computer.(The default user name is admin).
In order to access from external network, you need to "add inbound port rule" as follows:
For more details, refer "Create Jenkins server on an Azure Linux VM from the Azure Portal".

How to reconnect to docker instance

I'll start from the beginning.
I've created an Ubuntu machine with docker installed on Azure.
On the top I created two docker containers, I used to connect from an old computer using docker-machine for management tasks.
I've changed my computer, so I need to connect from the new one.
I've added my azure subscription
However when I try the docker-machine cdmdlet to the existing container I have the following error message:
PS C:\WINDOWS\system32> docker-machine ssh vm name
Host does not exist: "vm name".
The machine is running but I'll guess I'll have to recreate the certificates used for the connection.
I've tried the following with no luck:
PS C:\WINDOWS\system32> docker-machine regenerate-certs vm name
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Host does not exist: "vm name"
I no longer have access to the old machine.
Has anyone been into the same situation?
Any thoughts are welcome.
You'll have to recreate the machine using the generic driver:
docker-machine create \
--driver generic \
--generic-ip-address=203.0.113.81 \
--generic-ssh-key ~/.ssh/id_rsa \
vm
Replace the information accordingly.
Note that this does NOT remove any data on the target instance, rather it just configures docker to talk to machine if it isn't already, and also generates new certificates so it can communicate with the instance.

Could not connect to VM created with Azure command line tools

I am trying to use the Azure Command Line Tools (http://www.windowsazure.com/en-us/manage/linux/how-to-guides/command-line-tools/) to create an Ubuntu 12.04 VM.
I am issuing the following commands:
azure vm create xxxxxxxxxx.cloudapp.net b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_1-LTS-amd64-server-20121218-en-us-30GB azureuser mypassword --location "West Europe"
azure vm endpoint create xxxxxxxxxx 22 22
azure vm start xxxxxxxxxx
This seems to create and start the VM successfully.
I try to connect via SSH to the VM using the following command (on Mac OS X)
ssh azureuser#xxxxxxxxxx.cloudapp.net
However, when I try to SSH into the VM, it seems that password authentication is disabled on the VM as I am getting the following error:
Permission denied (publickey).
I would like to add that connecting via SSH to an Ubuntu VM created trough the Azure Management portal works absolutely fine. This issue only appears when the VM was created through the Azure command line tools.
Has anybody encountered a similar issue and knows how to solve it?
You need to use the --ssh switch on your azure vm create command to enable ssh. Adding the endpoint has no effect.
According to the Windows Azure command-line tool for Mac and Linux documentation you can only add ssh connectivity via the azure cli when the virtual machine is created.

Couldn't resolve host 'bucket.s3.amazonaws.com' on virtual machine

Serving static pdfs from S3. Have a production environment on AWS and a development environment on my local Vagrant Virtual Machine. Everything was working fine until today.
When I try to access S3 files from my Vagrant development environment, I get
Couldn't resolve host 'bucket.s3.amazonaws.com'
I can still access the files as normal in my AWS production environment. The code to access is the exact same.
Other notes that may or may not be relevant
The VM was reset this morning. It has not worked since.
I've tried to flush the DNS -> ipconfig /flushdns
I've cleared the browser cache
Thanks for any help.
What do you mean by "the VM was reset" ? I've run into problems when I forget to put the VM into suspend and then change networks on the host machine. I won't be able to resolve anything after that. To fix I just did a vagrant suspend && vagrant up to have it refresh its network.
I faced a similar issue when tried to fetch S3 files using vagrant on openstack, solved it by configuring DNS on my openstack subnet.
(meaning the DNS issue wasn't related to the vagrant vm configuration, it was related to the openstack configuration, you can verify it by running: cat /etc/resolv.conf from your vagrant vm)

Resources