OS/Linux

tcpdump를 이용한 port 모니터링

아르비스 2017. 2. 9. 11:19

wireshark 를 직접 설치할수 없는 linux에서는


tcpdump를 이용하여,  data를 수집하고, 이를 wireshark에서 파싱된 data 형태로 확인 가능하다.


dump 뜨는 방법

 nohup tcpdump -i eth0 port 8209 -w tcp_8209_normal.dmp &

                     network ID  port                 파일 이름.




tcpdump version 4.1-PRE-CVS_2012_03_26

libpcap version 1.0.0

Usage: tcpdump [-aAdDefIKlLnNOpqRStuUvxX] [ -B size ] [ -c count ]

                [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]

                [ -i interface ] [ -M secret ] [ -r file ]

                [ -s snaplen ] [ -T type ] [ -w file ] [ -W filecount ]

                [ -y datalinktype ] [ -z command ] [ -Z user ]

                [ expression ] 


networkID는 ifconfig를 통해서 확인 가능하다.

여기 eth0 를 쓰면된다. (실제 IP가 매핑된 곳..)


# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00

          inet addr:192.168.0.1  Bcast:xxx.xxx.xxx.xxx  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:377560544 errors:0 dropped:0 overruns:0 frame:0

          TX packets:322426559 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:84443880548 (78.6 GiB)  TX bytes:71986599537 (67.0 GiB)


lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:951373694 errors:0 dropped:0 overruns:0 frame:0

          TX packets:951373694 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:103386360462 (96.2 GiB)  TX bytes:103386360462 (96.2 GiB)