xref: /freebsd/usr.sbin/tcpdrop/tcpdrop.8 (revision 193d9e768ba63fcfb187cfd17f461f7d41345048)
1.\"	$OpenBSD: tcpdrop.8,v 1.5 2004/05/24 13:57:31 jmc Exp $
2.\"
3.\" Copyright (c) 2009 Juli Mallett <jmallett@FreeBSD.org>
4.\" Copyright (c) 2004 Markus Friedl <markus@openbsd.org>
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.\" $FreeBSD$
19.\"
20.Dd January 30, 2013
21.Dt TCPDROP 8
22.Os
23.Sh NAME
24.Nm tcpdrop
25.Nd drop TCP connections
26.Sh SYNOPSIS
27.Nm tcpdrop
28.Ar local-address
29.Ar local-port
30.Ar foreign-address
31.Ar foreign-port
32.Nm tcpdrop
33.Op Fl l
34.Fl a
35.Sh DESCRIPTION
36The
37.Nm
38command may be used to drop TCP connections from the command line.
39.Pp
40If
41.Fl a
42is specified then
43.Nm
44will attempt to drop all active connections.
45The
46.Fl l
47flag may be given to list the tcpdrop invocation to drop all active
48connections one at a time.
49.Pp
50If
51.Fl a
52is not specified then only the connection between the given local
53address
54.Ar local-address ,
55port
56.Ar local-port ,
57and the foreign address
58.Ar foreign-address ,
59port
60.Ar foreign-port ,
61will be dropped.
62.Pp
63Addresses and ports may be specified by name or numeric value.
64Both IPv4 and IPv6 address formats are supported.
65.Pp
66The addresses and ports may be separated by periods or colons
67instead of spaces.
68.Sh EXIT STATUS
69.Ex -std
70.Sh EXAMPLES
71If a connection to
72.Xr httpd 8
73is causing congestion on a network link, one can drop the TCP session
74in charge:
75.Bd -literal -offset indent
76# sockstat -c | grep httpd
77www      httpd      16525 3  tcp4 \e
78	192.168.5.41:80      192.168.5.1:26747
79.Ed
80.Pp
81The following command will drop the connection:
82.Bd -literal -offset indent
83# tcpdrop 192.168.5.41 80 192.168.5.1 26747
84.Ed
85.Pp
86The following command will drop all connections but those to or from
87port 22, the port used by
88.Xr sshd 8 :
89.Bd -literal -offset indent
90# tcpdrop -l -a | grep -vw 22 | sh
91.Ed
92.Sh SEE ALSO
93.Xr netstat 1 ,
94.Xr sockstat 1
95.Sh AUTHORS
96.An Markus Friedl Aq Mt markus@openbsd.org
97.An Juli Mallett Aq Mt jmallett@FreeBSD.org
98