I'm trying to test a system that uses multiple interconnected hosts, with one of the hosts randomly selected as the leader and the others being members. The members connect to the leader on a specific port, e.g, 12345. Here is sample netstat output showing the members (*.102, *.103 connected to the leader *.101):

[user@leader ~]$ sudo netstat -peanut | grep :12345
tcp        0      0*                LISTEN      0          23181      -                   
tcp        0      0      ESTABLISHED 0          44598      -                   
tcp        0      0      ESTABLISHED 0          48602      -                   
tcp        0      0      ESTABLISHED 0          26196      -                   
tcp        0      0      ESTABLISHED 0          24756      -                   
udp        0      0*                            0          24755      -  

When a member is disconnected from the leader, it immediately tries to re-establish the connection. I attempted to kill the established connection via sudo tcpkill -i eth1 -9 host but the connection is immediately re-established. I also tried to block the the local port first using iptables with sudo /sbin/iptables -A INPUT -p tcp --dport 12345 -j DROP before running tcpkill, but I get the same issue.

I can't quite tell if this is an issue with iptables itself or if my command is invalid. Can someone help me out?

1 Answer 1


The iptables command looks fine at first glance. Is iptables running and in charge of firewalling on the host? IIRC, CentOS ships with firewalld on by default since CentOS 7, not iptables.

  • 1
    This was an easy fix! Thanks for opening my eyes to the fact that iptables isn't enabled by default on CentOS 7. I just disabled firewalld with sudo systemctl disable --now firewalld, then installed and enabled iptables-services with sudo yum -y install iptables-services && sudo systemctl enable --now iptables. Afterward, everything worked as expected.
    – Argyle
    Apr 4, 2022 at 16:49

You must log in to answer this question.

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