In Linux, how does one use tcpdump to capture packets ?, Linuxtcpdump

Source: Internet
Author: User

In Linux, how does one use tcpdump to capture packets ?, Linuxtcpdump
In Linux, how does one use tcpdump to capture packets?

Most of the time, our system is deployed on the Linux system. In some cases, to locate the problem, you need to check whether the data packets sent between systems are normal. Next I will explain how to use tcpdump to capture packets.

Tcpdump is an open-source packet capture tool in Linux. Like wireshark in Windows, tcpdump supports capturing data of specified network ports, specified destination addresses, specified source addresses, specified ports, and specified protocols.

1. Install tcpdump

yum install -y tcpdump
2. Common usage
Capture all network data that passes through eth2 destination or source address 192.168.1.2 and save it to the XX. pcap file tcpdump-I eth2 host 192.168.1.2-w xx. pcap
Capture all network data passing through eth2 with the destination address 192.168.1.2 and save it to the XX. pcap file.
tcpdump   -i  eth2  dst host 192.168.1.2    -w   xx.pcap
Capture all network data passing through eth1 with the source address 192.168.1.2 and save it to the XX. pcap file.
tcpdump   -i  eth2  dst host 192.168.1.2    -w   xx.pcap
? Capture the data that the source port of network port 1 is 25 and save it to xx. pcap # tcpdump-I eth1 src port 25-w xx. pcap
Capture the data of port 25 of network port 1 and save it to xx. pcap.

# Tcpdump-I eth1 dst port 25-w xx. pcap

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.