Courseiva
System SecurityhardMultiple ChoiceObjective-mapped

LPIC-2 nftables log statement Practice Question

An administrator is configuring nftables to log and drop packets from a specific IP. The rule must be added to the input hook. Which command accomplishes this?

⚠ Common exam trap

Candidates may think that only option C is correct because it includes a prefix, but option B is also syntactically valid and accomplishes the required logging and dropping. The question does not specify that a prefix is mandatory, so both B and C are acceptable.

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

nft add rule inet filter input ip saddr 10.0.0.5 log drop

Both options B and C are syntactically valid nftables rules that log and drop packets from the specified IP. Option B uses 'log drop' which logs the packet with default settings and then drops it. Option C adds a custom prefix for more descriptive logging. The question does not require a prefix, so both B and C are correct. Option A logs with 'accept', which contradicts the drop requirement. Option D logs without a verdict, which is incomplete.

Answer analysis

Option-by-option breakdown

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

  • nft add rule inet filter input ip saddr 10.0.0.5 log accept

    Why it's wrong here

    Incorrect because it uses 'accept' verdict; the requirement is to drop packets.

  • nft add rule inet filter input ip saddr 10.0.0.5 log drop

    Why this is correct

    Correct. This rule logs the packet (with default log settings) and then drops it, satisfying the requirement.

  • nft add rule inet filter input ip saddr 10.0.0.5 log prefix "DROP" drop

    Why this is correct

    Correct. This rule logs the packet with a custom prefix and then drops it, also satisfying the requirement. It is a best practice to include a prefix for easier log identification.

  • nft add rule ip filter input ip saddr 10.0.0.5 drop

    Why it's wrong here

    Incorrect because it lacks a 'log' statement; it only drops with no logging. The requirement is to log and drop.

Visual reference

Client Server SYN (seq=100) SYN-ACK (seq=200, ack=101) ACK (ack=201) Connection established — data transfer begins

About these practice questions

Courseiva writes every LPIC-2 question from scratch — 507 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 LPIC-2 practice question is part of Courseiva's free LPI 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 LPIC-2 exam.