Sponsored Content
Full Discussion: DNS circular verify script
Top Forums Shell Programming and Scripting DNS circular verify script Post 302800815 by snoman1 on Tuesday 30th of April 2013 02:41:21 PM
Old 04-30-2013
DNS circular verify script

I have modified a script to do a circular DNS look up.

The theory is this
for a given subnet build a range if IP's
do a reverse look up on those IP's
take the output of the reverse look up then and do a forward look up
If the returns match up give a good status
If not return a fail status.

It runs really nice except when it runs into multi-homed IP's.
I am now trying to script in to check if the reverse lookup returns more than one entry, and if so then do a look up on any returns.

Any ideas?

Code:
#!/bin/bash
# Update NETS as needed
#
NETS="00.000.000"
echo
echo "STATE   ADDRESS -------> NAME -------------------> ADDRESS"
echo '-------------------------------------------------------------------'
for NET in $NETS; do
  for n in $(seq 1 254); do
    A=${NET}.${n}                    # builds the range of the subnet
    HOST=$(dig -x $A +short)         # reverse lookup
    if test -n "$HOST"; then         # If string has nonzero length then continue

      for MULTI in `dig +short  -x $HOST`; do
      ADDR=$(dig $HOST +short)       # Now do forward lookup
 done
      if test "$A" = "$ADDR"; then   # if host = IP, then mark it as OK
        echo -e "ok\t$A -> $HOST -> $ADDR"
      elif test -n "$ADDR"; then
        echo -e "fail\t$A -> $HOST -> $ADDR"
      else
        echo -e "fail\t$A -> $HOST -> [unassigned]"
      fi
    fi
  done
done
echo DONE
exit 0

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Circular reference

I might know the answer to this, but I just want to see if any of you know any work arounds before I go and re-write the whole thing. I have a script as follow: $ cat testing #! /usr/bin/ksh f () { echo "Type \"y\" \c" read value if ; then ... (1 Reply)
Discussion started by: fidodido
1 Replies

2. Shell Programming and Scripting

Script to verify SSH is running

Writing a simple test script that looks for ssh, kills if its running and verifies if its still running. If it isn't, move on. My issue, its cause I don't know how, is to verify if ssh is running still. Also, is there a way have this do this on a remote server? I already have the ssh keys... (7 Replies)
Discussion started by: djinn
7 Replies

3. Shell Programming and Scripting

Help needed with script to verify the version of BIND

I have tried thought of using instfix -ivqc | grep BIND , but this did not return the result I was looking for; it seem to list out the the different patches that had been applied to BIND. I'm actually looking for overall version, like you'd get when checking the OS level for instance. (1 Reply)
Discussion started by: sport
1 Replies

4. UNIX for Dummies Questions & Answers

Verify a flat file with UNIX function or script.

I re-post my question to seek your help and critique. I was required to verify a very large and tab-delimited file, named 'MyFile'. 1. The each line in 'MyFile' has 7 columns, and that the values in the 5th column are integers. I need to use shell functions (and standard LINUX/UNIX filters) to... (1 Reply)
Discussion started by: duke0001
1 Replies

5. Shell Programming and Scripting

script to verify backup is succesfull or not

tail -30 /opt/oracle/rmanbkup/log/db_backup_JONDB.log input datafile fno=00005 name=+ORA_DATA/jondb/datafile/users.264.696728295 input datafile fno=00003 name=+ORA_DATA/jondb/datafile/sysaux.261.696728281 input datafile fno=00001 name=+ORA_DATA/jondb/datafile/system.259.696728257 input datafile... (6 Replies)
Discussion started by: arch12
6 Replies

6. UNIX for Advanced & Expert Users

Verify file was sftp'd via bash script

Hello Experts, I have a script that that transfers a file (via sftp) and it works fine but we ran into a snag where the target server asked for the ssh key and the script didn't know what to do. I want to add some logic to this script that at least sends an email that it didn't complete as... (4 Replies)
Discussion started by: Tiberius777
4 Replies

7. UNIX for Advanced & Expert Users

Script to verify veritas mirror

Hi Experts, I have lot of Solaris servers and in most of them, root disk is mirrored in rootdg. I just want to check all servers, if there is any server whose root disk is not mirrored. Either it may be with detached plexes or not mirrored at all. I can run a for loop for all servers. Can... (4 Replies)
Discussion started by: solaris_1977
4 Replies

8. Shell Programming and Scripting

Perl script to verify that a value is present in an array (list)

I have 2 files , i need compare both files field by field, and in the fourth field some value will be interchaged and some value will be **. ex: file1 john|0.0|4|**:25;JP:50;UY:25 file2 john|0.0|4|JP:50;**:25;UY:25 (4 Replies)
Discussion started by: veeruasu
4 Replies

9. Shell Programming and Scripting

Shell script verify connection to Oracle if not successful

i have a script that connects to the oracle database and executes the query statements. it works fine and i would like to add some message to check if the connection to oracle is not successful. basically this is the code snippet: #!/bin/sh ... ... ... sqlplus -s username/password@dbName... (2 Replies)
Discussion started by: wtolentino
2 Replies

10. UNIX for Beginners Questions & Answers

Script that verify output after make

Hi I write below script to show if expected file exist in /etc/library/ , print success else failed. But it will print full path I just need to print module name in output. And if it possible show time that spent to compile each module. FYI 1: First run another script just go to the paths... (1 Reply)
Discussion started by: indeed_1
1 Replies
IFCONFIG(1)							   User Commands						       IFCONFIG(1)

NAME
ifconfig - configure network interfaces SYNOPSIS
ifconfig [OPTION...] DESCRIPTION
NAME [ADDR] [broadcast BRDADDR] [pointopoint|dstaddr DSTADDR] [netmask MASK] [metric N] [mtu N] [txqueuelen N] [up|down] [FLAGS] Configure network interfaces. -a, --all display all available interfaces -A, --address=ADDR set interface address to ADDR -B, -b, --broadcast=ADDR, --brdaddr=ADDR set broadcast address to ADDR -d, -p, --dstaddr=ADDR, --peer=ADDR set destination (peer) address to ADDR --down shut the interface down --format=FORMAT select output format (or set back to default) -F, --flags=FLAG[,FLAG...] set interface flags -i, --interface=NAME configure network interface NAME -m, --netmask=MASK set netmask to MASK --metric=N set metric of interface to N -M, --mtu=N set mtu of interface to N -s, --short short output format --up activate the interface (default if address is given) -v, --verbose output information when configuring interface Linux-specific options -T, --txqlen=N set transmit queue length to N -?, --help give this help list --usage give a short usage message -V, --version print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. Known flags are: allmulti, automedia, debug, loopback, multicast, portsel, running, trailers, up AUTHOR
Written by Marcus Brinkmann. REPORTING BUGS
Report bugs to <bug-inetutils@gnu.org>. COPYRIGHT
Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for ifconfig is maintained as a Texinfo manual. If the info and ifconfig programs are properly installed at your site, the command info ifconfig should give you access to the complete manual. GNU inetutils 1.9 December 2011 IFCONFIG(1)
All times are GMT -4. The time now is 11:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy