tcpdump でトラフィックを取得・調査する
tcpdump でライブパケットを取得してフィルターを適用し、接続やセキュリティの問題を診断することで、ネットワークとセキュリティのツールキットをさらに充実させます。
「tcpdump でトラフィックを取得・調査する」はCoddyKit上の無料Linux Command Line Masteryレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはLinux Command Line Mastery学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Linux Command Line Masteryコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Seeing the Wire
Diagnostics like ping and dig tell you whether something works, but sometimes you need to see the actual packets. tcpdump captures network traffic in real time.
Listing Interfaces
First find which interface to listen on with -D. Common names are eth0, wlan0, or en0.
sudo tcpdump -DA Basic Capture
-i selects the interface. Capturing requires root because it reads raw packets.
sudo tcpdump -i eth0Limiting the Capture
-c stops after N packets so the terminal does not flood, useful for a quick look.
sudo tcpdump -i eth0 -c 10Filtering by Host
Capture filters narrow the noise. host limits to traffic to/from one address.
sudo tcpdump -i eth0 host 8.8.8.8Filtering by Port
Use port to focus on a service. Here we watch only HTTPS traffic.
sudo tcpdump -i eth0 port 443Combining Filters
Filters combine with and, or, not for precise targeting.
sudo tcpdump -i eth0 tcp and port 22 and not host 10.0.0.1Readable Output Flags
-n skips DNS lookups (faster, shows IPs), and -v adds detail. -A prints packet payloads as ASCII.
sudo tcpdump -i eth0 -nv port 80Saving to a File
-w writes raw packets to a .pcap file you can analyze later, e.g. in Wireshark.
sudo tcpdump -i eth0 -w capture.pcapReading a Capture
-r replays a saved capture, and you can still apply filters while reading.
tcpdump -r capture.pcap port 443Security Use Cases
tcpdump helps spot unexpected outbound connections, confirm a firewall rule is blocking traffic, or verify that sensitive data is encrypted on the wire.
Quick Check
What does the -w option do in tcpdump?
Recap
You can now inspect live traffic:
-ipicks the interface,-climits count- Filters:
host,port, combined withand/or/not -n/-v/-Ashape output-wsaves and-rreads.pcapfiles
tcpdump turns invisible packets into a debuggable stream.
よくある質問
「tcpdump でトラフィックを取得・調査する」レッスンは無料ですか?
はい。「tcpdump でトラフィックを取得・調査する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Linux Command Line Masteryコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Linux Command Line Masteryコースには全4レッスンが含まれています。
「tcpdump でトラフィックを取得・調査する」で何を学びますか?
tcpdump でライブパケットを取得してフィルターを適用し、接続やセキュリティの問題を診断することで、ネットワークとセキュリティのツールキットをさらに充実させます。 ブラウザで直接実行するハンズオンコードでLinux Command Line Masteryを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Linux Command Line Masteryを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのLinux Command Line Masteryは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「tcpdump でトラフィックを取得・調査する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このLinux Command Line Masteryレッスンでコードを書いて実行できますか?
はい。すべてのLinux Command Line Masteryレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- ネットワーク診断:`traceroute`、`nslookup`、`dig`
- ファイアウォール管理:`ufw`、`firewalld`、`iptables`
- Secure Shellキーの管理
- tcpdump でトラフィックを取得・調査する