google cloud vm ssh network error: connection timed out - google-cloud-platform

I'm trying to ssh into a GCP Linux VM from my local Windows 10 machine using google cloud SDK.
I have two wifi networks at home. When I run the command gcloud compute ssh VM_name, I can connect to the VM through only one of the networks. On the other network, I receive the following error from puTTy:
puTTy FATAL ERROR: Network error. Connection timed out.
Both networks are from the same internet service provider. Why is it not connecting through one of them? Which settings should I look into?

Related

"It was not possible to connect to the redis server" Bitnami hosted on Google Cloud

Problem:
When I try to connect from my local machine to a Redis VM hosted on Google Cloud, the connection is refused.
QUESTION: How can I connect to Redis installed on a private VM in GCP after successfully connecting to the VPC via a VPN?
Setup:
VM hosted in Google Cloud without public IP
Redis installed on VM by deploying the VM using the Bitnami package from GCP Marketplace
Firewall rule added to GCP targeting my VM, allowing TCP ingress traffic on port 6379 for all IP ranges
VPN setup using OpenVPN to tunnel into GCP VPC from local machine (Windows)
What I know:
Redis is running... if I SSH into my VM and run redis-cli, everything works as expected
VPN is working... from my local machine, I can successfully ping my VM when connected to the VPN
Redis config comments out the binding to 127.0.0.0 to (theoretically) open it up to all bindings, after which I restarted Redis on my VM (I think)
The password I'm using is correct
What doesn't work:
StackExchange.Redis:
var redis = ConnectionMultiplexer.Connect("my.ip.to.vm", config =>
{
config.Password = "my-redis-password";
});
Command Line from Local Machine (using redis-cli npm package):
rdcli -h my.ip.to.vm -a my-redis-password
Recap
What am I missing?
How can I connect to Redis installed on a private VM in GCP after successfully connecting to the VPC via a VPN?
Solution (this is embarrassing):
Stop VM
Start VM

Execute command in GCP VM instance ssh

I am running java code in GCP VM instance. I want to execute
java main.java
in VM instance externally without manually ssh into VM. I tried with this code here
, I have setup firewall to allow tcp port 22, but i am getting
ssh: connect to host xxx.xxx.xxx.xx port 22: Connection timed out
is there any other way to handle this or to resolve cloud function error ?
Thanks in advance.

Unable to login to a GCP VM machine: kex_exchange_identification: Connection closed by remote host

I am trying to login to a VM machine but unable to get in there as the below error pops up:
ERROR: (gcloud.beta.compute.start-iap-tunnel) Error while connecting [[Errno 1] Operation not permitted].
kex_exchange_identification: Connection closed by remote host
ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].
Command used to log in:
gcloud beta compute ssh --zone "us-east1-b" "user1#test" --project "my-test-project"
When I use the same command from a different machine then it allows me to login to the test VM.
I have been looking at possible solutions related to the firewall settings but unable to get success. Can anyone help here ?
I try to connect with an instance with the command that you post and worked for me when I use it from the cloud shell and from another instances. The error that is given to you could happen for different reason, which are:
The VM is booting up and sshd is not running yet. You can't connect to a VM before it is running.
To resolve this issue, wait until the VM has finished booting and try to connect again.
The firewall rule allowing SSH is missing or misconfigured. By default, Compute Engine VMs allow SSH access on port 22. If the default-allow-ssh rule is missing or misconfigured, you won't be able to connect to VMs.
To resolve this issue, Check your firewall rules and re-add or reconfigure default-allow-ssh.
sshd is running on a custom port. If you configured sshd to run on a port other than port 22, you won't be able to connect to your VM. To resolve this issue, create a custom firewall rule allowing tcp traffic on the port that your sshd is running on using the following command:
gcloud compute firewall-rules create FIREWALL_NAME --allow tcp:PORT_NUMBER
Your custom SSH firewall rule doesn't allow traffic from Google services. SSH connections from the Cloud Console are refused if custom firewall rules do not allow connections from Google's IP address range.
To solve this issue visit this link
The sshd daemon isn't running or isn't configured properly. The sshd daemon enables SSH connections. If it's misconfigured or not running, you can't connect to your VM. To resolve this issue, review the user guide for your operating system to ensure that your sshd_config is set up correctly.

Creating Notebook Failed - An error ocurred while creating a new notebook GOOGLE CLOUD DATALAB

In GCP. According to this Article, https://mohameddhaoui.github.io/dataengineering/chatbot3/
I created a new google cloud datalab instance, and run it on port 8081. When I go to Google Cloud Datalab and click on add note, the following error is presented.
Datalab Error PrintScreen
I am the owner of the account and have full access to the resources.
This is the command I used to deploy the datalab instance:
datalab create datalab-instance
The result of the execution is as follows.
This will create an SSH tunnel and may prompt you to create an rsa key pair. To manage these keys, see https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys
Waiting for Datalab to be reachable at http://localhost:8081/
ssh: connect to host 35.229.109.170 port 22: Connection refused
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
Connection closed
Attempting to reconnect...
Waiting for Datalab to be reachable at http://localhost:8081/
Enter passphrase for key '/home/myuserXXX/.ssh/google_compute_engine':
The connection to Datalab is now open and will remain until this command is killed.
Click on the Web Preview (square button at top-right), select Change port > Port 8081, and start using Datalab.
Your help will be very appreciated.
Best Regards

Cannot Start mlflow ui on google cloud platform virtual machine instance

after running mlflow ui on command line
and clicking http://127.0.0.1:5000/
i get site cannot be reached
127.0.0.1 refused to connect.
I have already updated firewall rules on VPC network in GCP and on my local machine and activated the ports
This site can’t be reached127.0.0.1 refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
You can connect to your MlFlow UI by using the IP address of your Google Cloud VM instead of 127.0.0.1, which is equal to localhost, meaning it is only available inside the Google Cloud VM.