CentOS는 유선상의 모든 것을 수신합니다.

CentOS는 유선상의 모든 것을 수신합니다.

나는 특정 네트워크 인터페이스(eth0 등')와 관련된 모든 "이벤트"를 (stdout으로) 출력하는 Linux의 기본 명령이 있다는 것을 알고 있습니다. 파일 변경 사항을 수신
하는 것처럼 .. 찾을 수 없습니다.tail -f <file>

모든 이벤트, 수신 패킷, 심지어 삭제된 패킷까지 보고 싶습니다. 가능한 가장 낮은 수준에서. 모든 프로토콜(TCP, UDP 등)에서.
이벤트를 보려면 매우 간단한 것이 필요하기 때문에 WireShark는 테스트용이기 때문에 너무 크다고 생각합니다.

명령은 무엇입니까?

답변1

다른 사람들이 언급했듯이 tcpdump에 대해 이야기하고 있습니다.

또한 있습니다ngrep:

$ yum info ngrep
Loaded plugins: fastestmirror, priorities
Available Packages
Name       : ngrep
Arch       : i386
Version    : 1.45
Release    : 2.el5.rf
Size       : 33 k
Repo       : dag
Summary    : Realtime network grep tool
URL        : http://ngrep.sourceforge.net/
License    : GPL
Description: ngrep is grep command that works on realtime network data.
           : 
           : ngrep strives to provide most of GNU grep's common features, applying
           : them to the network layer. ngrep is a pcap-aware tool that will allow
           : you to specify extended regular or hexadecimal expressions to match
           : against data payloads of packets. It currently recognizes TCP, UDP
           : and ICMP across Ethernet, PPP, SLIP, FDDI, Token Ring and null
           : interfaces, and understands bpf filter logic in the same fashion as
           : more common packet sniffing tools, such as tcpdump and snoop.

이는 네트워크 스트림의 grep과 비슷합니다. 표준 패키지는 아니지만 원하는 네트워크 트래픽을 찾는 데 도움이 될 수 있습니다.

답변2

TCP 덤프?

[root@kerberos users]# tcpdump -i virbr0 port 22 -c 10
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on virbr0, link-type EN10MB (Ethernet), capture size 65535 bytes
10 packets captured
10 packets received by filter
0 packets dropped by kernel
18:15:00.629145 IP kerberos.example.com.ssh > 10.5.50.220.60680: Flags [P.], seq 723634149:723634341, ack 2691792940, win 145, options [nop,nop,TS val 2845703615 ecr 994376021], length 192
18:15:00.646606 IP 10.5.50.220.60680 > kerberos.example.com.ssh: Flags [.], ack 0, win 65535, options [nop,nop,TS val 994376068 ecr 2845703587], length 0
18:15:00.653646 IP 10.5.50.220.65416 > kerberos.example.com.ssh: Flags [.], ack 4059311404, win 33108, options [nop,nop,TS val 994376075 ecr 2845703594], length 0
18:15:00.659078 IP 10.5.50.220.65416 > kerberos.example.com.ssh: Flags [P.], seq 0:96, ack 1, win 33156, options [nop,nop,TS val 994376075 ecr 2845703594], length 96
18:15:00.660041 IP kerberos.example.com.ssh > 10.5.50.220.65416: Flags [P.], seq 1:129, ack 96, win 244, options [nop,nop,TS val 2845703645 ecr 994376075], length 128
18:15:00.676094 IP 10.5.50.220.60680 > kerberos.example.com.ssh: Flags [.], ack 192, win 65535, options [nop,nop,TS val 994376096 ecr 2845703615], length 0
18:15:00.706762 IP 10.5.50.220.65416 > kerberos.example.com.ssh: Flags [.], ack 129, win 33092, options [nop,nop,TS val 994376126 ecr 2845703645], length 0
18:15:00.712138 IP 10.5.50.220.65416 > kerberos.example.com.ssh: Flags [P.], seq 96:192, ack 129, win 33156, options [nop,nop,TS val 994376126 ecr 2845703645], length 96
18:15:00.713242 IP kerberos.example.com.ssh > 10.5.50.220.65416: Flags [P.], seq 129:257, ack 192, win 244, options [nop,nop,TS val 2845703699 ecr 994376126], length 128
18:15:00.760791 IP 10.5.50.220.65416 > kerberos.example.com.ssh: Flags [.], ack 257, win 33092, options [nop,nop,TS val 994376179 ecr 2845703699], length 0

답변3

찾고 계실 것 같아요 tcpdump.

관련 정보