简体   繁体   中英

Cannot connect to google compute engine virtual machine by vnc

I have created a debian wheezy virtual machine in google compute engine but I am unable to connect to it with vnc. Here is what I have done

  1. Installed gnome and the rebooted the VM
  2. install tightvncserver and started it

I have tried to connect using the static ip that I've attached to the VM but I'm getting the error: "the connection was refused by the host computer". I thought it was the firewall that was the issue so I disabled iptable using the following commands

$ sudo iptables-save > /root/firewall.rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

and I have created rules in google firewall to allow ports 0-65535 for tcp and udp but it still does not work. Anyone knows how to do it? Thanks in advance

VNC uses by default port 5901. In the 'VNC server' field, specify the ip address and the port 5901. Example: VNC ***Server: 123.123.123.123:5901 Encryption: let VNC Server choose***

Be aware that the free edition of VNC doesn't support encryption, it only encrypts your user name and password. One thing also to configure is /etc/sysconfig/vncservers file where you have to specify the user and the port that VNC server should listen to, and make sure it's not commented Example: VNCSERVERS="1:USERNAME"

VNCSERVERAR0GS[1]="-geometry 800x600 -listen tcp -5901"

By default, all incoming traffic from outside a network is blocked and no packet is allowed into an instance without an appropriate firewall rule. To allow incoming network traffic, you need to set up firewall rules to permit these connections:

  • start the VNC service
  • look at VNC server settings or netstat -nap to find out the listening port of vnc server
  • under Google Developer console -> Compute Engine -> Networks -> default -> Firewall rules create a new rule and open appropriate ports for incoming vnc connections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM