ungleich-tools/dns-generate-for-device.sh
2024-08-15 13:41:14 +02:00

18 lines
434 B
Bash
Executable file

#!/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}"