]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/tcpdrop/tcpdrop.8
unbound: Vendor import 1.18.0
[FreeBSD/FreeBSD.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 December 4, 2021
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 .Nm tcpdrop
34 .Op Fl l
35 .Fl C Ar cc-algo
36 .Op Fl S Ar stack
37 .Op Fl s Ar state
38 .Nm tcpdrop
39 .Op Fl l
40 .Op Fl C Ar cc-algo
41 .Fl S Ar stack
42 .Op Fl s Ar state
43 .Nm tcpdrop
44 .Op Fl l
45 .Op Fl C Ar cc-algo
46 .Op Fl S Ar stack
47 .Fl s Ar state
48 .Sh DESCRIPTION
49 The
50 .Nm
51 command may be used to drop TCP connections from the command line.
52 .Pp
53 If
54 .Fl a
55 is specified then
56 .Nm
57 will attempt to drop all TCP connections.
58 .Pp
59 If
60 .Fl C Ar cc-algo
61 is specified then
62 .Nm
63 will attempt to drop all connections using the TCP congestion control algorithm
64 .Ar cc-algo .
65 .Pp
66 If
67 .Fl S Ar stack
68 is specified then
69 .Nm
70 will attempt to drop all connections using the TCP stack
71 .Ar stack .
72 .Pp
73 If
74 .Fl s Ar state
75 is specified then
76 .Nm
77 will attempt to drop all TCP connections being in the state
78 .Ar state .
79 .Ar state
80 is one of
81 .Dv SYN_SENT ,
82 .Dv SYN_RCVD ,
83 .Dv ESTABLISHED ,
84 .Dv CLOSE_WAIT ,
85 .Dv FIN_WAIT_1 ,
86 .Dv CLOSING ,
87 .Dv LAST_ACK ,
88 .Dv FIN_WAIT_2 , or
89 .Dv TIME_WAIT .
90 .Pp
91 If multiple of
92 .Fl C Ar cc-algo ,
93 .Fl S Ar stack ,
94 and
95 .Fl s Ar state
96 are specified,
97 .Nm
98 will attempt to drop all TCP connections using the congestion control algorithm
99 .Ar cc-algo ,
100 being in the state
101 .Ar state ,
102 and using the TCP stack
103 .Ar stack ,
104 if specified.
105 Since TCP connections in the
106 .Dv TIME_WAIT
107 state are not tied to any TCP stack, using the option
108 .Fl s Dv TIME_WAIT
109 in combination with the
110 .Fl S Ar stack
111 option results in
112 .Nm
113 not dropping any TCP connection.
114 .Pp
115 The
116 .Fl l
117 flag may be given in addition to the
118 .Fl a ,
119 .Fl C ,
120 .Fl S ,
121 or
122 .Fl s
123 options to list the tcpdrop invocation to drop all corresponding TCP
124 connections one at a time.
125 .Pp
126 If none of the
127 .Fl a ,
128 .Fl C ,
129 .Fl S ,
130 or
131 .Fl s
132 options are specified then only the connection between the given local
133 address
134 .Ar local-address ,
135 port
136 .Ar local-port ,
137 and the foreign address
138 .Ar foreign-address ,
139 port
140 .Ar foreign-port ,
141 will be dropped.
142 .Pp
143 Addresses and ports may be specified by name or numeric value.
144 Both IPv4 and IPv6 address formats are supported.
145 .Pp
146 The addresses and ports may be separated by periods or colons
147 instead of spaces.
148 .Sh EXIT STATUS
149 .Ex -std
150 .Sh EXAMPLES
151 If a connection to
152 .Xr httpd 8
153 is causing congestion on a network link, one can drop the TCP session
154 in charge:
155 .Bd -literal -offset indent
156 # sockstat -c | grep httpd
157 www      httpd      16525 3  tcp4 \e
158         192.168.5.41:80      192.168.5.1:26747
159 .Ed
160 .Pp
161 The following command will drop the connection:
162 .Bd -literal -offset indent
163 # tcpdrop 192.168.5.41 80 192.168.5.1 26747
164 .Ed
165 .Pp
166 The following command will drop all connections but those to or from
167 port 22, the port used by
168 .Xr sshd 8 :
169 .Bd -literal -offset indent
170 # tcpdrop -l -a | grep -vw 22 | sh
171 .Ed
172 .Pp
173 To drop all TCP connections using the new-reno congestion control algorithm use:
174 .Bd -literal -offset indent
175 # tcpdrop -C new-reno
176 .Ed
177 .Pp
178 The following command will drop all connections using the TCP stack
179 rack:
180 .Bd -literal -offset indent
181 # tcpdrop -S rack
182 .Ed
183 .Pp
184 To drop all TCP connections in the LAST_ACK state use:
185 .Bd -literal -offset indent
186 # tcpdrop -s LAST_ACK
187 .Ed
188 .Pp
189 To drop all TCP connections using the congestion control algorithm new-reno and
190 the TCP stack rack and being in the LAST_ACK state use:
191 .Bd -literal -offset indent
192 # tcpdrop -C new-reno -S rack -s LAST_ACK
193 .Ed
194 .Sh SEE ALSO
195 .Xr netstat 1 ,
196 .Xr sockstat 1 ,
197 .Xr tcp 4 ,
198 .Xr tcp_functions 9
199 .Sh AUTHORS
200 .An Markus Friedl Aq Mt markus@openbsd.org
201 .An Juli Mallett Aq Mt jmallett@FreeBSD.org