memos/linux/network stat.md
2024-08-26 00:21:39 +09:00

2.5 KiB

netstat

deprecated

ss

socket statistics

ss [options] [filter]

basic

listening 소켓을 제외하고 연결중인 모든 소켓 표시

ss
Netid              State               Recv-Q              Send-Q                                                                    Local Address:Port                                                Peer Address:Port               Process
u_str              ESTAB               0                   0                                              @37ef18770354690f/bus/systemd/bus-system 9789                                                           * 10972
u_str              ESTAB               0                   0                                @855d8616477e9c56/bus/systemd-timesyn/bus-api-timesync 9317                                                           * 6091
u_str              ESTAB               0                   0                                 @248f58c9224923fa/bus/systemd-resolve/bus-api-resolve 9316                                                           * 6090
icmp6              UNCONN              0                   0                                                                              *%enp1s0:ipv6-icmp                                                      *:*
tcp                ESTAB               0                   0                                                                        192.168.200.10:microsoft-ds                                     192.168.200.100:49576
tcp                ESTAB               0                   52                                                              [::ffff:192.168.200.10]:ssh                                     [::ffff:192.168.200.100]:49173

all

모든 소켓 표시

ss -a

numeric

서비스 이름 대신 숫자로 표기

ss

...
[::ffff:192.168.200.10]:ssh
ss -n

...
[::ffff:192.168.200.10]:22

process

관리자 권한 필요

ss -p

Netid                State                  Recv-Q                 Send-Q                                                                          Local Address:Port                                                     Peer Address:Port        Process
tcp                  ESTAB                  0                      36                                                                    [::ffff:192.168.200.10]:ssh                                          [::ffff:192.168.200.100]:49173       users:(("sshd",pid=3277,fd=4),("sshd",pid=3160,fd=4))