Paketerfassung mit Wireshark/tcpdump
Lernen Sie, Netzwerkpakete mit `tcpdump` auf der Kommandozeile zu erfassen und mit Wireshark grafisch zu analysieren.
Paketerfassung mit Wireshark/tcpdump ist eine kostenlose Linux Networking & TCP/IP for Developers-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Linux Networking & TCP/IP for Developers-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Linux Networking & TCP/IP for Developers-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
What is Packet Capture?
Packet capture is like taking a snapshot of all the network data flowing in and out of your device. It's a powerful technique for understanding network behavior and troubleshooting issues.
You can see the raw "packets" of information, including their source, destination, and the data they carry. This helps diagnose slow connections, find security problems, or debug network applications.
Introducing `tcpdump`
tcpdump is a command-line utility for capturing and analyzing network traffic. It's pre-installed on most Linux systems, making it a go-to tool for quick network inspections.
It works by "sniffing" packets directly from your network interface. You can view them in real-time or save them for later analysis.
Basic Capture with `tcpdump`
Let's start with the most basic usage: capturing all traffic on a specific network interface. You often need sudo privileges to run tcpdump.
The -i flag specifies the interface (e.g., eth0 or wlan0). If you omit -i, tcpdump tries to pick one automatically.
sudo tcpdump -i eth0Filtering by Host
Capturing all traffic can be overwhelming. You'll often want to filter for specific connections. The host keyword lets you capture traffic to or from a particular IP address or hostname.
sudo tcpdump -i eth0 host 192.168.1.1Filtering by Port
Another common filter is by port. This is useful for seeing traffic related to specific services, like web (port 80/443), SSH (port 22), or DNS (port 53).
sudo tcpdump -i eth0 port 80Combining Filters
You can combine filters using logical operators like and, or, and not. This allows for very precise targeting of the traffic you want to see.
For example, to see HTTP traffic to a specific host, you'd combine host and port.
sudo tcpdump -i eth0 host 192.168.1.1 and port 80Saving to a File (`.pcap`)
For deeper analysis, it's best to save the captured packets to a file. The -w flag writes the raw packet data to a file with a .pcap extension. This file can then be opened by other tools.
The -c flag limits the number of packets to capture.
sudo tcpdump -i eth0 -c 100 -w my_capture.pcapWireshark: The GUI Analyzer
While tcpdump is excellent for command-line capture, Wireshark is the industry-standard graphical tool for deep packet inspection. It provides a user-friendly interface to visualize and analyze captured network data.
Wireshark can capture live traffic or open .pcap files created by tcpdump or other tools.
Importing `tcpdump` Files
A common workflow is to capture packets using tcpdump on a remote server (where a GUI might not be available) and then transfer the .pcap file to your local machine for analysis with Wireshark.
In Wireshark, you simply go to File > Open and select your .pcap file. Wireshark will then display all the captured packets in a structured way.
`tcpdump` Filter Challenge
You need to capture traffic on the eth0 interface that is going to or coming from the IP address 10.0.0.5, but ONLY on port 22 (SSH). Which tcpdump command would achieve this?
Lesson Recap
In this lesson, we explored the powerful world of packet capture. We learned how to use tcpdump to capture and filter network traffic directly from the command line.
- Basic capture with
-i - Filtering by
hostandport - Combining filters with
and,or,not - Saving captures to a
.pcapfile with-w
We also introduced Wireshark as a graphical tool for in-depth analysis of these captured files. Mastering these tools is crucial for any network troubleshooter!
Häufig gestellte Fragen
Ist die Lektion „Paketerfassung mit Wireshark/tcpdump“ kostenlos?
Ja — der vollständige Text von „Paketerfassung mit Wireshark/tcpdump“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Linux Networking & TCP/IP for Developers-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Linux Networking & TCP/IP for Developers-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Paketerfassung mit Wireshark/tcpdump“?
Lernen Sie, Netzwerkpakete mit `tcpdump` auf der Kommandozeile zu erfassen und mit Wireshark grafisch zu analysieren. Du übst Linux Networking & TCP/IP for Developers mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Linux Networking & TCP/IP for Developers zu starten?
Keine Vorkenntnisse erforderlich. Linux Networking & TCP/IP for Developers auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.
Wie lange dauert die Lektion „Paketerfassung mit Wireshark/tcpdump“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Linux Networking & TCP/IP for Developers-Lektion Code schreiben und ausführen?
Ja. Jede Linux Networking & TCP/IP for Developers-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Paketerfassung mit Wireshark/tcpdump
- Werkzeuge zur Netzwerkleistung
- Linux-Firewall (Netfilter/iptables)
- DNS-Diagnose mit dig und nslookup