Question 139 of 513
NetworkinghardMultiple ChoiceObjective-mapped

Quick Answer

The answer is Option C, which uses `iptables -A INPUT -p tcp --dport 443 -j ACCEPT` to allow HTTPS, `iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT` for return traffic, and `iptables -P INPUT DROP` to block everything else. This configuration is correct because it implements an iptables default DROP policy while selectively allowing specific ports, ensuring the web server on 192.168.1.10 is reachable on port 443 from the internet, while the ESTABLISHED,RELATED rule permits the server’s outbound communication to the internal database on port 3306 without needing an explicit inbound rule for that port. On the LFCS exam, this scenario tests your understanding of stateful firewall rules and the critical order of operations: you must add ACCEPT rules before setting the default DROP policy, or all traffic will be blocked. A common trap is forgetting the ESTABLISHED,RELATED rule, which would break return traffic for the database connection. Memory tip: think “Allow first, then drop—state keeps the conversation flowing.”

LFCS Networking Practice Question

This LFCS practice question tests your understanding of networking. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A company wants to ensure that a web server (IP 192.168.1.10) is accessible from the internet via port 443, but all other inbound traffic should be blocked. The server also needs to communicate with an internal database (IP 10.0.0.50) on port 3306. The default firewall zone is 'public'. Which iptables rules should be applied to the server?

Question 1hardmultiple choice
Full question →

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 443 -j ACCEPT; iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT; iptables -P INPUT DROP; iptables -P OUTPUT ACCEPT

Option C is correct because it explicitly allows inbound HTTPS traffic on port 443, permits return traffic for established/related connections (which is essential for the server to communicate with the internal database on port 3306), and sets a default DROP policy on the INPUT chain to block all other inbound traffic. The OUTPUT chain is left with a default ACCEPT policy, allowing the server to initiate outbound connections to the database without additional rules.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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 tcp --dport 443 -j ACCEPT; iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT; iptables -P INPUT DROP

    Why it's wrong here

    This allows only established connections, not new HTTPS connections.

  • iptables -A INPUT -p tcp --dport 443 -j ACCEPT; iptables -P INPUT ACCEPT

    Why it's wrong here

    This accepts all incoming traffic, not just HTTPS.

  • iptables -A INPUT -p tcp --dport 443 -j ACCEPT; iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT; iptables -P INPUT DROP; iptables -P OUTPUT ACCEPT

    Why this is correct

    This allows incoming HTTPS, blocks other inbound, and allows all outbound.

    Related concept

    Read the scenario before looking for a memorised answer.

  • iptables -A INPUT -p tcp --dport 443 -j ACCEPT; iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT; iptables -P INPUT DROP; iptables -P OUTPUT DROP

    Why it's wrong here

    This blocks all outgoing traffic, preventing the database connection.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often forget to set a default DROP policy on the INPUT chain or mistakenly set a default DROP on the OUTPUT chain, thinking it enhances security, but this breaks outbound connectivity required for the server to communicate with the internal database.

Detailed technical explanation

How to think about this question

The iptables connection tracking system (conntrack) uses the ESTABLISHED and RELATED states to automatically permit return packets for connections initiated by the server (e.g., to the database on port 3306) without requiring explicit rules for each destination. The default policy on the INPUT chain (DROP) ensures that any packet not matching an explicit ACCEPT rule is discarded, providing a whitelist-only security model. In a real-world scenario, the server would also need a rule to allow loopback traffic (e.g., -A INPUT -i lo -j ACCEPT) to prevent local services from being blocked, though this is not explicitly tested here.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A security administrator must allow nursing staff to reach a patient records server while blocking access from the guest Wi-Fi VLAN. After applying an extended ACL, traffic is still blocked from nursing workstations. The ACL was applied outbound instead of inbound on the wrong interface. Questions like this test ACL direction and placement rules.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related LFCS practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free LFCS practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this LFCS question test?

Networking — This question tests Networking — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: iptables -A INPUT -p tcp --dport 443 -j ACCEPT; iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT; iptables -P INPUT DROP; iptables -P OUTPUT ACCEPT — Option C is correct because it explicitly allows inbound HTTPS traffic on port 443, permits return traffic for established/related connections (which is essential for the server to communicate with the internal database on port 3306), and sets a default DROP policy on the INPUT chain to block all other inbound traffic. The OUTPUT chain is left with a default ACCEPT policy, allowing the server to initiate outbound connections to the database without additional rules.

What should I do if I get this LFCS question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More LFCS practice questions

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.