Difference between revisions of "BIND"

From TBP Wiki
Jump to: navigation, search
(Dig)
(Dig)
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
 
dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried.
 
dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried.
  
<strong>Using Dig</strong>
+
Using Dig
 
     dig tbpchan.cz
 
     dig tbpchan.cz
  
<strong>Dig all domains within named configs if named/BIND is installed:</strong>
+
Dig all domains within named configs if named/BIND is installed:
 
     for i in `ls /var/named | cut -f1-2 -d'.' | grep ".com\|.net\|.org\|.net\|.us\|.biz"`; do echo "$i :  " |tr -d '\n';dig "$i" +short; done
 
     for i in `ls /var/named | cut -f1-2 -d'.' | grep ".com\|.net\|.org\|.net\|.us\|.biz"`; do echo "$i :  " |tr -d '\n';dig "$i" +short; done
  
<strong>Update the SOA serial for all domains</strong>
+
Update the SOA serial for all domains
  
 
     newSerial="20$(date +"%y%m%d")01"; for domain in `/bin/ls -1 /var/named/ | grep ".db"`; do echo -n $domain" "; egrep -io "[0-9]{10}.*serial" /var/named/$domain | awk '{print $1}'; done | awk -v newSerial=$newSerial '{ if ( $2 < newSerial ) print $0}' > /var/named/UPDATE_DNS; \ OLDIFS=$IFS; IFS=$'\n'; for zone in `cat /var/named/UPDATE_DNS`; do zoneFile=$(echo $zone | awk '{print $1}'); oldSerial=$(echo $zone | awk '{print $2}'); replace $oldSerial $newSerial -- /var/named/$zoneFile; done; IFS=$OLDIFS; rm -rv /var/named/UPDATE_DNS
 
     newSerial="20$(date +"%y%m%d")01"; for domain in `/bin/ls -1 /var/named/ | grep ".db"`; do echo -n $domain" "; egrep -io "[0-9]{10}.*serial" /var/named/$domain | awk '{print $1}'; done | awk -v newSerial=$newSerial '{ if ( $2 < newSerial ) print $0}' > /var/named/UPDATE_DNS; \ OLDIFS=$IFS; IFS=$'\n'; for zone in `cat /var/named/UPDATE_DNS`; do zoneFile=$(echo $zone | awk '{print $1}'); oldSerial=$(echo $zone | awk '{print $2}'); replace $oldSerial $newSerial -- /var/named/$zoneFile; done; IFS=$OLDIFS; rm -rv /var/named/UPDATE_DNS
  
<strong>Makes an advertisement block list from 'ORIGINALFILE'</strong>
+
Makes an advertisement block list from ORIGINALFILE
  
     sed '/#/d' ORIGINALFILE >> testfile && sed '/zone/d' ./testfile >> testfile1 && sed 's/^/zone/' testfile1 > testfile2 && sed 's/zone /zone "/' testfile2 > testfile3 && sed 's/$/" { type master; notify no; file /' testfile3 > testfile4 && sed 's/file /file "/' testfile4 > testfile5 && awk '{print $0"/etc/bind/blocked.zone"}' testfile5 > testfile6 && sed 's/.zone/.zone"; };/' testfile6 > finalhosts1.txt && rm -rf testfile*
+
     sed '/#/d' ORIGINALFILE >> testfile && sed '/zone/d' ./testfile >> testfile1 && sed 's/^/zone/' testfile1 > testfile2 && sed 's/zone/zone "/' testfile2 > testfile3 && sed 's/$/" { type master; notify no; file /' testfile3 > testfile4 && sed 's/file /file "/' testfile4 > testfile5 && awk '{print $0"/etc/bind/blocked.zone"}' testfile5 > testfile6 && sed 's/.zone/.zone"; };/' testfile6 > finalhosts1.txt && rm -rf testfile*

Latest revision as of 10:39, 17 April 2019

BIND (/ˈbaɪnd/), or named (pronounced name-dee, short for name daemon: /ˈneɪmdiː/), is the most widely used Domain Name System (DNS) software on the Internet. On Unix-like operating systems it is the de facto standard. It performs both of the main DNS server roles - acting as an authoritative name server for one or more specific domains, and acting as a recursive resolver for the DNS system generally.

The software was originally designed at the University of California, Berkeley (UCB) in the early 1980s. The name originates as an acronym of Berkeley Internet Name Domain, reflecting the application's use within UCB. The software consists, most prominently, of the DNS server component, called named, a contracted form of name daemon. In addition the suite contains various administration tools, and a DNS resolver interface library. The latest version of BIND is BIND 9, first released in 2000. BIND 9 is actively maintained, with new releases issued several times a year.

Starting in 2009, the Internet Software Consortium (ISC) developed a new software suite, initially called BIND10. With release version 1.2.0 the project was renamed Bundy to terminate ISC involvement in the project.

Dig

dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried.

Using Dig

   dig tbpchan.cz

Dig all domains within named configs if named/BIND is installed:

   for i in `ls /var/named | cut -f1-2 -d'.' | grep ".com\|.net\|.org\|.net\|.us\|.biz"`; do echo "$i :   " |tr -d '\n';dig "$i" +short; done

Update the SOA serial for all domains

   newSerial="20$(date +"%y%m%d")01"; for domain in `/bin/ls -1 /var/named/ | grep ".db"`; do echo -n $domain" "; egrep -io "[0-9]{10}.*serial" /var/named/$domain | awk '{print $1}'; done | awk -v newSerial=$newSerial '{ if ( $2 < newSerial ) print $0}' > /var/named/UPDATE_DNS; \ OLDIFS=$IFS; IFS=$'\n'; for zone in `cat /var/named/UPDATE_DNS`; do zoneFile=$(echo $zone | awk '{print $1}'); oldSerial=$(echo $zone | awk '{print $2}'); replace $oldSerial $newSerial -- /var/named/$zoneFile; done; IFS=$OLDIFS; rm -rv /var/named/UPDATE_DNS

Makes an advertisement block list from ORIGINALFILE

   sed '/#/d' ORIGINALFILE >> testfile && sed '/zone/d' ./testfile >> testfile1 && sed 's/^/zone/' testfile1 > testfile2 && sed 's/zone/zone "/' testfile2 > testfile3 && sed 's/$/" { type master; notify no; file /' testfile3 > testfile4 && sed 's/file /file "/' testfile4 > testfile5 && awk '{print $0"/etc/bind/blocked.zone"}' testfile5 > testfile6 && sed 's/.zone/.zone"; };/' testfile6 > finalhosts1.txt && rm -rf testfile*