I installed an application (a text editor) and it keeps a connection alive. I blocked the IP with iptables, but the port stays open.

netstat shows:

tcp 0 0<port>* LISTEN 2538/<application>

  1. why they maintain a port/IP open in my PC?
  2. I guess maybe there's something related with updates, but is it risky?
  3. how can I close the port?
  • Try kill -9 2538 – neuron Aug 4 '15 at 10:30
  • But that will kill the process. I still want to use the application. – Yeke Aug 4 '15 at 10:38
  • Can you paste iptables rules that you have used? – neuron Aug 4 '15 at 10:48
  • I dropped the suspicious IP iptables -A INPUT -s <IP> -j DROP – Yeke Aug 4 '15 at 11:04
  • 1
    Having a brief look at the source code (github.com/rhiokim/haroopad), it has an "app" and a "viewer", which communicate via this port. I would assume to allow asynchronous operation on the "viewer" frontend. If you want to dig deeper, the code base is there to view at the author's github. – Drav Sloan Aug 4 '15 at 13:10

The fourth column states that the program is listening only for connections on the network interface whose IP address is That means that it's only listening on the loopback interface, so it can only receive connections from the same machine that it's running on, not from other machines connected over the network.

The application presumably has some kind of client-server mode that allows commands to be sent to a running process. TCP is one of the ways to do it.

I hope you didn't block the IP address with iptables, as that is likely to disrupt a lot of things. If you blocked the port used by the program, don't — if it opens the port, it's presumably for a reason.

In any case, blocking traffic with iptables won't close a port. Iptables prevents packets from reaching their destination. It doesn't change anything about whether someone is listening at the destination. You'll still see the port open in netstat as long as the process is listening.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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