Add script to generate dns entries from interface addresses

This commit is contained in:
Nico Schottelius 2024-08-15 13:39:44 +02:00
parent 26a5b6e476
commit 9aaa640a8b

View file

@ -0,0 +1,18 @@
#!/bin/sh
# Nico Schottelius, 2024-08-14
#
# Retrieve an IPv6 interface address and generate a generic
# DNS zone file
if [ #$ -ne 3 ]; then
echo "$0 address interface hostname"
exit 1
fi
address=$1; shift
interface=$1; shift
hostname=$1; shift
interface_addr=$(ssh "root@${address}" "ip -o a sh dev ${interface}" | awk '/inet6/ { print $4 }' | grep -v ^fe80| sed 's,/.*,,')
echo "${hostname} AAAA ${interface_addr}"