6

I've search around and all the suggestions just say to kill the process. But I'm surprised I can't find any simple way to force a "connection" to close, without killing a pid associated with it.

iptables seems like a terrible solution, as i don't want add rules to block a whole service, or kill all connections. I just want to kill or force closed one existing connection, and not affect any other connections or future connections.

Ideally, the processes on both sides would see just the connection close, or at worst, stop responding.

2
  • If you let us know why you'd want to do that and what you're trying to achieve, we just might be able to help you. superuser.com/questions/how-to-ask Mar 5, 2013 at 21:01
  • 1
    Oh all sorts of reasons. Simulating dropped connections or poor network conditions. Forcing specific clients to reconnect. Rejecting clients after a certain amount of time or workload. More complicated access control.
    – DragonFax
    Mar 6, 2013 at 6:50

1 Answer 1

3

If you know something about the connection (ip, host, port), you can use this command:

tcpkill host 192.168.1.2

Sources:

You must log in to answer this question.

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