summaryrefslogtreecommitdiff
path: root/hosts/kay/modules/dns/ddns.nix
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-01-30 09:40:21 +0530
committersinanmohd <sinan@sinanmohd.com>2024-02-01 11:40:39 +0530
commit1639b9467c64402434d41e426fd9e2f9ba8fdd9a (patch)
tree645321a7175a33f3a1902bc7fd1015d94f3502c9 /hosts/kay/modules/dns/ddns.nix
parent22dd4dd89ad17fa86ec97fab4c2e1106bdbbbcb0 (diff)
kay/dns: init
Diffstat (limited to 'hosts/kay/modules/dns/ddns.nix')
-rw-r--r--hosts/kay/modules/dns/ddns.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/hosts/kay/modules/dns/ddns.nix b/hosts/kay/modules/dns/ddns.nix
new file mode 100644
index 0000000..5b87968
--- /dev/null
+++ b/hosts/kay/modules/dns/ddns.nix
@@ -0,0 +1,39 @@
+{ pkgs, ... }: {
+ services.pppd.script = {
+ "02-ddns-ipv4" = {
+ runtimeInputs = with pkgs; [ coreutils knot-dns ];
+ type = "ip-up";
+
+ text = ''
+ cat <<- EOF | knsupdate
+ server 2001:470:ee65::1
+ zone sinanmohd.com.
+
+ update delete sinanmohd.com. A
+ update add sinanmohd.com. 180 A $4
+
+ send
+ EOF
+ '';
+ };
+
+ "02-ddns-ipv6" = {
+ runtimeInputs = with pkgs; [ coreutils knot-dns iproute2 gnugrep ];
+ type = "ipv6-up";
+
+ text = ''
+ ipv6="$(ip -6 addr show dev $1 scope global | grep -o '[0-9a-f:]*::1')"
+
+ cat <<- EOF | knsupdate
+ server 2001:470:ee65::1
+ zone sinanmohd.com.
+
+ update delete sinanmohd.com. AAAA
+ update add sinanmohd.com. 180 AAAA $ipv6
+
+ send
+ EOF
+ '';
+ };
+ };
+}