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 192.168.1.101:12345 0.0.0.0:* LISTEN 0 23181 -
tcp 0 0 192.168.1.101:12345 192.168.1.102:42518 ESTABLISHED 0 44598 -
tcp 0 0 192.168.1.101:12345 192.168.1.103:33532 ESTABLISHED 0 48602 -
tcp 0 0 192.168.1.101:12345 192.168.1.101:34544 ESTABLISHED 0 26196 -
tcp 0 0 192.168.1.101:34544 192.168.1.101:12345 ESTABLISHED 0 24756 -
udp 0 0 192.168.1.101:12345 0.0.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 192.168.1.103
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?