Skip to content

Instantly share code, notes, and snippets.

@codingtony
Last active December 14, 2015 01:28
Show Gist options
  • Save codingtony/5006130 to your computer and use it in GitHub Desktop.
Save codingtony/5006130 to your computer and use it in GitHub Desktop.
Little bash script to quickly add lookup and reverse lookup to dnsmasq.
#!/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