1tcpconnect(8)               System Manager's Manual              tcpconnect(8)
2
3
4

NAME

6       tcpconnect  -  Trace  TCP  active  connections  (connect()). Uses Linux
7       eBPF/bcc.
8

SYNOPSIS

10       tcpconnect [-h] [-c] [-t] [-x] [-p PID] [-P PORT]
11

DESCRIPTION

13       This tool traces active TCP connections (eg, via a  connect()  syscall;
14       accept() are passive connections). This can be useful for general trou‐
15       bleshooting to see what connections are initiated by the local server.
16
17       All connection attempts are traced, even if they ultimately fail.
18
19       This works by tracing the kernel tcp_v4_connect() and  tcp_v6_connect()
20       functions  using  dynamic  tracing, and will need updating to match any
21       changes to these functions.
22
23       Since this uses BPF, only the root user can use this tool.
24

REQUIREMENTS

26       CONFIG_BPF and bcc.
27

OPTIONS

29       -h     Print usage message.
30
31       -t     Include a timestamp column.
32
33       -c     Count connects per src ip and dest ip/port.
34
35       -p PID Trace this process ID only (filtered in-kernel).
36
37       -P PORT
38              Comma-separated list of destination ports to trace (filtered in-
39              kernel).
40

EXAMPLES

42       -U     Include a UID column.
43
44       -u UID Trace this UID only (filtered in-kernel).
45
46       Trace all active TCP connections:
47              # tcpconnect
48
49       Trace all TCP connects, and include timestamps:
50              # tcpconnect -t
51
52       Trace PID 181 only:
53              # tcpconnect -p 181
54
55       Trace ports 80 and 81 only:
56              # tcpconnect -P 80,81
57
58       Trace all TCP connects, and include UID:
59              # tcpconnect -U
60
61       Trace UID 1000 only:
62              # tcpconnect -u 1000
63
64       Count connects per src ip and dest ip/port:
65              # tcpconnect -c
66

FIELDS

68       TIME(s)
69              Time of the call, in seconds.
70
71       UID    User ID
72
73       PID    Process ID
74
75       COMM   Process name
76
77       IP     IP address family (4 or 6)
78
79       SADDR  Source IP address.
80
81       DADDR  Destination IP address.
82
83       DPORT  Destination port
84
85       CONNECTS
86              Accumulated active connections since start.
87

OVERHEAD

89       This  traces  the  kernel tcp_v[46]_connect functions and prints output
90       for each event. As the rate of this is generally expected to be low  (<
91       1000/s), the overhead is also expected to be negligible. If you have an
92       application that is calling a high rate of connect()s, such as a  proxy
93       server, then test and understand this overhead before use.
94

SOURCE

96       This is from bcc.
97
98              https://github.com/iovisor/bcc
99
100       Also  look  in  the bcc distribution for a companion _examples.txt file
101       containing example usage, output, and commentary for this tool.
102

OS

104       Linux
105

STABILITY

107       Unstable - in development.
108

AUTHOR

110       Brendan Gregg
111

SEE ALSO

113       tcpaccept(8), funccount(8), tcpdump(8)
114
115
116
117USER COMMANDS                     2015-08-25                     tcpconnect(8)
Impressum