Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cant VNC into Google Compute Engine

I have spent a couple days trying to install software on Google Compute Engine (GCE) and then remotely access it from either my windows pc or local linux machine.

I can install software, like Google Chrome, etc. but can't open the applications as I keep getting display issues (understandably because GCE is headless). So I'm trying to VNC into the GCE instance.

I have tried installing the following on the server: (Instance Name is "talend")

vnc4server: I get output saying the server is running and everything looks good. Only error I get is a Language error like the following:

steven@talend:~$ vnc4server -geometry 1440x900 :1 perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:LANGUAGE = (unset),LC_ALL = (unset),LANG = "en_ZA.UTF-8"are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). A VNC server is already running as :1

and

steven@talend:~$ vnc4server -geometry 1440x900 :2 perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:LANGUAGE = (unset),LC_ALL = (unset),LANG = "en_ZA.UTF-8"are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). New 'talend:2 (steven)' desktop is talend:2 Starting applications specified in /home/steven/.vnc/xstartup Log file is /home/steven/.vnc/talend:2.log

Remote Access: Using TightVNC client via Windows

I get the following message:

No connection could be made because the target machine actively refused it.

Remote Access: Using Vinagre via Linux

Connection to host 8.34.210.67::5902 was closed.

Via Google Compute Engine Web Console:

Tried changing to static ip > No Difference

Tried adding tcp:80 with Source: 0.0.0.0/0 > No Difference

I'm sure there is a simple solution to this but I can't seem to find it. Any help will be appreciated and then will post a link to the final solution.

Thanks.

like image 429
steven.levey Avatar asked Dec 17 '13 17:12

steven.levey


People also ask

How do I ssh into my GCE without a public IP?

To connect to an instance without an external IP address, use the gcloud compute ssh command with the --internal-ip flag. In the Google Cloud console, go to the VM Instances page and find the internal IP address for the instance that you want to connect to. Connect to the instance.

How do I access GCP VM from terminal?

Select Metadata under Settings. Once the page opens click on EDIT and then select ADD ITEM and enter the value. Then click on SAVE. Now go to your Local machine and in terminal use the ssh command along with your private SSH key file, the username, and the external IP address of the instance to connect.

How do I enable ssh in GCP instance?

Connect through a browser from the GCP MarketplaceBrowse to the Google Cloud Platform console and sign in if required using your Google account. Find and select your project in the project list. Select the “Compute -> Compute Engine” menu item. Locate your server instance and select the SSH button.


1 Answers

You will need to configure three settings to all agree on the same port:

  • The port vnc4server is listening on.
  • A Compute Engine firewall rule to allow traffic on that port.
  • The port TightVNC is attempting to connect to.

From the error message "Connection to host 8.34.210.67::5902 was closed.", it looks like TightVNC is trying to connect to 5902. Assuming that vnc4server is also listening on that port, you should add a Compute Engine firewall rule to allow that port.

Visit the Console at https://cloud.google.com/console, click on your project, then Compute Engine, then Networks. Click the "Create new" next to "Firewalls" and add a new rule with tcp:5902 set in the Ports/Protocols field.

If you're running on Centos, there is an additional step to disable the local firewall as well: CentOS Firewall Issues on GCE

like image 144
Brian Dorsey Avatar answered Sep 20 '22 06:09

Brian Dorsey