Courseiva
easyMultiple ChoiceObjective-mapped

XK0-006 Practice Question: The administrator wants to block the IP address…

Exhibit

Refer to the exhibit.
journalctl -u sshd output:
sshd[1234]: Failed password for root from 192.168.1.100 port 22 ssh2
sshd[1235]: Failed password for root from 192.168.1.100 port 22 ssh2
... repeated ...

The administrator wants to block the IP address shown in the exhibit. Which command should be used?

⚠ Common exam trap

A common mix-up: candidates confuse `hosts.deny` with a network-level firewall, not realizing it only controls access to specific services using TCP wrappers and requires a daemon:client format, while `iptables` operates at the kernel level on all IP traffic.

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

`iptables -A INPUT -s 192.168.1.100 -j DROP` appends a rule to the INPUT chain that drops all incoming packets from the source IP 192.168.1.100. This is the standard Linux firewall command for blocking traffic at the network layer using netfilter, and it works immediately without requiring a service restart.

Answer analysis

Option-by-option breakdown

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

  • fail2ban

    Why it's wrong here

    Automated tool, not a command to immediately block.

  • echo '192.168.1.100' >> /etc/hosts.deny

    Why it's wrong here

    Legacy tcpwrappers, not effective for all services.

  • iptables -A INPUT -s 192.168.1.100 -j DROP

    Why this is correct

    Correct: Drops all packets from that IP.

  • firewall-cmd --add-source=192.168.1.100 --permanent

    Why it's wrong here

    Syntax is for firewalld but not directly block; need --add-rich-rule.

Visual reference

Source Router + ACL permit 10.0.0.0/8 deny any Server 10.0.0.5 ✓ 192.168.1.1 ✗ dropped ACLs evaluate top-down; first match wins — implicit deny all at end

About these practice questions

Courseiva writes every XK0-006 question from scratch — 979 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 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.