Filtering DNS traffic

DNS is a protocol responsible for resolving names to the IP addresses. In this recipe, we will learn how to filter important parameters that are related to the DNS service.

Getting ready

When suspecting a network problem, port mirror the suspected server or install Wireshark on it, then, start capturing the data.

How to do it...

There are some common filters that will assist you in troubleshooting DNS problems. The common display filters are given as follows:

  • The basic filter is simply for filtering DNS traffic. The filter is dns.
    • For filtering only DNS queries we have dns.flags.response == 0
    • For filtering only DNS responses we have dns.flags.response == 1
    How to do it...
  • For filtering error codes, we have the following filters:
    • No error (rcode—reply code), we have dns.flags.rcode == 0, marked in the following screenshot
    • No such name, we have dns.flags.rcode == 3
    How to do it...
  • For search problems, we have the following filters:
    • When looking for a specific URL: This will be used, for example, when you are not sure whether your PC is sending the DNS query, use dns.qry.name == "URL Name"
    • When looking for a query that contains a specific URL: For this case we have dns.qry.name contains "URL Name"
  • For filtering DNS Opcodes (standard query or other requests or notifications), we have the following filters:
    • For filtering only standard queries: dns.flags.opcode == 0
    • For filtering only inverse queries: dns.flags.opcode == 1
    • For filtering server status requests: dns.flags.opcode == 2
    • For filtering zone change notifications: dns.flags.opcode == 4
    • For filtering dynamic updates: dns.flags.opcode == 5
    How to do it...
  • For querying the query types (recursive/non-recursive):
    • For recursive query we have dns.flags.recdesired == 1
    • For non-recursive query we have dns.flags.recdesired == 0
    How to do it...

All other display filters can be found by clicking on the expression button on the right-hand side of the display filter window at the top of the Wireshark window.

How it works...

Display filters are described in depth in Chapter 3, Using Display Filters. As described in Chapter 3, Using Display Filters, you can do one of the following things to filter DNS parameters:

  • Click on the expression button on the right to the display filter window, and choose the required filter from DNS
  • Go to the packet details, right-click on the required field, and choose Apply a filter or Prepare a filter
  • Simply write the filter string in the filter window at the top of the Wireshark window

There's more...

DNS is quite a complicated protocol, and the purpose of this chapter is to provide methods to resolve common problems with this protocol and implementation. Not all filters are mentioned here; a full list of DNS filters can be found at http://www.wireshark.org/docs/dfref/d/dns.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.184.42