Portqry is a command-line utility that you can use to help troubleshoot TCP/IP connectivity issues, which you can run on Windows 2000 and Windows XP. The utility reports the port status of target Transition Control Protocol (TCP) and User Datagram Protocol (UDP) ports on a remote computer.
You can also use Portqry in the following ways:
- To troubleshoot Active Directory issues in which you have to verify basic TCP/IP connectivity, which can be especially useful in environments with firewalls.
- To verify connectivity to TCP/IP ports that are used by Active Directory for Lightweight Directory Access Protocol (LDAP), remote procedure call (RPC), and Domain Name Service (DNS).
Portqry reports the status of a port in one of three ways:
- Listening: A process is listening on the target port on the target system. Portqry received a response from the port.
- Not Listening: No process is listening on the target port on the target system. Portqry received an Internet Control Message Protocol (ICMP) “Destination Unreachable – Port Unreachable” message back from the target UDP port. Or, if the target port is a TCP port, Portqry received a TCP acknowledgement packet with theÂ Reset flag set.
- Filtered: The target port on the target system is being filtered. Portqry did not receive a response from the target port. A process may or may not be listening on the port. By default, TCP ports are queried three times and UDP ports are queried once before reporting the target port is filtered.
With Portqry, you can also query an LDAP service. It knows how to send an LDAP query (by using UDP and TCP) and interpret an LDAP server’s response to the query. The response from the LDAP server is parsed, formatted and returned to the user.
When you run the following command:portqry -n myserver -p udp -e 389Portqry automatically resolves UDP port 389 using the %SystemRoot%\System32\Drivers\…\Services file that every Windows 2000 and Windows XP system has by default. If it resolves the port to the LDAP service, it sends an unformatted user datagram to UDP port 389 on the target system. Portqry will not receive a response from the port as the LDAP service only responds to a properly formatted LDAP query. Portqry will report that the port is listening or filtered. Portqry will then send a properly formatted LDAP query to UDP port 389. If it receives a response to the query, it returns the entire response to the user and report that the port is listening. If portqry does not receive a response to the query, it reports that the port is filtered.
C:\>portqry -n mydc.reskit.com -e 389 -p udp Querying target system called: mydc.reskit.com Attempting to resolve name to IP address... Name resolved to 169.254.0.14 UDP port 389 (unknown service): LISTENING or FILTERED Sending LDAP query to UDP port 389... LDAP query response: currentdate: 10/11/2001 23:10:21 (unadjusted GMT) subschemaSubentry: CN=Aggregate,CN=Schema,CN=Configuration,DC=reskit,DC=com dsServiceName: CN=NTDS Settings,CN=mydc,CN=Servers,CN=eu,CN=Sites,CN =Configuration,DC=reskit,DC=com namingContexts: DC=reskit,DC=com defaultNamingContext: DC=reskit,DC=com schemaNamingContext: CN=Schema,CN=Configuration,DC=reskit,DC=com configurationNamingContext: CN=Configuration,DC=reskit,DC=com rootDomainNamingContext: DC=reskit,DC=com supportedControl: 1.2.840.113518.104.22.1689 supportedLDAPVersion: 3 supportedLDAPPolicies: MaxPoolThreads highestCommittedUSN: 815431405 supportedSASLMechanisms: GSSAPI dnsHostName: MYDC.reskit.com ldapServiceName: reskit.com:mydc$@RESKIT.COM serverName: CN=MYDC,CN=Servers,CN=EU,CN=Sites,CN=Configuration,DC=reskit,DC=com supportedCapabilities: 1.2.840.113522.214.171.1240 isSynchronized: TRUE isGlobalCatalogReady: TRUE ======== End of LDAP query response ======== UDP port 389 is LISTENING
In this sample, port 389 is listening and from the output it can be determined which LDAP service is listening on the port and some details about its configuration. This information may also be useful in troubleshooting various problems.