Last active
March 16, 2016 11:27
-
-
Save sirkkalap/510f03bce31f92963182 to your computer and use it in GitHub Desktop.
Sometimes DNS answers change unexpectedly. This shell script will try to log DNS answers. You may change the DNS-server IP addresses on lines 4 and 5.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true; do | |
echo $(date +%FT%T%z) $(dig +noall +answer +stats ftp.example.com | tr '\n' ' ') | |
echo $(date +%FT%T%z) $(nslookup ftp.example.com 10.1.2.3 | tr '\n' ' ') | |
echo $(date +%FT%T%z) $(nslookup ftp.example.com 10.2.4.6 | tr '\n' ' ') | |
sleep 60 | |
done | |
#[sirkkalap@mymachine ~]$ nohup ./test_dns.sh & | |
#[1] 16406 | |
#[sirkkalap@mymachine ~]$ tail nohup.out | |
#2016-03-16T10:40:27+0200 ftp.example.com. 32 IN A 10.0.0.1 ;; Query time: 2 msec ;; SERVER: 10.1.2.3#53(10.1.2.3) ;; WHEN: Wed Mar 16 10:40:27 2016 ;; MSG SIZE rcvd: 52 | |
#2016-03-16T10:40:27+0200 Server: 10.1.2.3 Address: 10.1.2.3#53 Non-authoritative answer: Name: ftp.example.com Address: 10.0.0.1 | |
#2016-03-16T10:40:27+0200 Server: 10.2.4.6 Address: 10.2.4.6#53 Non-authoritative answer: Name: ftp.example.com Address: 10.0.0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment