CompTIA Linux+ (XK0-005) — Question 36
A cloud engineer needs to block the IP address 192.168.10.50 from accessing a Linux server. Which of the following commands will achieve this goal?
Answer options
- A. iptables -F INPUT -j 192.168.10.50 -m DROP
- B. iptables -A INPUT -s 192.168.10.30 -j DROP
- C. iptables -i INPUT --ipv4 192.168.10.50 -z DROP
- D. iptables -j INPUT 192.168.10.50 -p DROP
Correct answer: B
Explanation
The correct command to block the specific IP address is B, which correctly appends a rule to the INPUT chain to drop packets from the specified source IP. Options A, C, and D contain incorrect syntax or target the wrong IP address, making them ineffective for the goal of blocking 192.168.10.50.