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.
Question
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)- A3% (2)
- B7% (4)
- C18% (11)
- D72% (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.
`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.
`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.
`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.
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
Community Discussion
No community discussion yet for this question.