Is it possible to see the DNS resolving query in Firefox developer tools?

8

3

Using the developer tools in Firefox one can see detailed information about requests to and responses from the webserver (HTTP header and content, timing information, status codes and so on).

I wonder if there's a possibility to also see similar request loggings for the DNS resolving somewhere that are done before the HTTP protocol even takes over? Or is this handled outside the browser (by some operating system component for example)?

Foo Bar

Posted 2016-07-23T09:17:46.030

Reputation: 1 270

Answers

3

Is there's a possibility to also see similar request logging for DNS resolution?

Not using the developer tools.

However, see later in this answer for instructions on how to enable HTTP logging (which includes DNS query logging).

The only information you can get from the developer tools is the "Time taken to resolve a host name." which is in the "Timings" tab.

Timings

The Timings tab breaks a network request down into the following subset of the stages defined in the HTTP Archive specification:

Name              Description
DNS resolution    Time taken to resolve a host name.
Connecting        Time taken to create a TCP connection.
Sending           Time taken to send the HTTP request to the server.
Waiting           Waiting for a response from the server.
Receiving         Time taken to read the entire response from the server (or cache).

It presents a more detailed, annotated, view of the timeline bar for that request showing how the total wait time is split into the various stages:

enter image description here

Source Network Monitor


How can I log DNS requests?

Solution 1:

Enable HTTP Logging in Firefox. The key bit that enables DNS logging is nsHostResolver:5:

Logging HTTP activity

Windows commands to begin HTTP logging (32-bit Windows):

cd c:\
set NSPR_LOG_MODULES=timestamp,nsHttp:5,nsSocketTransport:5,nsStreamPump:5,nsHostResolver:5
set NSPR_LOG_FILE=%TEMP%\log.txt
cd "Program Files\Mozilla Firefox"
.\firefox.exe

Windows commands to begin HTTP logging (64-bit Windows):

cd c:\
set NSPR_LOG_MODULES=timestamp,nsHttp:5,nsSocketTransport:5,nsStreamPump:5,nsHostResolver:5
set NSPR_LOG_FILE=%TEMP%\log.txt
cd "Program Files (x86)\Mozilla Firefox"
.\firefox.exe

Source HTTP Logging

Solution 2:

Use DNSQuerySniffer from NirSoft:

DNSQuerySniffer is a network sniffer utility that shows the DNS queries sent on your system.

For every DNS query, the following information is displayed: Host Name, Port Number, Query ID, Request Type (A, AAAA, NS, MX, and so on), Request Time, Response Time, Duration, Response Code, Number of records, and the content of the returned DNS records.

You can easily export the DNS queries information to csv/tab-delimited/xml/html file, or copy the DNS queries to the clipboard, and then paste them into Excel or other spreadsheet application.

enter image description here


Disclaimer

I am not affiliated with NirSoft in any way, I am just an end user of their software.

DavidPostill

Posted 2016-07-23T09:17:46.030

Reputation: 118 938

1Great answer, thanks. :) Good old NirSoft, could have guessed it. Is there any tool that Nir does not provide? ;) – Foo Bar – 2016-07-23T10:20:47.607