LX0-104 · Question #224
What does the following iptables rule accomplish: iptables A INPUT s 208.77.188.166 j DROP
The correct answer is D. Drops all traffic from 208.77.188.166.. This iptables rule adds an entry to the INPUT chain to discard all incoming network traffic originating from the specified source IP address.
Question
Options
- AForwards all incoming traffic to the host 208.77.188.166.
- BAccepts all traffic from 208.77.188.166.
- CNothing, there is a syntax error.
- DDrops all traffic from 208.77.188.166.
How the community answered
(34 responses)- A3% (1)
- B3% (1)
- C9% (3)
- D85% (29)
Why each option
This iptables rule adds an entry to the INPUT chain to discard all incoming network traffic originating from the specified source IP address.
The `DROP` target discards traffic, it does not forward it, and the `INPUT` chain is for traffic destined for the local host.
The `DROP` target explicitly discards traffic, which is the opposite of accepting it.
The rule `iptables -A INPUT -s 208.77.188.166 -j DROP` is syntactically correct.
The `iptables -A INPUT` command appends a rule to the `INPUT` chain; `-s 208.77.188.166` specifies the source IP address; and `-j DROP` instructs iptables to silently discard any packets that match this criteria.
Concept tested: Iptables rule syntax - source IP and DROP target
Source: https://man7.org/linux/man-pages/man8/iptables.8.html
Topics
Community Discussion
No community discussion yet for this question.