201-450 practice question 11 of 25

Which /etc/hosts.allow entries will permit access to sshd for users from the 192.168.1.0/24 subnet? (Choose TWO correct answers.)

Full set: 161 questions
Answer options
A: sshd : 192.168.1. Correct answer
B: sshd : 192.168.1
C: sshd : 192.168.1.0 netmask 255.255.255.0
D: sshd : 192.168.1.0/255.255.255.0 Correct answer
E: sshd : 192.168.1.0
Correct Answer:
A. sshd : 192.168.1.; D. sshd : 192.168.1.0/255.255.255.0
Explanation

The /etc/hosts.allow file uses specific syntax to define access rules for TCP Wrappers. To permit an entire subnet, two common formats are valid. The first is the network address followed by a trailing dot (e.g., 192.168.1.), which acts as a wildcard for the remaining part of the IP address. The second valid format is the network/netmask pair (e.g., 192.168.1.0/255.255.255.0), which explicitly defines the network range. Both of these formats correctly represent the 192.168.1.0/24 subnet.

Why Incorrect

B. sshd : 192.168.1 without a trailing dot would match a hostname, not a network prefix.
C. The netmask keyword is not a valid syntax for the hosts.allow file; the slash notation is used instead.
E. sshd : 192.168.1.0 would only match the single host with that specific IP address, not the entire subnet.

References

1. hostsaccess(5) Linux manual page. Section "PATTERNS". It states: "A string that ends with a . character. A host address is matched if its first numeric fields match the given string." and "An expression of the form n.n.n.n/m.m.m.m is interpreted as a net/mask pair."

2. Red Hat Enterprise Linux 7 System Administrator's Guide, Chapter 15.5. "TCP Wrappers Configuration Files". Section 15.5.2 "Access Rules". This section provides examples confirming the 192.168.0. and 10.0.0.0/255.255.255.0 formats.

Scroll to Top