Add script to generate dns entries from interface addresses
This commit is contained in:
parent
26a5b6e476
commit
9aaa640a8b
1 changed files with 18 additions and 0 deletions
18
dns-generate-for-device.sh
Normal file
18
dns-generate-for-device.sh
Normal 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}"
|
Loading…
Reference in a new issue