How to make sure that all virtual machines are ready for ssh.
Hi,
I am creating a cloud service on azure with 2 virtual machines using java sdk API. Service created successfully with all input endpoints. After creation i got a public IP with two private IPs. I am able do SSH on public IP(head node) when its state says "ReadyRole". I got this state thru java API.

But when i do ssh from head node to my data node(2nd virtual machine) using private IP, it fails, even though state is "RedayRole" . I can see the status on Azure portal also where it comes as "Running".

It goes smoothly if i try the same thing after some times(2-5 minutes). I guess, initially vm is not fully ready(even though state is "ReadyRole").

How to make sure that all vms are fully ready? Is there any other state I can rely on? 

July 29th, 2015 8:52am

Hello Xsur,

Greetings!

Is it every time when you create the machine or is it a setup where you shutting down and starting these machines frequently?

if  SSH works with VIP then it should also work with DIP within Cloud Services and Vnet. I assume both the machines are in the same cloud service or Vnet.

what is the error you are getting?

Best Regards

Prasandhi Kumar

Free Windows Admin Tool Kit Click here and download it now
July 30th, 2015 5:25am

Hi Prashandhi,

Its happening every time when I create the service.  Both machines used to be in same cloud service only.
------------

error log

------------

ssh azureuser@100.77.160.127 -v
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 100.77.160.127 [100.77.160.127] port 22.
debug1: connect to address 100.77.160.127 port 22: Connection refused
ssh: connect to host 100.77.160.127 port 22: Connection refused

If I try the same thing after sometime it goes thru.

---------------

success log

----------------

ssh azureuser@100.77.160.127 -v
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 100.77.160.127 [100.77.160.127] port 22.
debug1: Connection established.
debug1: identity file /home/azureuser/.ssh/identity type -1
debug1: identity file /home/azureuser/.ssh/identity-cert type -1
debug1: identity file /home/azureuser/.ssh/id_rsa type 1
debug1: identity file /home/azureuser/.ssh/id_rsa-cert type -1
debug1: identity file /home/azureuser/.ssh/id_dsa type -1
debug1: identity file /home/azureuser/.ssh/id_dsa-cert type -1
debug1: identity file /home/azureuser/.ssh/id_ecdsa type -1
debug1: identity file /home/azureuser/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
The authenticity of host '100.77.160.127 (100.77.160.127)' can't be established.
RSA key fingerprint is a9:16:ac:aa:9f:fc:5a:2a:c9:ae:40:01:4b:b0:8a:8a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '100.77.160.127' (RSA) to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug1: Next authentication method: publickey
debug1: Trying private key: /home/azureuser/.ssh/identity
debug1: Offering public key: /home/azureuser/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env XMODIFIERS = @im=none
debug1: Sending env LANG = en_US.UTF-8

Last login: Tue Jul 21 11:25:08 2015 from 100.67.52.52

July 30th, 2015 8:00am

Hello Xsur,

Greetings!!

The behavior you are observing are expected even though the status shows Ready,Since some of the services including SSH still being initialized and it might take 2-5 minutes.

if you need to voice your feedback on this you can post your feedback at below site.

http://feedback.azure.com/forums/216843-virtual-machines

Best Regards
Prasandhi Kumar
________________________________________________________________________________________________________________
If a post answers your question, please click Mark As Answer on that post and Vote as Helpful.

Free Windows Admin Tool Kit Click here and download it now
July 30th, 2015 9:55am

Hi Prasandhi,

Thanks for confirmation. But this will create more trouble for me. The time(2-5 minutes) I have given is just an average time. 
So I can't rely on this. This assumption may fail sometime. Isn't any other way to make sure that machine is completely ready for SSH?

Thanks.
  • Edited by Xsur 1 hour 46 minutes ago
July 30th, 2015 11:18am

Hi Prasandhi,

Thanks for confirmation. But this will create more trouble for me. The time(2-5 minutes) I have given is just an average time. 
So I can't rely on this. This assumption may fail sometime. Isn't any other way to make sure that machine is completely ready for SSH?

Thanks.
  • Edited by Xsur Friday, July 31, 2015 5:32 AM
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2015 3:15pm

Hi Prasandhi,

Thanks for confirmation. But this will create more trouble for me. The time(2-5 minutes) I have given is just an average time. 
So I can't rely on this. This assumption may fail sometime. Isn't any other way to make sure that machine is completely ready for SSH?

Thanks.
  • Edited by Xsur Friday, July 31, 2015 5:32 AM
July 30th, 2015 3:15pm

Hi Prasandhi,

Thanks for confirmation. But this will create more trouble for me. The time(2-5 minutes) I have given is just an average time. 
So I can't rely on this. This assumption may fail sometime. Isn't any other way to make sure that machine is completely ready for SSH?

Thanks.
  • Edited by Xsur Friday, July 31, 2015 5:32 AM
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2015 3:15pm

Hi Prasandhi,

Thanks for confirmation. But this will create more trouble for me. The time(2-5 minutes) I have given is just an average time. 
So I can't rely on this. This assumption may fail sometime. Isn't any other way to make sure that machine is completely ready for SSH?

Thanks.
  • Edited by Xsur Friday, July 31, 2015 5:32 AM
July 30th, 2015 3:15pm

Hi,

 I am not sure if there is another way to check if the Service is Ready other than trying to connect.
 However I would suggest you contact Support with a Support Ticket and have an Azure support professional look into this issue and find out if there is any issue at the backend or a better way to find out if the service is ready.

Regards,
Nithin Rathnakar

Free Windows Admin Tool Kit Click here and download it now
August 3rd, 2015 4:11pm

Hi,

 I am not sure if there is another way to check if the Service is Ready other than trying to connect.
 However I would suggest you contact Support with a Support Ticket and have an Azure support professional look into this issue and find out if there is any issue at the backend or a better way to find out if the service is ready.

Regards,
Nithin Rathnakar

August 3rd, 2015 8:10pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics