summaryrefslogtreecommitdiff
path: root/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-11-14 07:00:30 +0100
committerGitHub <noreply@github.com>2022-11-14 07:00:30 +0100
commit92b828154497c534ce82af16320ed34f0c15e51c (patch)
tree4fb0e69e87e37cca30451af6c06a83944486c2ad /src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers
parent61574eaf2d703e8084c8272e6976fd44abaea482 (diff)
parent00ec496877453cc37ceec0633821a47f128d9f4f (diff)
downloadvyos-1x-92b828154497c534ce82af16320ed34f0c15e51c.tar.gz
vyos-1x-92b828154497c534ce82af16320ed34f0c15e51c.zip
Merge pull request #1656 from vfreex/fix-ns-config
T4815: Fix various name server config issues
Diffstat (limited to 'src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers')
-rw-r--r--src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers b/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers
new file mode 100644
index 000000000..0fcedbedc
--- /dev/null
+++ b/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers
@@ -0,0 +1,24 @@
+#!/bin/bash
+### Autogenerated by interfaces-pppoe.py ###
+
+interface=$6
+if [ -z "$interface" ]; then
+ exit
+fi
+
+if ! /usr/bin/systemctl -q is-active vyos-hostsd; then
+ exit # vyos-hostsd is not running
+fi
+
+hostsd_client="/usr/bin/vyos-hostsd-client"
+
+$hostsd_client --delete-name-servers --tag "dhcp-$interface"
+
+if [ "$USEPEERDNS" ] && [ -n "$DNS1" ]; then
+$hostsd_client --add-name-servers "$DNS1" --tag "dhcp-$interface"
+fi
+if [ "$USEPEERDNS" ] && [ -n "$DNS2" ]; then
+$hostsd_client --add-name-servers "$DNS2" --tag "dhcp-$interface"
+fi
+
+$hostsd_client --apply