ifconfig
여러 네트워크 인터페이스가 나열되며 그 중 일부는 가상 인터페이스입니다.
어떤 프로세스가 어떤 네트워크 인터페이스를 사용하거나 수신하고 있는지 확인하는 방법은 무엇입니까? 감사해요.
$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:a6:79:a6:bc txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s25: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xfc400000-fc420000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3102389 bytes 174723039 (174.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3102389 bytes 174723039 (174.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:b1:aa:1f txqueuelen 1000 (Ethernet)
RX packets 708 bytes 68468 (68.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 316 bytes 51806 (51.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::fc54:ff:fe99:5eee prefixlen 64 scopeid 0x20<link>
ether fe:54:00:99:5e:ee txqueuelen 1000 (Ethernet)
RX packets 257 bytes 28494 (28.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 23514 bytes 1240204 (1.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlx8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.97 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 prefixlen 64 scopeid 0x20<link>
ether 80:1f:02:b5:c3:89 txqueuelen 1000 (Ethernet)
RX packets 1269625 bytes 1045069752 (1.0 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 646600 bytes 101897054 (101.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
답변1
ss -plnt
cp 포트의 프로세스를 나열 p
하고 l
바인딩된 IP 및 포트는 물론 관련 PID 및 파일 설명자를 표시합니다.n
t
$ sudo ss -plnt | grep -E ':(22|8384)[^0-9]'
LISTEN 0 128 192.168.42.2:8384 0.0.0.0:* users:(("syncthing",pid=14565,fd=8))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=6099,fd=3))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=6099,fd=4))
이전 버전과 비교 netstat -plnt
:
$ sudo netstat -plnt | grep -E ':(22|8384)[^0-9]'
tcp 0 0 192.168.42.2:8384 0.0.0.0:* LISTEN 14565/syncthing
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6099/sshd
tcp6 0 0 :::22 :::* LISTEN 6099/sshd
보안 셸 데몬(모든 인터페이스에서 수신 대기)과 SyncThing의 로컬 설치(관리 인터페이스가 명시적으로 네트워크 주소에 바인딩됨)가 표시됩니다.