]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/tcpdrop/tcpdrop.8
MFV r316932: 6280 libzfs: unshare_one() could fail with EZFS_SHARENFSFAILED
[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 .\" $FreeBSD$
19 .\"
20 .Dd September 12, 2017
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 .Nm tcpdrop
36 .Op Fl l
37 .Fl S Ar stack
38 .Nm tcpdrop
39 .Op Fl l
40 .Fl s Ar state
41 .Nm tcpdrop
42 .Op Fl l
43 .Fl S Ar stack
44 .Fl s Ar state
45 .Sh DESCRIPTION
46 The
47 .Nm
48 command may be used to drop TCP connections from the command line.
49 .Pp
50 If
51 .Fl a
52 is specified then
53 .Nm
54 will attempt to drop all TCP connections.
55 .Pp
56 If
57 .Fl S Ar stack
58 is specified then
59 .Nm
60 will attempt to drop all connections using the TCP stack
61 .Ar stack .
62 .Pp
63 If
64 .Fl s Ar state
65 is specified then
66 .Nm
67 will attempt to drop all TCP connections being in the state
68 .Ar state .
69 .Ar state
70 is one of
71 .Dv SYN_SENT ,
72 .Dv SYN_RCVD ,
73 .Dv ESTABLISHED ,
74 .Dv CLOSE_WAIT ,
75 .Dv FIN_WAIT_1 ,
76 .Dv CLOSING ,
77 .Dv LAST_ACK ,
78 .Dv FIN_WAIT_2 , or
79 .Dv TIME_WAIT .
80 .Pp
81 The
82 .Fl l
83 flag may be given in addition to the
84 .Fl a ,
85 .Fl S ,
86 or
87 .Fl s
88 options to list the tcpdrop invocation to drop all corresponding TCP
89 connections one at a time.
90 .Pp
91 If none of the
92 .Fl a ,
93 .Fl S ,
94 or
95 .Fl s
96 options are specified then only the connection between the given local
97 address
98 .Ar local-address ,
99 port
100 .Ar local-port ,
101 and the foreign address
102 .Ar foreign-address ,
103 port
104 .Ar foreign-port ,
105 will be dropped.
106 .Pp
107 Addresses and ports may be specified by name or numeric value.
108 Both IPv4 and IPv6 address formats are supported.
109 .Pp
110 The addresses and ports may be separated by periods or colons
111 instead of spaces.
112 .Sh EXIT STATUS
113 .Ex -std
114 .Sh EXAMPLES
115 If a connection to
116 .Xr httpd 8
117 is causing congestion on a network link, one can drop the TCP session
118 in charge:
119 .Bd -literal -offset indent
120 # sockstat -c | grep httpd
121 www      httpd      16525 3  tcp4 \e
122         192.168.5.41:80      192.168.5.1:26747
123 .Ed
124 .Pp
125 The following command will drop the connection:
126 .Bd -literal -offset indent
127 # tcpdrop 192.168.5.41 80 192.168.5.1 26747
128 .Ed
129 .Pp
130 The following command will drop all connections but those to or from
131 port 22, the port used by
132 .Xr sshd 8 :
133 .Bd -literal -offset indent
134 # tcpdrop -l -a | grep -vw 22 | sh
135 .Ed
136 .Pp
137 The following command will drop all connections using the TCP stack
138 fastack:
139 .Bd -literal -offset indent
140 # tcpdrop -S fastack
141 .Ed
142 .Pp
143 To drop all TCP connections in the LAST_ACK state use:
144 .Bd -literal -offset indent
145 # tcpdrop -s LAST_ACK
146 .Ed
147 .Pp
148 To drop all TCP connections using the TCP stack fastack and being in the
149 LAST_ACK state use:
150 .Bd -literal -offset indent
151 # tcpdrop -S fastack -s LAST_ACK
152 .Ed
153 .Sh SEE ALSO
154 .Xr netstat 1 ,
155 .Xr sockstat 1
156 .Sh AUTHORS
157 .An Markus Friedl Aq Mt markus@openbsd.org
158 .An Juli Mallett Aq Mt jmallett@FreeBSD.org