Last active
December 14, 2015 01:28
-
-
Save codingtony/5006130 to your computer and use it in GitHub Desktop.
Little bash script to quickly add lookup and reverse lookup to dnsmasq.
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 -e | |
# USAGE : | |
# $0 IP NAME DOMAIN | |
if [ "$#" != "3" ] | |
then | |
echo "Usage:" | |
echo $0 IP HOSTNAME DOMAIN | |
exit 1 | |
fi | |
IFS=. | |
IP="${1}" | |
NAME="${2}" | |
DOMAIN="${3}" | |
read A1 A2 A3 A4 <<< "${IP}" | |
echo "address=/${NAME}/${NAME}.${DOMAIN}/${IP}" | |
echo "ptr-record=${A4}.${A3}.${A2}.${A1}.in-addr.arpa,\"${NAME}.${DOMAIN}\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment