SOC and blue team
Tcpdump Command for Beginners: Capture and Filter Traffic
tcpdump captures network traffic from the command line. It runs on servers and firewalls where there is no screen, which is why defenders keep it close. This guide covers the commands you will use most. Capture only on networks you own or administer.
First Capture
sudo tcpdump -i eth0 -nn -c 20
-i eth0 picks the interface (list them with ip link), -nn stops name lookups so output is faster and clearer, and -c 20 stops after 20 packets.
Filters You Will Use
host 192.168.56.20shows traffic to or from one machine.port 80shows one port;port 53shows DNS.tcp and dst port 22shows connections going to SSH."tcp[tcpflags] & tcp-syn != 0"shows packets with the SYN flag, the start of a connection and the signature of a port scan.
Read a Line
A line shows the time, the protocol, source address and port, an arrow, the destination and the TCP flags. Flags [S] is SYN, [S.] is SYN-ACK and [.] is ACK. Add -A to print the payload as text, which shows plain HTTP requests. That is also why unencrypted protocols are a risk.
Save and Analyze
sudo tcpdump -i eth0 -w capture.pcapsaves packets to a file.tcpdump -nn -r capture.pcapreads it back.- Open the file in Wireshark for a closer look; see Wireshark for beginners.
Command Cheat Sheet
sudo tcpdump -i any -nncaptures on all interfaces without name lookups.-c 50stops after 50 packets.host 192.168.56.20,net 192.168.56.0/24,port 443,portrange 1-1024filter traffic.src host Xanddst port Nfilter by direction.-Aprints payload as text;-Xprints hex and text.-eshows link-level headers.-w file.pcapsaves and-r file.pcapreads a capture.
Try It
Capture SYN packets on a lab VM, then run a scan from another VM with Nmap, as in Nmap for beginners. Watch how a scan looks from the defender's side. This is network traffic monitoring, a topic in the CND syllabus and in SOC work.
Sources and Further Reading
Want to practice detection in a supervised lab? Book free trial classes. Contact us or call +91 86868 92922.
Courses Mentioned in This Guide
More Guides
Firewalls, IDS and IPS Explained for Beginners
What a firewall, an IDS and an IPS each do, how they differ, where they sit on a network, how to try a firewall in a lab, and what defenders still miss.
Read the guide →Suricata for Beginners: Install, Rules and Alerts
Install Suricata on Linux, update rules, run it on an interface, read fast.log and eve.json, and write a simple custom rule, with lab commands.
Read the guide →CND Certification: Exam Format, Eligibility and 20 Modules
What the EC-Council CND exam looks like: 100 questions in 4 hours, the 20 modules, who can start, how much is hands-on and what it leads to.
Read the guide →How to Prepare for the CND Exam: A 6-Week Study Plan
A 6-week CND study plan: modules grouped by week, lab practice with firewalls, logs and traffic, timed question drills and exam-day pacing.
Read the guide →Start Your Cyber Security Career
Talk to a counselor, choose the right course for your goals, and get the fee, syllabus and next batch dates in writing.
- Call+91 86868 92922
Open 7 days: Mon to Fri 8:30 AM to 8:30 PM IST
Sat and Sun 10 AM to 6 PM IST - Emailinfo@hackingtrainer.com
- VisitGround Floor, G-3, Sri Venkatasai Nest, Kallu Compound Road, Nagarjuna Nagar Colony, Yella Reddy Guda, Ameerpet, Hyderabad – 500073
Open in Google Maps