[dns] Using dig to search for SPF records

I am using dig installed on my machine to search for SPF records for a particular domain. Is there a way to search a particular DNS server for the SPF records?

For example, will the following work?

dig domain.com txt host ns1.nameserver1.com

dig domain.com txt host ns2.nameserver2.com

This question is related to dns dig

The answer is


The dig utility is pretty convenient to use. The order of the arguments don't really matter.I'll show you some easy examples.
To get all root name servers use

# dig

To get a TXT record of a specific host use

# dig example.com txt
# dig host.example.com txt

To query a specific name server just add @nameserver.tld

# dig host.example.com txt @a.iana-servers.net

The SPF RFC4408 says that SPF records can be stored as SPF or TXT. However nearly all use only TXT records at the moment. So you are pretty safe if you only fetch TXT records.

I made a SPF checker for visualising the SPF records of a domain. It might help you to understand SPF records better. You can find it here: http://spf.myisp.ch