LFCS Certification Network Service Configuration 2 — Questions and Answers
Question 1: Which command displays the current listening TCP and UDP ports along with the process using each port?
- netstat -tulpn (Correct answer)
- ifconfig -a
- ip route show
- nmap localhost
Correct answer: netstat -tulpn
netstat -tulpn shows TCP/UDP listening ports (-l), process names (-p), and numeric addresses (-n).
Question 2: Which file must you edit to make a custom DNS name resolve locally before querying external DNS servers?
- /etc/resolv.conf
- /etc/hosts (Correct answer)
- /etc/nsswitch.conf
- /etc/hostname
Correct answer: /etc/hosts
/etc/hosts is checked first (by default nsswitch.conf order) and maps hostnames to IPs locally.
Question 3: What is the purpose of the /etc/resolv.conf file?
- Defines static IP routes
- Lists DNS nameserver addresses and search domains (Correct answer)
- Maps MAC addresses to IPs
- Configures firewall rules
Correct answer: Lists DNS nameserver addresses and search domains
/etc/resolv.conf specifies nameserver IPs and optional search/domain directives used by the resolver library.
Question 4: Which systemd unit type is used to expose a service on a network socket, enabling socket activation?
- .service
- .socket (Correct answer)
- .target
- .mount
Correct answer: .socket
systemd .socket units manage socket activation, starting the corresponding service only when a connection arrives.
Question 5: You want to test whether TCP port 443 is open on a remote host without installing extra tools. Which command works on most Linux systems?
- ping -p 443 host
- curl -k https://host
- bash -c 'echo > /dev/tcp/host/443' (Correct answer)
- traceroute --port=443 host
Correct answer: bash -c 'echo > /dev/tcp/host/443'
Bash's built-in /dev/tcp pseudo-device can open a TCP connection without any external tool.
Question 6: Which directive in an SSH server configuration (/etc/ssh/sshd_config) disables password-based logins?
- AllowPasswords no
- PasswordAuthentication no (Correct answer)
- UsePAM no
- PubkeyOnly yes
Correct answer: PasswordAuthentication no
Setting PasswordAuthentication no forces key-based authentication and prevents password logins.
Question 7: Which command reloads the systemd daemon after editing a unit file, without restarting services?
- systemctl restart
- systemctl reload
- systemctl daemon-reload (Correct answer)
- systemctl refresh
Correct answer: systemctl daemon-reload
systemctl daemon-reload re-reads unit files from disk; services keep running until explicitly restarted.
Which command displays the current listening TCP and UDP ports along with the process using each port?