Author Topic: use tcpdump on container and output pcap file  (Read 6628 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
use tcpdump on container and output pcap file
« on: พฤศจิกายน 28, 2019, 11:15:48 PM »
ในกรณีเราใช้งาน docker image ที่เป็น syslog-ng หรือ syslog ที่ port 514 (tcp/udp)
เราสามารถที่จะ troubleshooting ปัญหาว่ามี log ส่งผ่าน container ตัวนี้หรือเปล่า
โดยใช้งานตัว netshoot ซึ่งรวบรวม command เกี่ยวกับ tcpdump,route และ command อื่นๆ ให้ troubleshooting ได้ครับดูเพิ่มเติม
https://github.com/nicolaka/netshoot

===run command
docker run -it --rm --net container:<container_name> nicolaka/netshoot tcpdump

===or check more info before access pull tcpdump on that container then output to pcap file
ssh to server
docker ps -a
===send command tcpdump to capture syslog on src
docker run -it --rm --net container:syslog_service_1 nicolaka/netshoot tcpdump src port 514 -w abc.pcap
« Last Edit: พฤศจิกายน 28, 2019, 11:24:48 PM by golfreeze »