Courseiva
Security →mediumMultiple Choice

XK0-006 Security Practice Question

A system administrator needs to add an iptables rule to drop incoming TCP traffic on port 22 (SSH) from the IP address 10.0.0.100. Which command should be used?

⚠ Common exam trap

XK0-006 often tests the confusion between INPUT, OUTPUT, and FORWARD chains, and between source and destination ports; candidates may incorrectly use OUTPUT or FORWARD when the requirement is to block incoming traffic to the local system.

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

iptables -A INPUT -p tcp --dport 22 -s 10.0.0.100 -j DROP is correct because it appends a rule to the INPUT chain that matches TCP packets destined for port 22 (SSH) from source IP 10.0.0.100 and drops them. This precisely implements the requirement to block incoming SSH traffic from that specific IP address. The -p tcp specifies the protocol, --dport 22 matches the destination port, and -s sets the source address.

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 udp --dport 22 -s 10.0.0.100 -j DROP

    Why it's wrong here

    The rule matches UDP, not TCP, so SSH traffic on port 22 is never dropped; the -p udp protocol match contradicts the requirement for TCP. It is tempting because the syntax is otherwise valid, and such a rule would correctly block UDP port 22 traffic in a scenario targeting a UDP service.

  • ✗

    iptables -I OUTPUT -p tcp --sport 22 -d 10.0.0.100 -j DROP

    Why it's wrong here

    The OUTPUT chain matches locally generated egress traffic, and --sport 22 targets the source port rather than the destination port of inbound SSH. It is tempting because OUTPUT rules are used to block outbound connections, which would be correct when restricting a host's own outgoing SSH traffic.

  • ✗

    iptables -A FORWARD -p tcp --dport 22 -s 10.0.0.100 -j DROP

    Why it's wrong here

    The FORWARD chain applies only to traffic routed through the host, not packets delivered to its own SSH daemon, so the rule never matches local inbound connections. It is tempting because FORWARD rules are the correct choice when filtering traffic passing through a gateway or router between networks.

  • ✓

    iptables -A INPUT -p tcp --dport 22 -s 10.0.0.100 -j DROP

    Why this is correct

    Appending to the INPUT chain with `-A` matches inbound packets, while `-p tcp --dport 22 -s 10.0.0.100` filters TCP destined for port 22 from that source, and `-j DROP` discards them silently. This satisfies the requirement to drop incoming SSH traffic from 10.0.0.100.

About these practice questions

Courseiva writes every XK0-006 question from scratch — 781 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

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.