Friday, October 03, 2008

VNC, firewalls and iptables

VNC requires port 5900+display_number to be open through the firewall.
For eg: for vnc display on :1, you need port 5901 open.

vnc displays are found to be at server.example.com:PortNumber

Or look in your .vnc folder for an entry that states example.com:X.pid
(where X denotes the display number)

[The following requires root (or sudo) privileges]
---
1. Add rule to firewall by adding the following rule into your iptables
script:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport
5900:5906 -j ACCEPT

[This opens ports 5900-5906 through the firewall for the tcp protocol]

2 .Then restart the iptables daemon using the command :

service iptables restart

Now you should be good to go. Connect into vnc using vncviewer or a
program such as RealVNC or TightVNC
---
For fedora 9,
iptables is a textfile at /etc/sysconfig/iptables
service is an shell script at /sbin/service

Ubuntu 7 (Gutsy Gibbon)
- implements iptables as an executable. ( located at /sbin/iptables )
Run the command, by prefixing 'sudo iptables' in front of the -A
command, and remove the string RF-Firewall-1-INPUT and replace it with
the string INPUT
eg: sudo iptables -A -INPUT blah blah blah

The Ubuntu community has a set of nice guides which should be helpful.

The main HOWTO: https://help.ubuntu.com/community/IptablesHowTo
Ubuntu Forum guides :
BASIC :http://ubuntuforums.org/showthread.php?t=159661
ADVANCED_USERS : http://ubuntuforums.org/showthread.php?t=668148

No comments: