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…
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)- A3% (1)
- B9% (3)
- C3% (1)
- D85% (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 ACCEPTas a drop action - the rule accepts, not drops. - C also confuses
-dwith-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
Community Discussion
No community discussion yet for this question.