1

Solution:

That hadn't nothing to do with iptables. It was an issue with my router blocking all ports. I just added a rule to allow incoming connections to VNC ports.


Question:

I'm getting literally crazy.

I'm on CentOS 6.6 and I just want to add a simple rule to iptables in order to open port 5901 (vnc server) and allow incoming connections.

Here's how I edited iptables file:

vi /etc/sysconfig/iptables
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT

Then I restarted both vncserver and iptables.

Here's the output of iptables -L

ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:vnc-800x600x16

Here is the output of iptables -v -n -L:

Chain INPUT (policy ACCEPT 4428 packets, 5769K bytes)
pkts bytes target prot opt in out source    destination 
0    0     ACCEPT tcp  --  *  *   0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5901 –

Now:

  1. If I try to connect with a vnc client (remotely, not within the LAN, where it works), I got a timeout connection error
  2. If I check for open ports with nmap, I got:

    port 5901 filtered

Services are running fine.

I also tried to disable SELINUX, without any lucky.

9
  • If it's working on the LAN but not working remotely, that suggests the problem is not with your local iptables firewall but is in fact with a network device such as a firewall in between the outside world and your system.
    – larsks
    Jul 24, 2013 at 15:46
  • @larsks strange fact is that a scan with nmap says me that port 5901 is filtered
    – simone
    Jul 24, 2013 at 15:47
  • 1
    Your policy is on ACCEPT already, so everything is open. This is not an iptables issue.
    – etagenklo
    Jul 24, 2013 at 15:47
  • 1
    You should check if there is a network firewall filtering traffic. If you are not responsible for the local network, check with someone who is. The output of iptables -v -n -L you posted indicates that no packets are ever arriving at your CentOS box.
    – larsks
    Jul 24, 2013 at 15:50
  • 1
    If you have solved your own problem, you should add your own answer, and mark it as accepted. Please don't mess around with the question titles. That is not how this site works.
    – Zoredache
    Jul 24, 2013 at 19:13

1 Answer 1

-1

Try connecting without iptables running at all. Just to check this is really a iptables problem.

The other thing that comes to mind is that there could be some problem with handling RELATED packets (which seems weird since INPUT policy is ACCEPT).

Also this could happen if your server cannot talk back to the client, so check OUTPUT chain and your routing as well.

1
  • As clarified by @larsks that's not seem to be an iptables problem at all. Going to check if there's some sort of other firewall on local network blocking unknown ports.
    – simone
    Jul 24, 2013 at 15:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .