nerdexam
LPI

303-300 · Question #20

What effect does the following command have on TCP packets? iptables- A INPUT d 10.142.232.1 p tcp --dport 20:21 j ACCEPT

The correct answer is D. Accept all TCP traffic on port 20 and 21 for the IP address 10.142.232.1. Option D is correct because the -d 10.142.232.1 flag specifies the destination IP address, -p tcp --dport 20:21 matches TCP traffic on ports 20 and 21 (FTP data and control), and -j ACCEPT tells iptables to allow the matching packets through the INPUT chain. Why the distractors…

Network Security

Question

What effect does the following command have on TCP packets? iptables- A INPUT d 10.142.232.1 p tcp --dport 20:21 j ACCEPT

Options

  • AForward all TCP traffic not on port 20 or 21 to the IP address 10.142.232.1
  • BDrop all TCP traffic coming from 10.142.232.1 destined for port 20 or 21.
  • CAccept only TCP traffic from 10.142.232.1 destined for port 20 or 21.
  • DAccept all TCP traffic on port 20 and 21 for the IP address 10.142.232.1

How the community answered

(33 responses)
  • A
    3% (1)
  • B
    9% (3)
  • C
    3% (1)
  • D
    85% (28)

Explanation

Option D is correct because the -d 10.142.232.1 flag specifies the destination IP address, -p tcp --dport 20:21 matches TCP traffic on ports 20 and 21 (FTP data and control), and -j ACCEPT tells iptables to allow the matching packets through the INPUT chain.

Why the distractors are wrong:

  • A is wrong on two counts: the action is ACCEPT (not forward/redirect), and the rule targets ports 20-21 specifically, not traffic outside those ports.
  • B confuses -d (destination) with -s (source), and misreads -j ACCEPT as a drop action - the rule accepts, not drops.
  • C also confuses -d with -s; the IP is the traffic's destination, not its source/origin.

Memory tip: In iptables, think "d = destination, s = source" - -d means "going to this IP," and -s means "coming from this IP." If you can keep those two straight, you can immediately eliminate any answer that reverses the direction.

Topics

#iptables syntax#TCP filtering#firewall rules#port-based access control

Community Discussion

No community discussion yet for this question.

Full 303-300 Practice