Linux常用命令-idiag-socket-details

命令

idiag-socket-details

描述

查看主机socket连接状态

用法

1
idiag-socket-details [OPTION]

选项

1
2
3
4
Options:
--summary 显示汇总信息(默认选项)
--details 显示详细信息
--stats 显示完整的统计信息

注意

该命令等同于ss或netstat所显示的信息

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
$ idiag-socket-details -v
libnl tools version 3.2.28

$ netstat -tuan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 192.168.80.10:22 192.168.80.81:37676 ESTABLISHED
udp 0 0 127.0.0.1:323 0.0.0.0:*
udp6 0 0 ::1:323 :::*
$ ss -tuan
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 127.0.0.1:323 *:*
udp UNCONN 0 0 [::1]:323 [::]:*
tcp LISTEN 0 128 *:22 *:*
tcp ESTAB 0 0 192.168.80.10:22 192.168.80.81:37676
# 显示的内容等同于如上两条命令的显示结果
$ idiag-socket-details
family: inet src: 0.0.0.0:22 dst: 0.0.0.0:0 iif: 0
family: inet src: 192.168.80.10:22 dst: 192.168.80.81:37676 iif: 0

$ idiag-socket-details --details
family: inet
state: listen
timer (off, 0msec, retransmits: 0)
source: 0.0.0.0:22
destination: 0.0.0.0:0
ifindex: 0
rqueue: 0 wqueue: 128
uid 0
inode 19316
tos: 0x0
traffic class: 0
congestion algorithm: cubic

family: inet
state: established
timer (keepalive, 11m 55s 397msec, retransmits: 0)
source: 192.168.80.10:22
destination: 192.168.80.81:37676
ifindex: 0
rqueue: 0 wqueue: 0
uid 0
inode 26451
tos: 0x10
traffic class: 0
congestion algorithm: cubic

# 详细示例
$ ss -tuan
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 127.0.0.1:323 *:*
udp UNCONN 0 0 [::1]:323 [::]:*
tcp LISTEN 0 128 *:22 *:*
tcp LISTEN 0 511 *:443 *:*
tcp LISTEN 0 300 *:3306 *:*
tcp LISTEN 0 511 127.0.0.1:6379 *:*
tcp LISTEN 0 1024 127.0.0.1:11211 *:*
tcp LISTEN 0 511 *:80 *:*
tcp ESTAB 0 0 127.0.0.1:3306 127.0.0.1:62695
tcp ESTAB 0 0 127.0.0.1:3306 127.0.0.1:62717
tcp ESTAB 0 0 127.0.0.1:3306 127.0.0.1:62721
tcp ESTAB 0 0 127.0.0.1:62717 127.0.0.1:3306
tcp ESTAB 0 0 127.0.0.1:62719 127.0.0.1:3306
tcp ESTAB 0 0 127.0.0.1:62721 127.0.0.1:3306
tcp ESTAB 0 0 127.0.0.1:3306 127.0.0.1:62719
tcp ESTAB 0 36 192.168.31.80:22 192.168.31.6:61681
tcp ESTAB 0 0 127.0.0.1:62695 127.0.0.1:3306
tcp ESTAB 0 0 192.168.31.80:443 192.168.31.6:61778
tcp LISTEN 0 32768 [::]:3000 [::]:*
tcp LISTEN 0 32768 [::]:3001 [::]:*
tcp LISTEN 0 1 [::ffff:127.0.0.1]:8006 [::]:*
tcp LISTEN 0 1000 [::]:8080 [::]:*
$ idiag-socket-details
family: inet src: 0.0.0.0:22 dst: 0.0.0.0:0 iif: 0
family: inet6 src: :::3000 dst: :::0 iif: 0
family: inet6 src: :::3001 dst: :::0 iif: 0
family: inet src: 0.0.0.0:443 dst: 0.0.0.0:0 iif: 0
family: inet6 src: ::ffff:127.0.0.1:8006 dst: :::0 iif: 0
family: inet src: 0.0.0.0:3306 dst: 0.0.0.0:0 iif: 0
family: inet src: 127.0.0.1:6379 dst: 0.0.0.0:0 iif: 0
family: inet src: 127.0.0.1:11211 dst: 0.0.0.0:0 iif: 0
family: inet6 src: :::8080 dst: :::0 iif: 0
family: inet src: 0.0.0.0:80 dst: 0.0.0.0:0 iif: 0
family: inet src: 127.0.0.1:3306 dst: 127.0.0.1:62695 iif: 0
family: inet src: 127.0.0.1:3306 dst: 127.0.0.1:62717 iif: 0
family: inet src: 127.0.0.1:3306 dst: 127.0.0.1:62721 iif: 0
family: inet src: 127.0.0.1:62717 dst: 127.0.0.1:3306 iif: 0
family: inet src: 127.0.0.1:62719 dst: 127.0.0.1:3306 iif: 0
family: inet src: 127.0.0.1:62721 dst: 127.0.0.1:3306 iif: 0
family: inet src: 127.0.0.1:3306 dst: 127.0.0.1:62719 iif: 0
family: inet src: 192.168.31.80:22 dst: 192.168.31.6:61681 iif: 0
family: inet src: 127.0.0.1:62695 dst: 127.0.0.1:3306 iif: 0
family: inet src: 192.168.31.80:443 dst: 192.168.31.6:61778 iif: 0