Courseiva
mediumMultiple ChoiceObjective-mapped

XK0-006 Practice Question: A system administrator is configuring a firewall…

A system administrator is configuring a firewall using iptables. The requirement is to allow incoming SSH connections from the 192.168.1.0/24 network only. Which iptables rule should be added to the INPUT chain?

⚠ Common exam trap

A common mix-up: candidates confuse the `-s` (source) and `-d` (destination) flags, leading candidates to choose option A, which would allow SSH traffic destined for the 192.168.1.0/24 network instead of traffic originating from it.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

iptables -A INPUT -p tcp --dport 22 -s 192.168.1.0/24 -j ACCEPT

It uses the `-s` (source) flag to specify the 192.168.1.0/24 network, ensuring only incoming SSH traffic (TCP port 22) from that subnet is accepted. The `-A INPUT` appends this rule to the INPUT chain, which processes incoming packets destined for the local system. This matches the requirement exactly.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • iptables -A INPUT -p tcp --dport 22 -d 192.168.1.0/24 -j ACCEPT

    Why it's wrong here

    The -d flag specifies destination, not source.

  • iptables -A INPUT -p tcp --dport 22 -s 192.168.1.0/24 -j REJECT

    Why it's wrong here

    REJECT sends an error; typically ACCEPT is used for allowed traffic.

  • iptables -A INPUT -p tcp --dport 22 -s 192.168.1.0/24 -j ACCEPT

    Why this is correct

    Allows SSH from the specified network.

  • iptables -A INPUT -p tcp --dport 22 -s 192.168.1.0/24 -j LOG

    Why it's wrong here

    LOG only logs, does not accept.

  • iptables -A INPUT -p tcp --dport 22 -j ACCEPT

    Why it's wrong here

    Accepts SSH from all sources.

Visual reference

192.168.1.0 /24 256 addresses (254 usable) 192.168.1.0 /25 Subnet A 128 addr (126 usable) 192.168.1.128 /25 Subnet B 128 addr (126 usable) Borrowing 1 bit from host portion creates 2 subnets (/25)

About these practice questions

One of 979 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.