tcpdrop: Drop a specific tcp connection or all tcp connections
[dragonfly.git] / usr.sbin / tcpdrop / tcpdrop.8
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 .Dd July 26, 2015
19 .Dt TCPDROP 8
20 .Os
21 .Sh NAME
22 .Nm tcpdrop
23 .Nd drop TCP connections
24 .Sh SYNOPSIS
25 .Nm tcpdrop
26 .Ar local-address
27 .Ar local-port
28 .Ar foreign-address
29 .Ar foreign-port
30 .Nm tcpdrop
31 .Op Fl l
32 .Fl a
33 .Sh DESCRIPTION
34 The
35 .Nm
36 command may be used to drop TCP connections from the command line.
37 .Pp
38 If
39 .Fl a
40 is specified then
41 .Nm
42 will attempt to drop all active connections.
43 The
44 .Fl l
45 flag may be given to list the tcpdrop invocation to drop all active
46 connections one at a time.
47 .Pp
48 If
49 .Fl a
50 is not specified then only the connection between the given local
51 address
52 .Ar local-address ,
53 port
54 .Ar local-port ,
55 and the foreign address
56 .Ar foreign-address ,
57 port
58 .Ar foreign-port ,
59 will be dropped.
60 .Pp
61 Addresses and ports may be specified by name or numeric value.
62 Both IPv4 and IPv6 address formats are supported.
63 .Pp
64 The addresses and ports may be separated by periods or colons
65 instead of spaces.
66 .Sh EXIT STATUS
67 .Ex -std
68 .Sh EXAMPLES
69 If a connection to
70 .Xr httpd 8
71 is causing congestion on a network link, one can drop the TCP session
72 in charge:
73 .Bd -literal -offset indent
74 # sockstat -c | grep httpd
75 www      httpd      16525 3  tcp4 \e
76         192.168.5.41:80      192.168.5.1:26747
77 .Ed
78 .Pp
79 The following command will drop the connection:
80 .Bd -literal -offset indent
81 # tcpdrop 192.168.5.41 80 192.168.5.1 26747
82 .Ed
83 .Pp
84 The following command will drop all connections but those to or from
85 port 22, the port used by
86 .Xr sshd 8 :
87 .Bd -literal -offset indent
88 # tcpdrop -l -a | grep -vw 22 | sh
89 .Ed
90 .Sh SEE ALSO
91 .Xr netstat 1 ,
92 .Xr sockstat 1
93 .Sh AUTHORS
94 .An Markus Friedl Aq Mt markus@openbsd.org
95 .An Juli Mallett Aq Mt jmallett@FreeBSD.org