Bird
Raised Fist0
Computer Networksknowledge~10 mins

Firewalls and packet filtering in Computer Networks - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Firewalls and packet filtering
Incoming Network Packet
↓
Check Firewall Rules
↓
Packet Allowed
↓
Forward to Device
↓
End Process
A network packet arrives and the firewall checks it against rules. If it matches allowed rules, it passes through; otherwise, it is blocked.
Execution Sample
Computer Networks
Packet arrives
Firewall checks source IP
If IP allowed, forward packet
Else, block packet
This simple process shows how a firewall filters packets based on source IP rules.
Analysis Table
StepPacket Source IPRule CheckedRule Match?Action TakenResult
1192.168.1.10Allow 192.168.1.0/24YesForward packetPacket sent to device
210.0.0.5Allow 192.168.1.0/24NoBlock packetPacket dropped
3172.16.0.3Allow 172.16.0.0/16YesForward packetPacket sent to device
48.8.8.8Allow 172.16.0.0/16NoBlock packetPacket dropped
5End---No more packets to check
💡 Packets are processed one by one; if no rule matches, packet is blocked by default.
State Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4Final
Packet Source IPNone192.168.1.1010.0.0.5172.16.0.38.8.8.8No more packets
Rule MatchNoneYesNoYesNoN/A
Action TakenNoneForwardBlockForwardBlockN/A
Key Insights - 3 Insights
Why does the packet from 10.0.0.5 get blocked even though it is a valid IP?
Because the firewall rules only allow packets from 192.168.1.0/24 subnet in step 2, and 10.0.0.5 does not match this rule, so it is blocked as shown in execution_table row 2.
What happens if a packet does not match any allow rule?
It is blocked by default. This is shown in steps 2 and 4 where packets not matching any allow rule are dropped.
How does the firewall decide to forward or block a packet?
It checks the packet's source IP against the rules. If a rule matches (Yes in Rule Match column), it forwards; otherwise, it blocks, as seen in the execution_table.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what action is taken for the packet from 172.16.0.3 at step 3?
ABlock packet
BForward packet
CIgnore packet
DLog packet only
💡 Hint
Check the 'Action Taken' column at step 3 in the execution_table.
At which step does the firewall block a packet because it does not match the allowed subnet?
AStep 2
BStep 3
CStep 1
DStep 5
💡 Hint
Look for 'Block packet' in the 'Action Taken' column and check the corresponding step.
If the firewall rule allowed 10.0.0.0/8 instead of 192.168.1.0/24, what would happen to the packet from 10.0.0.5 at step 2?
AIt would be logged only
BIt would be blocked
CIt would be forwarded
DIt would cause an error
💡 Hint
Refer to the variable_tracker for 'Packet Source IP' and 'Rule Match' changes if the rule changes.
Concept Snapshot
Firewalls check incoming packets against rules.
Packets matching allow rules are forwarded.
Packets not matching are blocked.
Rules often filter by IP, port, or protocol.
Default action is usually to block unknown packets.
Full Transcript
A firewall acts like a gatekeeper for network traffic. When a packet arrives, the firewall checks it against a list of rules. If the packet's source IP matches an allowed range, the firewall forwards it to the device. If not, the firewall blocks the packet and stops it from passing through. This process repeats for each packet. If no rules match, the packet is blocked by default. This simple filtering helps protect networks from unwanted or harmful traffic.

Practice

(1/5)
1. What is the primary function of a firewall in a computer network?
easy
A. To allow or block data packets based on security rules
B. To increase the speed of data transmission
C. To store data packets temporarily
D. To convert data packets into different formats

Solution

  1. Step 1: Understand the role of a firewall

    A firewall controls network access by filtering data packets according to security rules.
  2. Step 2: Identify the correct function

    It does not speed up transmission, store packets, or convert formats; it only allows or blocks packets.
  3. Final Answer:

    To allow or block data packets based on security rules -> Option A
  4. Quick Check:

    Firewall function = Allow/block packets [OK]
Hint: Firewalls control access by blocking or allowing packets [OK]
Common Mistakes:
  • Thinking firewalls speed up network traffic
  • Confusing firewalls with data storage devices
  • Believing firewalls change packet formats
2. Which of the following is a correct example of a packet filtering rule?
easy
A. Store packets for later analysis
B. Block packets based on their payload content
C. Convert packets from TCP to UDP
D. Allow packets from IP 192.168.1.10 to port 80

Solution

  1. Step 1: Understand packet filtering rules

    Packet filtering rules specify conditions like source IP and destination port to allow or block packets.
  2. Step 2: Identify the valid rule

    Allowing packets from a specific IP to a specific port is a valid rule; converting or storing packets is not filtering.
  3. Final Answer:

    Allow packets from IP 192.168.1.10 to port 80 -> Option D
  4. Quick Check:

    Packet filtering = Allow/block by IP and port [OK]
Hint: Packet filtering rules specify IP and port conditions [OK]
Common Mistakes:
  • Confusing filtering with packet conversion
  • Thinking filtering stores packets
  • Believing all packets are always blocked
3. Consider a firewall rule: Block packets from IP 10.0.0.5 to port 22. What will happen if a packet from IP 10.0.0.5 tries to connect to port 22?
medium
A. The packet will be redirected to another port
B. The packet will be allowed through the firewall
C. The packet will be blocked by the firewall
D. The packet will be logged but allowed

Solution

  1. Step 1: Analyze the firewall rule

    The rule explicitly blocks packets from IP 10.0.0.5 to port 22.
  2. Step 2: Determine the packet's fate

    Since the packet matches the block rule, it will be stopped and not allowed through.
  3. Final Answer:

    The packet will be blocked by the firewall -> Option C
  4. Quick Check:

    Block rule matched = Packet blocked [OK]
Hint: Block rules stop matching packets from passing [OK]
Common Mistakes:
  • Assuming packets are redirected instead of blocked
  • Thinking packets are logged but allowed by default
  • Confusing allow and block rules
4. A firewall rule is written as: Allow packets to port 443 from any IP. However, packets from IP 192.168.1.20 to port 443 are still blocked. What is the most likely error?
medium
A. There is a conflicting block rule with higher priority
B. The firewall does not filter packets by port
C. Port 443 is not used for secure connections
D. The rule is missing a source IP specification

Solution

  1. Step 1: Review the allow rule

    The rule allows packets to port 443 from any IP, so it should permit packets from 192.168.1.20.
  2. Step 2: Identify possible conflicts

    If packets are blocked despite the allow rule, a block rule with higher priority likely overrides it.
  3. Final Answer:

    There is a conflicting block rule with higher priority -> Option A
  4. Quick Check:

    Conflicting rules = Block overrides allow [OK]
Hint: Check for higher priority block rules when allow fails [OK]
Common Mistakes:
  • Believing port 443 is not for secure connections
  • Ignoring rule priority order
  • Assuming firewall ignores ports
5. You want to create a firewall rule that allows HTTP traffic (port 80) only from the IP range 192.168.1.0 to 192.168.1.255 and blocks all other HTTP traffic. Which approach correctly applies packet filtering to achieve this?
hard
A. Block packets from 192.168.1.0/24 to port 80; then allow all packets to port 80
B. Allow packets from 192.168.1.0/24 to port 80; then block all packets to port 80
C. Allow all packets to port 80 without IP restrictions
D. Block all packets to port 80 without exceptions

Solution

  1. Step 1: Define the allow rule for the IP range

    Allow packets from IP range 192.168.1.0/24 (which covers 192.168.1.0 to 192.168.1.255) to port 80.
  2. Step 2: Define the block rule for all other HTTP traffic

    Block all other packets to port 80 that do not match the allow rule.
  3. Final Answer:

    Allow packets from 192.168.1.0/24 to port 80; then block all packets to port 80 -> Option B
  4. Quick Check:

    Allow specific IP range, then block others = Correct filtering [OK]
Hint: Allow specific IP range first, then block others [OK]
Common Mistakes:
  • Blocking allowed IP range by mistake
  • Allowing all traffic without restrictions
  • Reversing allow and block order
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard