Courseiva
SecurityhardMultiple SelectObjective-mapped

XK0-006 Security Practice Question

An administrator needs to configure iptables to allow incoming SSH traffic only from the 10.0.0.0/8 network and drop all other incoming traffic except established connections. Which TWO rules are necessary?

⚠ Common exam trap

The trap here is that candidates often forget to include the rule for established connections (Option E) and mistakenly think setting a default DROP policy (Option B) or a blanket DROP rule (Option C) alone is sufficient, not realizing that without allowing established traffic, all return packets are dropped, breaking connectivity.

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 10.0.0.0/8 -j ACCEPT

It explicitly allows incoming SSH traffic (TCP port 22) from the 10.0.0.0/8 network, which matches the requirement to permit SSH only from that subnet. Option E is correct because it accepts all packets that are part of an established or related connection, ensuring that return traffic for outbound connections is not dropped by the default policy or subsequent rules.

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 -j DROP

    Why it's wrong here

    This would drop all SSH, contradicting the requirement.

  • iptables -P INPUT DROP

    Why it's wrong here

    This sets the default policy to drop, but it's a policy change, not a rule. The question asks for rules.

  • iptables -A INPUT -j DROP

    Why it's wrong here

    This would drop all incoming traffic, including established connections, unless placed after allow rules. But it's not strictly necessary if default policy is DROP.

  • iptables -A INPUT -p tcp --dport 22 -s 10.0.0.0/8 -j ACCEPT

    Why this is correct

    Allows SSH from the 10.0.0.0/8 network.

  • iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

    Why this is correct

    Allows established connections.

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.