ssh: connect to host on port 22: Connection refused - azure

I have looked around for answers but didn't not able to find solution related to my query.
I was able to ssh the server earlier but after a reboot I was not able to. I checked Azure portal for the instance it was showing status as Running. I tried rebooting it a couple of times but I was not able to ssh. I checked further and found out that the public IP shown was different this time. I tried with that IP but still not able to login.
Any suggestion what I should I do next. Also, how can I make the IP static in Azure.

Please start from the official SSH connection troubleshooting guide - most of the SSH issues i had (and yours situation is the same i had a few times) were solved by reset-ssh way. Helpful would be to see the serial console output (VM dashboard => Settings).
The fact that your IP changed is normal if you did not reserve that, it will change.

Related

Can't connect remotely to Jenkins being run on a Debian 8 VM

I've recently set up a Debian 8 Jessie VM on Google Cloud. I've installed Jenkins and have the service up and running(verified by "sudo service jenkins status"), yet I can't connect to the VM's external IP from another machine. I used to run Jenkins from my personal computer until I decided I needed a dedicated server to run it continuously. When I was running it on my personal machine I would just access localhost:8080 and the Jenkins dashboard would load fairly quickly. However, upon trying to access the external IP address of the VM running Jenkins, I'm usually greeted with "Connection refused" in my web browser.
At the suggestion of most posts I've seen regarding such issues, I've lifted all firewalls on the VM and have tried to ensure that the VM is listening at the correct IP address, but nothing seems to be able to change the outcome presented by my browser. Where does the issue most likely reside: the VM, Google Cloud, or Jenkins? I'm at a loss.
My first guess is a connection/firewall issue. To test this, you could try a port forward using SSH: SSH into your server with a local port forward: ssh -L 8080:localhost:8080 yourserver. You should then be able to direct your web browser at http://localhost:8080/ and your packets flow through the SSH connection. If that makes it work, have a good look at
How to open a specific port such as 9090 in Google Compute Engine . Or better yet, if you are the only one to use that Jenkins server, just keep using the SSH tunnel. It's much more secure than opening jenkins to the public world.
Have you tried installing tcpdump on the VM and doing a packet capture? That way you can determine where the traffic is being dropped. If you don't see any traffic, then it is being dropped somewhere in the cloud before it gets to your VM. If you are seeing traffic, then you need to determine is it Jenkins or some agent on the host (perhaps a firewall but you mentioned you cleared all the rules) ... I would suggest stopping the Jenkins service and then trying to access it again. Do you get the same "Connection Refused" message? If so, then it is something on the VM. If not, then it something at the application layer, i.e. Jenkins.
Happy hunting!!!

IP address set to static, cannot get connection to server

I set my server with static IP address from the Network and Sharing Center. My server is an Azure VM. After setting it with static IP, i lost connection to my Machine. I check from the portal.azure.com, the server status is running but i realize that the network out dropped to 0MB.
I can't remote desktop to the server, I tried restart the server from Azure, but it doesn't come back alive (At this point i mean i can't remote desktop to it).
What can i do next? Is that's all? I just screw up my server?
Please help! I believe there's some miracle to let it get back to life.
This link describes the correct way to set internal private static IP addresses to azure VMs (using Powershell). You can try the step "How to remove a static internal IP from a VM" but I'm not sure if it will undo the change you've made within the OS - did you try shutting down the VM completely and restarting it?
ps- this question probably suits Server Fault rather than Stack Overflow.
Sorry for late reply. Didn't notice this question until now.
Actually, the server is no longer accessible after setting the IP address. Later then I found out you shouldn't set a static IP for an Azure VM. It should be assigned by DHCP.
So.. lesson learn i guess.. :I

Windows Server 2012 with IIS can't connect to it's own public IP

I encountered a very strange issue I've seen more often but could workaround. A VPS with Windows Server 2012 on it and IIS installed is unable to access its own webpages by its public IP.
When I open up Internet Explorer on the VPS and goto localhost, I see the default IIS page. Whenever I try the public IP, it times out.
If I access the same IP from another PC, I can also see the IIS page.
I've tried pinging to my public IP from the VPS, this works. I then tried to disable my firewall all to no avail.
Has someone encountered this before? And more importantly: Did you manage to fix it and if so, how?
Most likely then this is a NAT issue caused by how the NAT gateway/router is configured your connections go via. I'd recommend talking to your host and confirming whether this is the reason and if they are willing to do anything to resolve it. That might be difficult if it is a limitation of the router or done for security reasons that they are unwilling to change.
Running some Wireshark traces should be able to confirm what is happening.
You may be able to resolve it your self with Split DNS and the use of a domain name rather than direct to an IP address. Why do you need to use the IP specifically?
Read serverfault.com/questions/216569/cant-ping-static-ip-from-internal-network-only-from-outside for some further insight.

Linux commands are hanging on ec2 instance

We are having a VPC setup for our staging environment. In this we have attached an elastic ip to one instance & rest of the instances are connected through this.
Now today when we restarted our machines we are facing trouble running commands like top, vi, ps etc.
Also we have noticed that if we connect to secondary machines via their public ip then everything is working fine. However if we connect via primary machine then the screen hangs after the command is issued.
Having a hard time debugging the root cause. Any suggestions will be quite helpful.
Sorry for inconvenience. The problem was with our office network. It started automatically after sometime.

Windows Azure VM RDP issue

I followed this
http://blogs.technet.com/b/keithmayer/archive/2013/04/17/step-by-step-build-a-free-sharepoint-2013-lab-in-the-cloud-with-windows-azure-31-days-of-servers-in-the-cloud-part-7-of-31.aspx#.UX_iF7XvvQI
I created a VM using the datacentre Image it created successfully and the status shows Its running. I am trying to RDP It says
Remote Desktop cant connect to the remote computer for one of these reasons:
1) Remote access to the server is not enabled
2) The remote computer is turned off
3) The remote computer is not available on the network
make sure the remote computer is turned on and conencted to the network and that remote access is enabled.
I did check the endpoints the public port is open and also 3389 private port is open too. I did try with different release one with latest patch and the other with the second latest OS patch but I am still not able to RDP.
Thanks
Yeah I already figured out firewall in my organization is blocking it. I did update the answer but it did not show up I am trying again :)
Make sure your VM has reached the "Running" status. If it's still in one of its pre-running statuses (such as Provisioning), you won't be able to RDP.
Also: Be sure you don't try logging in with 'Administrator' (the default in the rdp login box). Choose localhost\yourusername.
I had a similar problem the other day. It was solved by going to the Azure Portal, selecting the VM Dashboard, then clicking "Connect" in the grey toolbar at the bottom. This will download an RDP file that contains the correct connection settings. You can then send that rdp file to others who you would like to give access to.
I just opened one of the files used to connect, and it looks like the only real difference is the port used.
full address:s:[vm name].cloudapp.net:62808
username:s:Administrator
prompt for credentials:i:1
I am not sure if all Azure VM's use 62808, but the default RDP port is 3389 so just copying the DNS from the Dashboard into the RDP address will NOT work without adding the correct port.
One more thing folks should check when having trouble connecting is password length.
I thought I would be all secure by using a guid for a password. RDP worked fine from home (on older XP RDP client), but not from office. At first I thought it was a firewall issue. After verifying with the IT guys that I had full outbound access, I looked a little closer at the RDP error message.
It was saying my credentials were rejected. Finally, I created a second account on the VM and gave it RDP access. I was able to log in fine. The only difference between the two users was this time I didn't bother with a long password.
So I shortened the password on my main account and got in with no problem. I'm not sure what the limit is, but it seems to be less than 32.

Resources