nerdexam
CompTIA

XK0-005 · Question #297

A Linux administrator is checking connectivity between two servers in separate subnets: Server A: 10.1.2.20 (source) Server B: 10.2.1.10 (destination on port 8080) The administrator tried to run the…

The correct answer is D. nmap -v -p 8080 10.2.1.10. To diagnose a "Connection refused" error on a specific port, running nmap on the target server against its own IP address for that port will successfully determine if a service is listening.

Troubleshooting

Question

A Linux administrator is checking connectivity between two servers in separate subnets: Server A: 10.1.2.20 (source) Server B: 10.2.1.10 (destination on port 8080) The administrator tried to run the command on server A and received curl 10.2.1.10:8080 the following output: curl: (7) Failed to connect to 10.2.1.10 port 8080: Connection refused. The administrator checked on server B and confirmed nothing is listening on port 8080. Which of the following commands, when run on server B, would have allowed the administrator to test the connection successfully?

Options

  • Atcpdump 'tcp port 8080'
  • Bss -l -p dport=8080 dst 10.2.1.10
  • Cnc -l -p 8080 10.2.1.10
  • Dnmap -v -p 8080 10.2.1.10

How the community answered

(61 responses)
  • A
    3% (2)
  • B
    7% (4)
  • C
    18% (11)
  • D
    72% (44)

Why each option

To diagnose a "Connection refused" error on a specific port, running `nmap` on the target server against its own IP address for that port will successfully determine if a service is listening.

Atcpdump 'tcp port 8080'

`tcpdump` captures network traffic but does not actively test or confirm the listening status of a port; it would only show the refused connection packets.

Bss -l -p dport=8080 dst 10.2.1.10

`ss -l -p dport=8080 dst 10.2.1.10` is not a valid way to check for listening services; `ss -l` lists all listening sockets, and filtering by `dport` or `dst` does not apply to a listening socket expecting incoming connections.

Cnc -l -p 8080 10.2.1.10

`nc -l -p 8080 10.2.1.10` would cause `netcat` to listen on port 8080, which would then allow the `curl` command from Server A to successfully connect, but it doesn't diagnose the original 'Connection refused' problem which was due to nothing listening.

Dnmap -v -p 8080 10.2.1.10Correct

The `nmap` command is a powerful network scanning tool that can determine the status of ports on a target host. Running `nmap -v -p 8080 10.2.1.10` on Server B (targeting itself on port 8080) would successfully scan the port and report its state, confirming that nothing is listening, which explains the 'Connection refused' error received by `curl` from Server A. This provides a successful diagnostic test.

Concept tested: Diagnosing port connectivity with nmap

Source: https://man7.org/linux/man-pages/man1/nmap.1.html

Topics

#Network Troubleshooting#Port Scanning#nmap#Network Utilities

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice