ubuntuでnetstat

ubuntu

netstatコマンドのインストール

# apt install net-tools

利用方法

# netstat -ltupn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:1883            0.0.0.0:*               LISTEN      4709/docker-proxy
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      701/sshd: /usr/sbin
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/init
tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN      4451/python3
tcp        0      0 192.0.2.235:40000       0.0.0.0:*               LISTEN      4451/python3
tcp        0      0 0.0.0.0:9001            0.0.0.0:*               LISTEN      4687/docker-proxy
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      626/systemd-resolve
tcp6       0      0 :::1883                 :::*                    LISTEN      4716/docker-proxy
tcp6       0      0 fe80::4004:4004:4004:40000 :::*                 LISTEN      4451/python3
tcp6       0      0 :::22                   :::*                    LISTEN      701/sshd: /usr/sbin
tcp6       0      0 :::111                  :::*                    LISTEN      1/init
tcp6       0      0 :::8123                 :::*                    LISTEN      4451/python3
tcp6       0      0 :::9001                 :::*                    LISTEN      4694/docker-proxy
udp        0      0 0.0.0.0:41085           0.0.0.0:*                           4451/python3
udp        0      0 127.0.0.53:53           0.0.0.0:*                           626/systemd-resolve
udp        0      0 0.0.0.0:111             0.0.0.0:*                           1/init
udp        0      0 127.0.0.1:323           0.0.0.0:*                           744/chronyd
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           4451/python3
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           4451/python3
udp        0      0 0.0.0.0:53179           0.0.0.0:*                           4451/python3
udp        0      0 192.0.2.235:5353        0.0.0.0:*                           4451/python3
udp        0      0 0.0.0.0:55749           0.0.0.0:*                           4451/python3
udp6       0      0 :::40934                :::*                                4451/python3
udp6       0      0 :::111                  :::*                                1/init
udp6       0      0 ::1:323                 :::*                                744/chronyd
udp6       0      0 fe80::6809:6809:6809:546 :::*                               624/systemd-network
udp6       0      0 :::1900                 :::*                                4451/python3
udp6       0      0 :::1900                 :::*                                4451/python3
udp6       0      0 :::53346                :::*                                4451/python3
udp6       0      0 :::5353                 :::*                                4451/python3
udp6       0      0 fe80::8086:8086:8086:5353 :::*                              4451/python3
udp6       0      0 :::38674                :::*                                4451/python3

以下のコマンドでも代用可能。スーパーユーザ権限が必要。

# ss -lntun
Netid    State     Recv-Q     Send-Q                            Local Address:Port          Peer Address:Port    Process
udp      UNCONN    0          0                                       0.0.0.0:41085              0.0.0.0:*
udp      UNCONN    0          0                                 127.0.0.53%lo:53                 0.0.0.0:*
udp      UNCONN    0          0                                       0.0.0.0:111                0.0.0.0:*
udp      UNCONN    0          0                                     127.0.0.1:323                0.0.0.0:*
udp      UNCONN    0          0                                       0.0.0.0:1900               0.0.0.0:*
udp      UNCONN    0          0                                       0.0.0.0:1900               0.0.0.0:*
udp      UNCONN    0          0                                       0.0.0.0:53179              0.0.0.0:*
udp      UNCONN    0          0                                    192.0.2.235:5353               0.0.0.0:*
udp      UNCONN    0          0                                       0.0.0.0:55749              0.0.0.0:*
udp      UNCONN    0          0                                             *:40934                    *:*
udp      UNCONN    0          0                                          [::]:111                   [::]:*
udp      UNCONN    0          0                                         [::1]:323                   [::]:*
udp      UNCONN    0          0              [fe80::6809:6809:6809:6809]%eno1:546                   [::]:*
udp      UNCONN    0          0                                             *:1900                     *:*
udp      UNCONN    0          0                                             *:1900                     *:*
udp      UNCONN    0          0                                             *:53346                    *:*
udp      UNCONN    0          0                                             *:5353                     *:*
udp      UNCONN    0          0              [fe80::8086:8086:8086:8086]%eno1:5353                  [::]:*
udp      UNCONN    0          0                                             *:38674                    *:*
tcp      LISTEN    0          4096                              127.0.0.53%lo:53                 0.0.0.0:*
tcp      LISTEN    0          128                                     0.0.0.0:22                 0.0.0.0:*
tcp      LISTEN    0          4096                                    0.0.0.0:1883               0.0.0.0:*
tcp      LISTEN    0          128                                     0.0.0.0:8123               0.0.0.0:*
tcp      LISTEN    0          128                                192.0.2.235:40000              0.0.0.0:*
tcp      LISTEN    0          4096                                    0.0.0.0:9001               0.0.0.0:*
tcp      LISTEN    0          4096                                    0.0.0.0:111                0.0.0.0:*
tcp      LISTEN    0          128                                        [::]:22                    [::]:*
tcp      LISTEN    0          4096                                       [::]:1883                  [::]:*
tcp      LISTEN    0          128                                        [::]:8123                  [::]:*
tcp      LISTEN    0          128            [fe80::4004:4004:4004:4004]%eno1:40000                 [::]:*
tcp      LISTEN    0          4096                                       [::]:9001                  [::]:*
tcp      LISTEN    0          4096                                       [::]:111                   [::]:*

コメント

タイトルとURLをコピーしました