tcpdrop is a free utility to drop an established TCP connection in Sun solaris. It is a port of the tcpdrop utility from FreeBSD and openBSD. tcpdrop doesn’t do what it says on the tin and nothing more but does it very well. tcpdrop works in Solaris 10,9,8
Let’s put it to work. tcpdrop solaris package is available for download from www.sunfreeware.com. Click one of the following links for Solaris 10 for x86 or SPARC.
Once downloaded unzip and install tcpdrop as follows:
# gunzip tcpdrop_solaris-20080516-sol10-x86-local.gz# pkgadd -d tcpdrop_solaris-20080516-sol10-x86-localThe following packages are available:1 SMCtcpdr tcpdrop_solaris(x86) 20080516Select package(s) you wish to process (or ‘all’ to processall packages). (default: all) [?,??,q]:Processing package instance <SMCtcpdr> from </root/tcpdrop_solaris-20080516-sol10-x86-local>tcpdrop_solaris(x86) 20080516Ceri DaviesUsing </usr/local> as the package base directory.## Processing package information.## Processing system information.2 package pathnames are already properly installed.## Verifying disk space requirements.## Checking for conflicts with packages already installed.## Checking for setuid/setgid programs.Installing tcpdrop_solaris as <SMCtcpdr>## Installing part 1 of 1./usr/local/bin/tcpdrop/usr/local/doc/tcpdrop/OPENSOLARIS.LICENSE/usr/local/doc/tcpdrop/README/usr/local/man/man8/tcpdrop.8[ verifying class <none> ]Installation of <SMCtcpdr> was successful.
I’m testing on Solaris 10 9/10 (x86).
# cat /etc/release
Oracle Solaris 10 9/10 s10x_u9wos_14a X86
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
Assembled 11 August 2010
I’ve established two ssh connections to the server.
# netstat -an|grep EST
192.168.1.66.22 192.168.1.65.49980 15872 51 49640 0 ESTABLISHED
192.168.1.66.22 192.168.1.65.50050 16640 0 49640 0 ESTABLISHED
Add /usr/local/bin to the PATH environment variable if it isn’t already there.
To drop a connection, the syntax for tcpdrop is
# tcpdrop <server address> <server listening port> <client address> <client source port>
In our case, to disconnect the 2nd connection,
# tcpdrop 192.168.1.66 22 192.168.1.65 50050
192.168.1.66:22 <-> 192.168.1.65:50050: dropped
192.168.1.66 is the local server IP
22 is the TCP port SSH server that we are listening for a connection
192.168.1.65 is the client IP
50050 is the source port of the clients ssh connection.
Let’s check netstat now:
# netstat -an|grep EST
192.168.1.66.22 192.168.1.65.49980 16896 67 49640 0 ESTABLISHED
There it is the connection is dropped!