LFCS Networking Practice Question
An administrator is configuring a Linux server to act as a web server. The server has two network interfaces: eth0 (public IP 203.0.113.10) and eth1 (private IP 10.0.0.10). The default policy on the INPUT chain is DROP. The administrator wants to allow incoming HTTP (port 80) traffic from any source but only to the public interface. Which TWO iptables rules should be added?
⚠ Common exam trap
Many candidates confuse the INPUT and FORWARD chains, or incorrectly assume that specifying the source IP (`-s`) is equivalent to specifying the destination IP (`-d`), leading them to pick Option D or A instead of the correct combination of B and C.
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 -d 203.0.113.10 -p tcp --dport 80 -j ACCEPT
It specifies the destination IP address (203.0.113.10) of the public interface, ensuring that HTTP traffic is only accepted when destined for that IP. Option C is also correct because it uses the `-i eth0` flag to match incoming traffic on the public interface only, which restricts HTTP access to the public-facing interface. Both rules are needed to satisfy the requirement of allowing HTTP from any source but only to the public interface, given the default DROP policy on the INPUT chain.
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 FORWARD -i eth0 -p tcp --dport 80 -j ACCEPT
Why it's wrong here
FORWARD chain is for routed traffic, not local input.
- ✓
iptables -A INPUT -d 203.0.113.10 -p tcp --dport 80 -j ACCEPT
Why this is correct
Matches traffic destined to the public IP.
- ✓
iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
Why this is correct
Matches incoming traffic on the public interface.
- ✗
iptables -A INPUT -s 203.0.113.10 -p tcp --dport 80 -j ACCEPT
Why it's wrong here
Specifies source IP instead of destination.
- ✗
iptables -A INPUT -i eth1 -p tcp --dport 80 -j ACCEPT
Why it's wrong here
Allows traffic on the private interface, not desired.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LFCS 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 →
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.