nerdexam
CompTIA

SK0-004 · Question #225

A network administrator is tasked to block all outbound SSH connections on the default port from a network subnet of 10.152.8.0/21 on a Linux based firewall. Which of the following rule sets would…

The correct answer is A. iptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 22 -j REJECT. Blocking outbound SSH requires targeting the OUTPUT chain, destination subnet, TCP port 22, with a REJECT action. Only option A correctly combines all four of these elements.

Security and disaster recovery

Question

A network administrator is tasked to block all outbound SSH connections on the default port from a network subnet of 10.152.8.0/21 on a Linux based firewall. Which of the following rule sets would accomplish this task?

Options

  • Aiptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 22 -j REJECT
  • Biptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 23 -j REJECT
  • Ciptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 22 -j ACCEPT
  • Diptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 23 -j ACCEPT

How the community answered

(34 responses)
  • A
    82% (28)
  • B
    9% (3)
  • C
    6% (2)
  • D
    3% (1)

Why each option

Blocking outbound SSH requires targeting the OUTPUT chain, destination subnet, TCP port 22, with a REJECT action. Only option A correctly combines all four of these elements.

Aiptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 22 -j REJECTCorrect

This rule correctly targets the OUTPUT chain (for outbound traffic), specifies the destination subnet 10.152.8.0/21, uses TCP protocol on port 22 (the default SSH port), and applies the REJECT action to actively block and notify the sender. Together these parameters precisely match the stated requirement to block outbound SSH from that subnet.

Biptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 23 -j REJECT

Port 23 is the default port for Telnet, not SSH, so this rule would block outbound Telnet rather than SSH connections.

Ciptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 22 -j ACCEPT

Using the ACCEPT target allows traffic through instead of blocking it, which is the opposite of the stated goal.

Diptables -i OUTPUT -d 10.152.8.0/21 -p TCP --dport 23 -j ACCEPT

This rule uses the wrong port (23 - Telnet) and the ACCEPT target, so it neither targets SSH nor blocks any traffic.

Concept tested: Linux iptables rules for blocking outbound SSH

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

Topics

#iptables#firewall rules#SSH#network security

Community Discussion

No community discussion yet for this question.

Full SK0-004 Practice