22

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)?

2 Answers 2

8

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.

3
  • 2
    Great answer, thanks. :) Good old NirSoft, could have guessed it. Is there any tool that Nir does not provide? ;) Commented Jul 23, 2016 at 10:20
  • 1
    In Solution 1, instead of using environment variables, it's possible to navigate to about:networking :) Commented Mar 14, 2022 at 15:43
  • 1
    To add to Solution 1: You can now set nsHostResolver:5 in about:logging. Additionally, for Firefox Developer Edition, there is also a new option to send the logs directly to the Firefox Profiler: Just select "Logging to the Firefox Profiler". Click "Start Logging" & when done, "Stop Logging". Finally, the profiler also has a "Networking" preset if you launch it manually with the Start Profiler button. Inside profiler, right click on left & check "DNS Resolver #N" Tracks. Search for "nsHostResolver" in the call tree. Commented Aug 22, 2024 at 20:45
8

You can right click on the column header and enable Remote IP to see what address was used for each entry in the Network tab

firefox dev tools dns lookup response remote ip column

3
  • Cool, but this shows the IP, not the DNS server. Commented Sep 11, 2021 at 17:47
  • I'm afraid the question was about how the ip was resolved, with which nameservers, and gather more detail of this. Commented Aug 28, 2024 at 23:38
  • This is 'useful' in the sunny-day case only. Remote IP "unknown" points to the need for more debug in the cloudy-day case: how do I know why it ended up unknown? This question is looking for more than this. Commented Feb 6 at 15:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.