summaryrefslogtreecommitdiff
path: root/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers
blob: 4affaeb5c134ca4d893f6315ae3cb1409dbe02c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

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