nerdexam
CompTIA

LX0-104 · Question #225

What does the following iptables rule accomplish: iptables A INPUT s 208.77.188.166 d 10.142.232.1 p tcp dport 22 j ACCEPT

The correct answer is C. Forwards all requests from the host 208.77.188.166 on port 22 the internal host 10.142.232.1. This iptables rule, when implemented on a gateway or firewall, allows SSH traffic from a specific external host to be directed to a particular internal host.

Security

Question

What does the following iptables rule accomplish: iptables A INPUT s 208.77.188.166 d 10.142.232.1 p tcp dport 22 j ACCEPT

Options

  • AAccepts traffic on port 22 only from the hosts 208.77.188.166 and 10.142.232.1.
  • BForwards all requests from the host 10.142.232.1 on port 22 the internal host 208.77.188.166
  • CForwards all requests from the host 208.77.188.166 on port 22 the internal host 10.142.232.1
  • DDrops traffic on port 22 only from the hosts 208.77.188.166 and 10.142.232.1.

How the community answered

(22 responses)
  • A
    9% (2)
  • B
    5% (1)
  • C
    86% (19)

Why each option

This iptables rule, when implemented on a gateway or firewall, allows SSH traffic from a specific external host to be directed to a particular internal host.

AAccepts traffic on port 22 only from the hosts 208.77.188.166 and 10.142.232.1.

The rule specifies traffic from `208.77.188.166` to `10.142.232.1`, not from both hosts.

BForwards all requests from the host 10.142.232.1 on port 22 the internal host 208.77.188.166

This option reverses the source and destination IP addresses specified in the rule.

CForwards all requests from the host 208.77.188.166 on port 22 the internal host 10.142.232.1Correct

Although the `INPUT` chain is primarily for traffic destined for the firewall itself, in a network context where the firewall performs NAT (Network Address Translation), this rule is intended to allow SSH (port 22, TCP) connections originating from the external host `208.77.188.166` to be forwarded to the internal host `10.142.232.1`.

DDrops traffic on port 22 only from the hosts 208.77.188.166 and 10.142.232.1.

The `-j ACCEPT` target explicitly means to allow the traffic, not to drop it.

Concept tested: Iptables rule interpretation for NAT/forwarding

Source: https://man7.org/linux/man-pages/man8/iptables.8.html

Topics

#iptables rules#packet filtering#TCP port#ACCEPT action

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice