Can't connect to Google Compute Instance VNC Server - google-compute-engine

I followed this tutorial:
https://medium.com/google-cloud/linux-gui-on-the-google-cloud-platform-800719ab27c5
I opened all ports in the firewall.
vncserver
nc localhost 5901
RFB 003.008
Ran VNC Viewer (external-ip:5901)
Timed out waiting for a response from the computer

Related

Locked out of SSH terminal

I manated to lock myself out of SSH on an Canonical-Ubuntu-22.04 SSH always free server. do anyone know how i can get access back?
PS C:\Users\mikel> ssh -i ~/.ssh/ssh-key-2022-10-19.key ubuntu#129.xxx.200.16
ssh: connect to host 129.xxx.200.16 port 22: Connection refused
ssh: connect to host 129.xxx.200.16 port 22: Connection refused
means the remote host is sending the reject flags back, it can be due to
firewall blocking ssh port
iptables blocking port 22
security groups (Ingress, egress) blocking port 22
First check if you have allowed port 22 in console, if yes
then login to instance via console connection and then try to debug 1,2 points

can I connect to MySQL on a GCP CE VM instance from Windows MySQL Workbench?

As the title implies, I'm looking to connect from my windows laptop, to a GCP VM instance, in which mysql is running there. The database works fine, and if I go into an ssh client from their cloud connection, I can directly use mysql client and interrogate the DB.
I would like to use my local windows MySQL Workbench app, and be able to perform queries, just like I did in my localhost version I built before porting it up to GCP.
How to do this, (without subscribing to GCP Cloud SQL) and attach to my VM instance's sql?
///////////////////////////////////////////////
from John's comment, here's my net stat output:
netstat -tlnp | grep 3306
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 17007/mysqld
and the 3306 is indeed in the port list in mysql:
mysql> SHOW GLOBAL VARIABLES LIKE 'PORT';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.01 sec)
so my conclusion is that I need to open the port?
#john:
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1669/mysqld
NAME NETWORK DIRECTION PRIORITY ALLOW DENY DISABLED
mysqlaccess default INGRESS 1000 tcp:3306 False
Telnet test of the port from my laptop:
C:\Users\fumanchu>telnet x.x.x.x 3306
[ 5.7.33-0ubuntu0.16.04.1zzzzzzzz}<[:X'mysql_native_password
Connection to host lost.
attempt to use GUI from MySQL Workbench:
ADDED console GCP log showing my VPC entry is there:
mysqlaccess
Ingress
Apply to all
IP ranges: 0.0.0.0/0
tcp:3306
Allow
1000
Off — —
if you can connect via ssh.
change the connection method
There you can enter the same data as in your previous ssh connction
Per #JohnHanley here is a summary of my issues and steps:
Get a working setup of mysql workbench with a local pc database. This ensures you have the DB, and the connection to a local machine working correctly.
export the database to a remote system, in my case it was GCE linux VM (ubuntu I used) There are many easy steps to follow on exporting the db (mysqldump based)
ensure linux vm has mysql server and client setup, and import the db
now to setup the ssh connection:
ensure the port 3306 is open on the linux vm, by going to the VPC service for your vm/project, and insuring the port is open, or adding a rule to expose port 3306 ingress.
connect to the vm (you should have already done this before step 3), by using the GCE console and connecting to the instance. This also ensures you have the local files on the pc for ssh created. (~/.ssh/google_compute_*)
connect to the VM from your pc. use gcloud console tools to check the next step. if you haven't been using gcloud console tools yet, get them installed open a command / powershell window.
type "gcloud compute ssh "name of instance". if this connects, you now know you have the server properly configured for ssh, and accept external requests.
then setting up mysql workbench is same setup of gcloud ssh request...it can use the same credentials and script, which the helper files exist in the above /.ssh/ folder I referenced.

How can one unbind port 3306?

I am new to google cloud but was just able to deploy the test Django app that google provided in their documentation. This process included downloading the cloud_sql_proxy and running the following in the terminal (MacOS):
./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3306
This command starts running the proxy in order to connect locally to the DB in the cloud. Everything was working fine until I terminated the proxy with ctrl + C. When I ran the following command to start the proxy again I got the following error:
ludovico#Ludovicos-MacBook-Pro django % ./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3306
2020/04/18 23:38:10 Rlimits for file descriptors set to {&{8500 9223372036854775807}}
2020/04/18 23:38:12 listen tcp 127.0.0.1:3306: bind: address already in use
I got this error the first time I did this but I fixed it by shutting down the MySQL server that was running on port 3306. Now however, port 3306 is already bound to the cloud_sql_proxy and so it is throwing an error and is unable to start the proxy. If I run the same command with port 3307 it works just fine:
./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3307
But Django does not look for port 3307 it looks for port 3306.
Is it possible to unbind port 3306? Better yet, is there a command to start running the proxy instead of binding and unbinding port 3306 each time?
use
ss -lptn
the sport command to show which port is bind to which process.
Then kill the process running on 3306 by
kill -9 {process_id}
this will unbind your busy port 3306. Then you can run process on 3306.

Unable to connect to MySQL installed on another virtual machine or over network

I have several vms instances running in my vm player. Several of them are cent-OS acting as HTTP servers. The HTTP server is/are accessible over network. The HTTP server is on nginx.
Then I have a vm running on cent-OS having MySQL installed. And another vm instance running MS Server 2019 having MySQL Installed. Am using MySQL 8.0.18 on both these machines.
All these machines are on same sub-net and gateway. for example the IP of one of my vm having HTTP server is 192.168.0.133. And the machines with cent-OS having MySQL Server installed is having IP 192.168.0.140 and machine with MS Server 2019 having MySQL server is having IP 192.168.0.141.
Now the issue is am unable to access any of these MySQL servers from the network(LAN) or in other words am unable to access the MySQL server running on either .140 or .141 from the machine .133 meanwhile am able to access the HTTP server across the network.
But if I running MySQL server on the same machine having HTTP server. There occurs no problem whether I use 127.0.0.1 or localhost in my db host configuration
My application is based on a PHP framework known as laravel.
I have disabled firewall from both the above machines. The port 3306 is open on both machines. Am able to ping all machines with each other.
I had tried things like:
skip-networking(commenting out this one or just deleting),
bind-address(IP of the machine running MYSQL server),
grant privileges on an ip or from any IP to users/user,
flush privileges
Even modified iptables.
Am entering db host as the IP of the machine where MySQL is running.
The error am getting is SQLSTATE[HY000] [2002] Connection refused
You've nearly done it all right. Setting bind-address to the server's IP however means that you must connect via SSH.
Change the IP to 0.0.0.0 and restart MySQL, and hopefully that should be you all set.

How to Debug CUDA code on a remote server?

I want to debug the CUDA code on the remote server, My equipment is as follows:
Pc: Ubuntu 16.04,CUDA 8.0.61,nvcc v8.0.61,Geforce MX150 and integrated graphics
Server: Ubuntu 14.04,CUDA 8.0.61,nvcc v8.0.61,Tesla P100-PCIE*2
I have installed the Nsight Eclipse Edition 7.5 on my pc, What I want is to use the remote debug function that I can use the Visual debug window on my PC and remote gdbserver,But I have encountered some problems.
When I configure remote debugging to try to connect to a remote server,the Connection timed out return from the connection.
I don't know if it's related to the port. When I log in to the server, it looks like this:
SSH -P 50034 username#xxx.xxx.xxx.xxx
When setting up the connection, I noticed that port 2345 seems to be used, so I don't know if there is a conflict.The setting page is like this:
So far,I have tried the following:
Reinstall the Nsight Eclipse Edition,and debug sample code on the server in the command line which runs correctly.
Some forums mention that port 2345 should be opened,AFAIK,You can use this port as long as the port is not occupied when requested,but,I am not sure about it.
Considering that the server has certain restrictions on the visitor's IP address,so I tried to change the network several times but failed in the end.
Any ideas?
This problem was finally solved and I got a sigh of relief.
Since my server is in a cluster, ports are mapped. For example, the command when connecting to the server the port id should be attached with (i.e.ssh -p 50034 uesrname#xxx.xxx.xxx.xxx), so when the nsight eclipse edition's port 2345 (default) accesses the server, it does not recognize the port, then the time out delay is given, so I mapped the port 2345 to the server's port 2345, The map roughly as shown below:
-A PREROUTING -d xxx.xxx.xxx.xxx -p tcp -m tcp --dport 2345 -j DNAT --to-destination xxx.xxx.xxx.xxx:2345
The first xxx.xxx.xxx.xxx is the server's IP adress while the last one is the real adress of ur server in the cluster such as 11.11.11.24,which is Owing to the different conditions.