Capture controlled local traffic and interpret headers, flags and packet counts.
The focus of this experiment is to interpret local packet capture fields and protocol filters. Students then compare matching and excluded packets from the authorized fixture, and verify filter behavior without collecting unrelated traffic. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.
Learning objectives
Interpret local packet capture fields and protocol filters.
Compare matching and excluded packets from the authorized fixture.
Verify filter behavior without collecting unrelated traffic.
Record the relevant inputs, intermediate states and final verification result before changing the reference configuration.
Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.
Expected learning outcomes
On completion, students can interpret local packet capture fields and protocol filters, compare matching and excluded packets from the authorized fixture, and verify filter behavior without collecting unrelated traffic.
Required deliverables
Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing verify filter behavior without collecting unrelated traffic. Separate predicted values from observations.
Prerequisite knowledge and related learning
Review the foundational terminology in Concepts and confirm readiness using the existing setup instructions. After completion, continue to Nmap — authorized local service inventory.
Environment and experimental methodology
The specified isolated laboratory environment, with local synthetic inputs and authorized services only. Use the experiment-specific setup and verification instructions.
Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.
Scientific concept map: Local client — Generate HTTP traffic; Loopback interface — lo; Capture filter — BPF predicate; Packet record — Flags and length; PCAP — Offline inspection.
Scientific foundations and analytical reasoning
Packet capture observes traffic matching a chosen interface and filter; TCP flags describe connection state, not application success.
Before operating the equipment or executing the program, derive the expected outcome using the required theoretical work in Experiment. Use the diagram to identify the variables and system boundaries.
Scientific theory · Capture boundaries and packet interpretation
Packet capture observes packets visible on the selected interface during the capture window. A capture filter selects frames before recording; display filters can further select stored packets. TCP flags describe connection establishment and termination; UDP and ICMP have different semantics. Capture loss and encryption limit conclusions.
Worked example and engineering interpretation
For the controlled loopback HTTP server, record the selected interface and port filter, then identify the TCP SYN, SYN-ACK and ACK. If no packets match, verify that traffic actually occurred during the capture. A TCP handshake does not establish HTTP success.
Engineering principles · additional worked teaching example
Packet capture observes traffic on selected interface/filter. A capture filter limits recorded packets; a display filter selects after capture. If a local test emits five packets but capture starts after two, at most three matching packets appear.
From theory to experiment
Predict the reference result before operating the workbench; check the actual intermediate state, units and constraints. The existing simulation, implementation and procedure below are distinct sources of evidence.
How to investigate tcpdump — packet capture and protocol filtering
Capture controlled local traffic and interpret headers, flags and packet counts.
Analytical investigation means collecting an observation, identifying the mechanism, using a calculation or state trace to explain it, and checking your conclusion against evidence. Controlled comparison means changing one independent variable, holding the remaining relevant conditions constant, and measuring a dependent variable against a baseline. Experimental validation means comparing a predicted result to a reproducible observation or assertion; agreement inside a model does not certify hardware. Evidence-based reasoning connects a specific observation to a theoretical rule and states uncertainty, not merely an opinion. Performance characterization records a named metric and its units across conditions; sensitivity analysis changes one parameter across several values. A threat assessment links an asset, threat, consequence and evidence to a mitigation.
Experiment-specific guided practice
Objective: Capture controlled local traffic and interpret headers, flags and packet counts.
Capture and filtering — complete its numbered steps and record the requested evidence.
Header and payload evidence — complete its numbered steps and record the requested evidence.
Compare observations with the reference checks and submit the required evidence.
Start a local HTTP server bound to 127.0.0.1:8080 using the command. Open a second terminal, list capture interfaces and select loopback.
Reference check: TCP, UDP and ICMP appear.
Only matching events captured.
Observe actual TCP flags and captured packets; exact count may vary.
Only matching TCP traffic displayed.
Model boundary: tcpdump is a packet capture tool. BPF capture filters select which packets reach the capture output. A loopback interface observes local traffic, not remote physical Ethernet. Captured packet count is not application message count; segmentation and offloading can alter observations. Restrict all captures to your own isolated lab traffic.
Independent task and submission evidence
2. Header and payload evidence — complete its numbered steps and record the requested evidence. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.
Before execution write the independent variable and its levels, dependent observation with units where applicable, baseline, controlled variables, measurement method and expected result. For a state machine use state/event/output rather than inventing a numeric metric. Record failures and repeat the baseline. A weak conclusion is “it works”; a supported conclusion names the changed setting, observed value/state, corresponding rule and one limitation.
Trial
Changed setting
Fixed settings
Predicted result
Actual observation / units
Evidence / uncertainty
A: baseline
Reference
Record
Predict
Record
Record
B: one change
Record
Same as A
Predict
Record
Record
A: repeat
Restore
Same as A
Predict
Record
Record
Completion: submit the filled table, relevant simulator screenshot or terminal/notebook output, reasoning with units/assumptions, and one limitation. Preserve the independent assessment questions; this guide does not fill their answers.
Packet observation
A capture interface provides packet observations to tcpdump. Capture filters select traffic before it is recorded. A PCAP file retains the captured headers and payload bytes within the configured snap length; a printed line is a summary rather than a complete packet.
TCP, UDP and ICMP
TCP establishes a connection using SYN, SYN-ACK and ACK; its segments contain ports, sequence numbers and flags. UDP is connectionless and uses ports; ICMP carries network-control messages. Numeric output avoids name-resolution ambiguity.
Controlled measurement
Generate your own localhost traffic. Compare a matching capture filter with one that excludes the service. Packet absence may be caused by the interface, filter, capture timing or drops, so it does not establish that no traffic existed.
Prerequisites: Basic TCP/IP and WSL Setup
Algorithm structure and data flow. Use the simulation to inspect the corresponding numerical transformations.
Worked engineering reasoning and boundary conditions
Packet capture is passive observation on an authorized local interface. A capture filter limits collected frames; a decoded packet's length and payload visibility depend on protocol and snap length. TLS payload encryption does not conceal all metadata.
Use the diagram to follow the calculation or state progression. Keep the teaching configuration separate from the independent exercise values; compare observations with the actual model and implementation.
Concept animation · operation pathway
Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.
Step 1 of 4 · Authorized interface
Authorized interface
Authorized interface
loopback fixture
Capture
Authorized interface
loopback fixture
Capture
100 original bytes
Snap length
Authorized interface
loopback fixture
Capture
100 original bytes
Snap length
64 bytes stored
Interpret
Authorized interface
loopback fixture
Capture
100 original bytes
Snap length
64 bytes stored
Interpret
36 omitted, original length may remain
Teaching example only; inspect live calculations or real practical evidence separately.
Interactive flashcards
Self-rated study progress is stored locally, not used for official grades.
Browse all explanationsWhat does tcpdump capture?
Packets visible on the selected interface matching its filter.
Why use -nn?
Avoid name and service resolution.
What does a PCAP retain?
Captured packet records for offline analysis.
What can TLS conceal?
Application payload, not all traffic metadata.
What does -i lo select?
The Linux loopback interface.
What does -nn suppress?
Host and service-name resolution.
What does -w do?
Writes captured packets to a file.
What does -r do?
Reads a saved capture file.
What is BPF used for?
Selecting packets matching an expression.
Why start a local HTTP server?
To generate known authorized traffic for the experiment.
What does a SYN flag indicate?
An attempt to synchronize TCP sequence numbers.
What completes a normal TCP handshake?
SYN, SYN-ACK, ACK.
Why might an excluded filter produce zero packets?
It discards events outside the selected conditions.
Why avoid capturing real credentials?
Captures can contain sensitive application data.
A capture filter excludes port 8080. Will the HTTP packets necessarily appear in the PCAP?
No. A capture filter discards nonmatching packets before writing them.
A local HTTP request is absent from an Ethernet capture. What should be checked?
Check whether traffic uses loopback, the interface choice, filter, timing and capture drops.
Why use -nn in a packet summary?
To show numeric addresses and port numbers rather than resolve names, avoiding ambiguous labels.
Virtual laboratory
Change inputs independently, play or step through the calculated states, expand a workstation, and compare your observations. Browser network models do not send or capture real packets.
Independent theoretical exercises
Before the simulation or practical, solve both experiment-specific tasks. List the given inputs, show the intermediate calculation or state trace, identify the expected observation, and state a limitation. Show formulas and intermediate calculations where relevant, or draw the requested state/sequence diagram. These are independent classroom fixtures; where they differ from the reference configuration below, do not treat them as measured values. Compare your predictions with the corresponding experiment afterwards.
01 · Predict and derive using the given inputs
Draw a local TCP handshake using SYN, SYN-ACK, ACK and then one data segment. Identify source and destination ports for client→8080 and reverse.
Engineering method — Packet capture observes traffic on selected interface/filter. A capture filter limits recorded packets; a display filter selects after capture. If a local test emits five packets but capture starts after two, at most three matching packets appear. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Compare or justify using evidence
For a fixture of 6 TCP packets port8080, 3 UDP and 2 ICMP, predict counts for tcp, tcp port 8080, udp and icmp. Explain what an empty capture cannot establish.
Engineering method — Packet capture observes traffic on selected interface/filter. A capture filter limits recorded packets; a display filter selects after capture. If a local test emits five packets but capture starts after two, at most three matching packets appear. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
03 · Evidence reasoning
Evidence reasoning · Independent work
Capture starts at t=3 and stops at t=8, local test sends t=1,3,5,8,9. Assuming interval [3,8) and matching filter, which events appear?
Evidence reasoning — Packet capture observes traffic on selected interface/filter. A capture filter limits recorded packets; a display filter selects after capture. If a local test emits five packets but capture starts after two, at most three matching packets appear. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
Work is saved locally when browser storage is available. Export it for submission; no remote upload or automatic grade is assigned.
Expanded independent theoretical exercise bank
Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.
Foundational · Apply the principle
Independent theoretical exercise · NS01-01
A capture has 100 frames; 30 are TCP, 20 of those use port 443. What fraction of total frames is TCP port 443?
Intermediate · Calculate or trace
Independent theoretical exercise · NS01-02
A 100-byte frame is captured with snap length 64. How many bytes at most are stored?
Intermediate · Interpret the result
Independent theoretical exercise · NS01-03
Compare Ethernet source address and IP source address.
Advanced · Analyze a condition
Independent theoretical exercise · NS01-04
Why might port 1883 traffic be readable while verified TLS traffic is not?
Advanced · Diagnose or compare
Independent theoretical exercise · NS01-05
A local capture shows no packets for an expected exchange. Give three benign checks.
Challenging · Engineering verification
Independent theoretical exercise · NS01-06
Design a safe local comparison of plaintext and TLS telemetry.
Activity sequence
Follow the setup commands, then each named activity. The detailed instructions, given values and recording fields appear below.
Capture and filtering — complete its numbered steps and record the requested evidence.
Compare observations with the reference checks and submit the required evidence.
Scientific experimental protocol
Research question: Capture controlled local traffic and interpret headers, flags and packet counts.
Independent variables: packet filter, service state and selected port. Dependent observations: packet counts, flags and local port state.
Controls: use the indicated baseline settings, vary one parameter at a time, and record actual results separately from the browser model. For timing comparisons use the same environment and report repetitions.
Experimental procedure
Before starting — tools and setup
Open Kali/WSL and keep each terminal open as instructed. Run the commands in their labeled terminals; use only the loopback target. Use the virtual simulator if tools or capture permissions are unavailable.
BASH · Command
# Kali/WSL: install local tools
sudo apt update
sudo apt install -y tcpdump curl python3
# Terminal 1: start a local service
python3 -m http.server 8080 --bind 127.0.0.1
# Terminal 2: inspect interfaces and capture; Ctrl+C after request
sudo tcpdump -D
sudo tcpdump -i lo -nn -w lab-capture.pcap 'tcp port 8080 and host 127.0.0.1'# Terminal 3: generate only your own local request
curl --max-time 5 http://127.0.0.1:8080/
# Terminal 2: Ctrl+C, then read saved file
sudo tcpdump -nn -r lab-capture.pcap 'tcp port 8080'
# Stop the server with Ctrl+C in terminal 1.
Complete the activities in order. Hold the controlled conditions fixed, record the input and actual output, and compare your observations with an independent calculation or test vector.
01
Capture and filtering
Open the exact workstation
Choose the relevant tab below, enter the assigned values in the activity steps, then use Step or Play to inspect intermediate calculations. Return to Experiment and record the results before changing the input.
Start a local HTTP server bound to 127.0.0.1:8080 using the command. Open a second terminal, list capture interfaces and select loopback.
Capture your own request with the provided tcpdump filter; issue curl locally, stop capture and inspect the PCAP offline.
In the virtual workstation compare unfiltered TCP/UDP/ICMP events against TCP and port 8080 selections.
Evidence to record
Actual PCAP packet count, source/destination ports, flags and virtual comparison.
Verification: Record the baseline and modified input separately, note the observed intermediate values, compare with the assigned calculation, and explain any mismatch. Do not replace observations with expected values.
02
Header and payload evidence
Open the exact workstation
Choose the relevant tab below, enter the assigned values in the activity steps, then use Step or Play to inspect intermediate calculations. Return to Experiment and record the results before changing the input.
Identify SYN/SYN-ACK/ACK and application data where present. Explain retransmission, capture limits and numeric output.
Repeat with a filter that excludes your local service; explain why absence of captured packets is not proof of no network activity.
Evidence to record
Positive/negative capture and limitations.
Verification: Record the baseline and modified input separately, note the observed intermediate values, compare with the assigned calculation, and explain any mismatch. Do not replace observations with expected values.
Trial
Procedure
Reference check
Your observation
Unfiltered model
Play generated traffic with all selected and limit 10.
TCP, UDP and ICMP appear.
Enter result
Filtered model
Reset, select TCP or port 8080; play to limit.
Only matching events captured.
Enter result
Local capture
Start localhost HTTP server and capture with tcpdump; send curl request.
Observe actual TCP flags and captured packets; exact count may vary.
Enter result
Offline analysis
Read lab-capture.pcap with numeric addresses and port filter.
Only matching TCP traffic displayed.
Enter result
Analysis and reporting
Why do captured packet counts differ from HTTP requests? What is the difference between capture and display filtering?
Record environment, input values, output and deviations; retain traces or PCAP where appropriate. The table is temporary; save your own report.
Download this notebook and open Google Colab. Select File → Upload notebook and choose the downloaded .ipynb.
Read the Markdown instructions before each executable cell. Use a Python runtime, run cells from top to bottom, and resolve imports if necessary.
Perform the baseline and controlled changes. Save the notebook with actual outputs and your written interpretation.
Execution scope: tcpdump is a packet capture tool. BPF capture filters select which packets reach the capture output. A loopback interface observes local traffic, not remote physical Ethernet. Captured packet count is not application message count; segmentation and offloading can alter observations. Restrict all captures to your own isolated lab traffic. Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.
01Instructions · Markdown
# NS01 · tcpdump — packet capture and protocol filtering
**PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh**
## 1. Scientific objective
Follow the setup commands, then each named activity. The detailed instructions, given values and recording fields appear below.
Complete the analytical worksheet in the portal first. Record your predictions before running this notebook. This notebook is a bounded local computational investigation; use the portal’s separate WSL, hardware or Remix procedure for real interfaces.
02Instructions · Markdown
## Experiment-specific preparation
Capture controlled local traffic and interpret headers, flags and packet counts.
**Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):**
1. Capture and filtering — complete its numbered steps and record the requested evidence.
2. Header and payload evidence — complete its numbered steps and record the requested evidence.
3. Compare observations with the reference checks and submit the required evidence.
4. Start a local HTTP server bound to 127.0.0.1:8080 using the command. Open a second terminal, list capture interfaces and select loopback.
5. Capture your own request with the provided tcpdump filter; issue curl locally, stop capture and inspect the PCAP offline.
**Evidence:** TCP, UDP and ICMP appear.
Only matching events captured.
Observe actual TCP flags and captured packets; exact count may vary.
Only matching TCP traffic displayed.
**Boundary:** tcpdump is a packet capture tool. BPF capture filters select which packets reach the capture output. A loopback interface observes local traffic, not remote physical Ethernet. Captured packet count is not application message count; segmentation and offloading can alter observations. Restrict all captures to your own isolated lab traffic.
03Instructions · Markdown
## 2. Reference configuration and investigation
1. Capture and filtering — complete its numbered steps and record the requested evidence.
2. Header and payload evidence — complete its numbered steps and record the requested evidence.
3. Compare observations with the reference checks and submit the required evidence.
Run cells in order; do not substitute model results for physical measurements.
04Instructions · Markdown
## 3. Create fictional packet metadata; no network capture in Colab.
05Python · executable cell
PYTHON · Code cell
# =====================================================================
# NS01 | Code cell 01 | tcpdump — packet capture and protocol filtering
# Purpose: 3. Create fictional packet metadata; no network capture in Colab.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Set packets for the next computation or reference condition.
packets=[{"proto":"tcp","port":8080,"flags":"S"},{"proto":"tcp","port":8080,"flags":"A"},{"proto":"udp","port":53,"flags":""},{"proto":"icmp","port":None,"flags":""}]
print(packets)
## 4. Filter metadata and compare expected local tcpdump observations.
07Python · executable cell
PYTHON · Code cell
# =====================================================================
# NS01 | Code cell 02 | tcpdump — packet capture and protocol filtering
# Purpose: 4. Filter metadata and compare expected local tcpdump observations.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Set selected for the next computation or reference condition.
selected=[p for p in packets if p["proto"]=="tcp" and p["port"]==8080]
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert len(selected)==2
print(selected)
## Experimental analysis and submission
1. Record the reference input, predicted output and actual result.
2. Modify one independent variable and run the relevant cells again.
3. Explain the result using the theory and identify model limitations.
4. Save the notebook with outputs and retain the separate theoretical worksheet.
**Your derivation and conclusion:**
(Complete independently.)
09Instructions · Markdown
## Guided reasoning and evidence
A controlled comparison changes one independent input while keeping the other relevant inputs fixed; the dependent variable is the recorded output. Use this lab’s reference condition above.
**Independent task:** 2. Header and payload evidence — complete its numbered steps and record the requested evidence. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.
| Trial | Input/configuration | Prediction | Observation | Evidence / limitation |
|---|---|---|---|---|
| A | Reference | | | |
| B | Changed input | | | |
| A repeat | Reference | | | |
A conclusion is supported only when it cites the recorded values or observed states and explains them with the experiment theory.
Local practical commands
Run the commands in the labeled terminals, only against your own loopback interface. If port 8080 is already occupied, stop your own service or use another assigned local port consistently.
BASH · Command
# Kali/WSL: install local tools
sudo apt update
sudo apt install -y tcpdump curl python3
# Terminal 1: start a local service
python3 -m http.server 8080 --bind 127.0.0.1
# Terminal 2: inspect interfaces and capture; Ctrl+C after request
sudo tcpdump -D
sudo tcpdump -i lo -nn -w lab-capture.pcap 'tcp port 8080 and host 127.0.0.1'# Terminal 3: generate only your own local request
curl --max-time 5 http://127.0.0.1:8080/
# Terminal 2: Ctrl+C, then read saved file
sudo tcpdump -nn -r lab-capture.pcap 'tcp port 8080'
# Stop the server with Ctrl+C in terminal 1.
The local utilities require installation and permission; the website simulator is independent of these commands.