LFCS Networking Practice Question
A system administrator wants to allow incoming SSH connections from a specific IP range 192.168.10.0/24 using firewalld. Which command should be used?
⚠ Common exam trap
The trap here is that candidates often forget to specify the zone (defaulting to the wrong zone) or incorrectly assume that --add-source and --add-service can be combined directly without a rich rule, leading to a rule that either applies to all sources or fails silently.
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
✓
firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.10.0/24" service name="ssh" accept' --permanent
It explicitly targets the 'public' zone (the default zone for external-facing interfaces) and uses a rich rule to allow SSH traffic only from the 192.168.10.0/24 source IP range. The --permanent flag ensures the rule persists across reloads. This is the precise syntax required by firewalld for source-specific service access.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
firewall-cmd --add-rich-rule='rule family="ipv4" source address="192.168.10.0/24" service name="ssh" accept' --permanent
Why it's wrong here
This rich rule is missing the zone; it will apply to the default zone but it's better practice to specify the zone explicitly.
- ✗
firewall-cmd --add-service=ssh --add-source=192.168.10.0/24 --zone=internal --permanent
Why it's wrong here
This command combines --add-service and --add-source with a zone, but the correct way to restrict by source is with a rich rule.
- ✗
firewall-cmd --add-source=192.168.10.0/24 --add-service=ssh --permanent
Why it's wrong here
This command adds a source-based rule but does not specify a zone; it may not work as intended because it applies to the default zone but without a rich rule.
- ✓
firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.10.0/24" service name="ssh" accept' --permanent
Why this is correct
This is the correct syntax for adding a rich rule that allows SSH from a specific source in a specific zone.
Go deeper
Related to this question
About these practice questions
One of 507 original LFCS 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.