Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed VNC server on CentOS 5.8 and it is running, but I cannot connect to it using VNC viewer. I get the following error message:

connect: Connection timed out(10060)

What could be the problem?

share|improve this question
There could be many problems. Do you have network connection at all? Can you ping the CentOS? Do you have a firewall? Does the VNC service up and running? You can try do some more extesive checks using NMap - – EliadTech Nov 13 '12 at 12:46
I can connect to my server using putty. I checked vnsserver status using "service vncserver status" command and it is running. – Beginner Nov 13 '12 at 12:49
So, you should check out the firewall (if there's any), and test the VNC port with NMap. – EliadTech Nov 13 '12 at 13:06
Thanks. I disabled ip tables. It's now working. But I should learn how to add exception to firewall. – Beginner Nov 13 '12 at 13:14

Here how to add a firewall exception (you'll need to open ports 5900 and 5800). Linux is not my strong side, so I hope this picture helps... CentOS firewall

share|improve this answer

You will need to do:

vi /etc/sysconfig/iptables

Then, you will find a file as follows:

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
# <add the line for eth>
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
# <add the line for ports>
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited

With your correct eth in ifconfig, add the following lines to your iptables:

-A INPUT -i eth1 -j ACCEPT 
-A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 5801:5803,5901:5903,6001:6003 -j ACCEPT

After the file is saved:

sudo service iptables restart
sudo service vncserver restart

You can have more information at: However, you will see that they do not state: 5801:5803, which I have to add in order to get the VNCViewer working.


share|improve this answer

Just answering it now to make sure that someone else who view this page finds the solution. I was also having this problem on CentOS 6.4 64 bit machine. Resolved this by using the link

share|improve this answer
Hello and welcome to Your answer is refering to another site. Common practice is to describe the solution itself in the answer and refer to the solution in case the site refered to dissappears for some reason. Do this and I will remove my -1. – Mogget Oct 26 '13 at 9:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.