Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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'm trying top open a port on my CentOS machine:

I edit the /etc/sysconfig/iptables file and add my rule:

-A INPUT -p TCP -m state --state NEW -m tcp --dport 143 -j ACCEPT

Then I restart the iptable service

# service iptables restart

But when I'm checking the open ports the one I declared doesn't appear

netstat -tulpn | less
share|improve this question
up vote 1 down vote accepted

Is there a service running on that port after you've opened it? The command netstat -tulpn | less will only show you the ports of daemons that are actually listening on TCP ports.


Nothing's initially running:

$ sudo netstat -tulpn | grep :80

Start up Apache:

$ sudo /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]

Check again:

$ sudo netstat -tulpn | grep :80
tcp        0      0 :::80                       :::*                        LISTEN      31260/httpd    

Now we see it. Stop the service:

$ sudo /etc/init.d/httpd stop
Stopping httpd:                                            [  OK  ]

Now it's gone again.

$ sudo netstat -tulpn | grep :80
share|improve this answer
Yeah I was persuaded that my tomcat server was listening to this port but it wasn't! The error came from here! Thanks. – darkheir Sep 25 '13 at 15:17

The iptables rule is just saying that any incoming TCP segment with destination port 143 will be accepted and not e.g. DROPped when default chain policy is set to DROP or REJECTed when the segment is not matched by any rule and the last rule in the chain is REJECT.

If you want to see this port as opened and in listening state there has to be some application running and listening on that port. Apparently, there is not such app running so try to configure it first and then start it. The TCP port 143 is in general allocated for IMAP services (aka Dovecot, Courier-imap and so on).

share|improve this answer

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.