Capture Filtered Traffic on eth1
In this step, you will learn to capture network traffic on the eth1 interface with specific filters, building on the TCP filtering from previous steps. The eth1 interface typically represents your primary wired network connection, and we'll use it to demonstrate practical packet capturing scenarios.
- First, verify your network interfaces by running:
ip addr show eth1
This command displays detailed information about your eth1 interface. You should see output showing the eth1 interface is up (state UP) and has an assigned IP address. This verification is important because you can't capture traffic on an interface that doesn't exist or isn't active.
- To capture HTTP traffic specifically on eth1, use:
sudo tshark -i eth1 -f "tcp port 80" -c 15
Let's break down what this command does:
-i eth1
specifies which network interface to listen on
-f "tcp port 80"
creates a capture filter for HTTP traffic (port 80 is the standard HTTP port)
-c 15
limits the capture to 15 packets, which is enough for demonstration without overwhelming you with data
- To capture traffic between specific IPs, try:
sudo tshark -i eth1 -f "host 8.8.8.8" -c 10
Here we're filtering traffic to/from Google's DNS server (8.8.8.8). The "host" filter matches both incoming and outgoing traffic to this specific IP address. This is useful when you want to monitor communication with a particular server.
- For more complex filtering, combine conditions:
sudo tshark -i eth1 -f "tcp port 443 and host 8.8.8.8" -c 5
This command demonstrates how to combine filters. It captures HTTPS traffic (port 443) specifically to/from 8.8.8.8. The "and" operator allows you to create precise filters that match multiple conditions simultaneously.
- Observe the output showing filtered packets with details like:
1 0.000000 192.168.1.100 → 8.8.8.8 TCP 74 49234 → 443 [SYN] Seq=0 Win=64240 Len=0
This sample output shows a TCP SYN packet (the first packet in a TCP connection) from your local machine (192.168.1.100) to Google's server. The numbers represent timing, ports, and TCP sequence information that helps analyze network behavior.