VNCServer Problems

If you are having problems accessing a machine which has vncserver running, then you should check if the firewall is blocking the port.

Normally you will get the following error if the remote host is reachable but the port to vncserver is blocked.

Exception connecting to hostname: Connection refused

You can try the following steps to open the port for Vncserver.

Step 1:
There are several ways to open up port for vncserver. One way is to edit the iptables.

$su
$cd /etc/sysconfig
$vi iptables

Step 2:

Insert the following line

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901:5909 -j ACCEPT

right before the second last line

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

Step 3:
The next step would be to restart iptables.

# /sbin/service iptables restart

Now the machine (host) with the vncserver should be accessible from remote computers which has vncviewer installed.

To start vncserver:

vncserver -geometry 1024x768

Leave a Reply