diff --git a/data/templates/pppoe/ip-down.script.tmpl b/data/templates/pppoe/ip-down.script.tmpl
index bac4155d6..c1d1132b3 100644
--- a/data/templates/pppoe/ip-down.script.tmpl
+++ b/data/templates/pppoe/ip-down.script.tmpl
@@ -1,38 +1,38 @@
 #!/bin/sh
 
 # As PPPoE is an "on demand" interface we need to re-configure it when it
 # becomes up
 if [ "$6" != "{{ ifname }}" ]; then
     exit
 fi
 
 # add some info to syslog
 DIALER_PID=$(cat /var/run/{{ ifname }}.pid)
 logger -t pppd[$DIALER_PID] "executing $0"
 
 {% if connect_on_demand is not defined %}
 # See https://phabricator.vyos.net/T2248. Determine if we are enslaved to a
 # VRF, this is needed to properly insert the default route.
 VRF_NAME=""
 if [ -d /sys/class/net/{{ ifname }}/upper_* ]; then
     # Determine upper (VRF) interface
     VRF=$(basename $(ls -d /sys/class/net/{{ ifname }}/upper_*))
     # Remove upper_ prefix from result string
     VRF=${VRF#"upper_"}
     # Populate variable to run in VR context
     VRF_NAME="vrf ${VRF_NAME}"
 fi
 
 {%   if default_route != 'none' %}
 # Always delete default route when interface goes down if we installed it
 vtysh -c "conf t" ${VRF_NAME} -c "no ip route 0.0.0.0/0 {{ ifname }} ${VRF_NAME}"
 {%      if ipv6 is defined and ipv6.address is defined and ipv6.address.autoconf is defined %}
 vtysh -c "conf t" ${VRF_NAME} -c "no ipv6 route ::/0 {{ ifname }} ${VRF_NAME}"
 {%      endif %}
 {%   endif %}
 {% endif %}
 
 {% if dhcpv6_options is defined and dhcpv6_options.pd is defined %}
-# Stop wide dhcpv6 client
-systemctl stop dhcp6c@{{ ifname }}.service
+# Stop wide dhcpv6 client without blocking (by default the ip-down script can only run up to 5 seconds)
+systemctl stop --no-block dhcp6c@{{ ifname }}.service
 {% endif %}
diff --git a/debian/vyos-1x.postinst b/debian/vyos-1x.postinst
index d54f6c5af..6ff466c27 100644
--- a/debian/vyos-1x.postinst
+++ b/debian/vyos-1x.postinst
@@ -1,44 +1,44 @@
 #!/bin/sh -e
 if ! deb-systemd-helper --quiet was-enabled salt-minion.service; then
     # Enables the unit on first installation, creates new
     # symlinks on upgrades if the unit file has changed.
     deb-systemd-helper disable salt-minion.service >/dev/null || true
 fi
 
 if [ -x "/etc/init.d/salt-minion" ]; then
     update-rc.d -f salt-minion remove >/dev/null
 fi
 
 # Add minion user for salt-minion
 if ! grep -q '^minion' /etc/passwd; then
     adduser --quiet --firstuid 100 --system --disabled-login --ingroup vyattacfg --gecos "salt minion user" --shell /bin/vbash minion
     adduser --quiet minion frrvty
     adduser --quiet minion sudo
     adduser --quiet minion adm
     adduser --quiet minion dip
     adduser --quiet minion disk
     adduser --quiet minion users
 fi
 
 # add hostsd group for vyos-hostsd
 if ! grep -q '^hostsd' /etc/group; then
     addgroup --quiet --system hostsd
 fi
 
 # add dhcpd user for dhcp-server
 if ! grep -q '^dhcpd' /etc/passwd; then
     adduser --quiet --system --disabled-login --no-create-home --home /run/dhcp-server dhcpd
     adduser --quiet dhcpd hostsd
 fi
 
 # ensure hte proxy user has a proper shell
 chsh -s /bin/sh proxy
 
 # Remove unwanted daemon files from /etc
 # conntackd
-DELETE="/etc/logrotate.d/conntrackd.distrib /etc/init.d/conntrackd /etc/default/conntrackd"
+DELETE="/etc/logrotate.d/conntrackd.distrib /etc/init.d/conntrackd /etc/default/conntrackd /etc/ppp/ip-up.d/0000usepeerdns /etc/ppp/ip-down.d/0000usepeerdns"
 for file in $DELETE; do
     if [ -f ${file} ]; then
         rm -f ${file}
     fi
 done
diff --git a/src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf b/src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf
index b1902b585..518abeaec 100644
--- a/src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf
+++ b/src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf
@@ -1,48 +1,48 @@
 # modified make_resolv_conf() for VyOS
 # should be used only if vyos-hostsd is running
 
 if /usr/bin/systemctl -q is-active vyos-hostsd; then
     make_resolv_conf() {
         hostsd_client="/usr/bin/vyos-hostsd-client"
         hostsd_changes=
 
         if [ -n "$new_domain_name" ]; then
             logmsg info "Deleting search domains with tag \"dhcp-$interface\" via vyos-hostsd-client"
             $hostsd_client --delete-search-domains --tag "dhcp-$interface"
             logmsg info "Adding domain name \"$new_domain_name\" as search domain with tag \"dhcp-$interface\" via vyos-hostsd-client"
             $hostsd_client --add-search-domains "$new_domain_name" --tag "dhcp-$interface"
             hostsd_changes=y
         fi
 
         if [ -n "$new_dhcp6_domain_search" ]; then
             logmsg info "Deleting search domains with tag \"dhcpv6-$interface\" via vyos-hostsd-client"
             $hostsd_client --delete-search-domains --tag "dhcpv6-$interface"
             logmsg info "Adding search domain \"$new_dhcp6_domain_search\" with tag \"dhcpv6-$interface\" via vyos-hostsd-client"
             $hostsd_client --add-search-domains "$new_dhcp6_domain_search" --tag "dhcpv6-$interface"
             hostsd_changes=y
         fi
 
         if [ -n "$new_domain_name_servers" ]; then
             logmsg info "Deleting nameservers with tag \"dhcp-$interface\" via vyos-hostsd-client"
             $hostsd_client --delete-name-servers --tag "dhcp-$interface"
             logmsg info "Adding nameservers \"$new_domain_name_servers\" with tag \"dhcp-$interface\" via vyos-hostsd-client"
             $hostsd_client --add-name-servers $new_domain_name_servers --tag "dhcp-$interface"
             hostsd_changes=y
         fi
 
         if [ -n "$new_dhcp6_name_servers" ]; then
             logmsg info "Deleting nameservers with tag \"dhcpv6-$interface\" via vyos-hostsd-client"
             $hostsd_client --delete-name-servers --tag "dhcpv6-$interface"
-            logmsg info "Adding nameservers \"$new_dhcpv6_name_servers\" with tag \"dhcpv6-$interface\" via vyos-hostsd-client"
-            $hostsd_client --add-name-servers $new_dhcpv6_name_servers --tag "dhcpv6-$interface"
+            logmsg info "Adding nameservers \"$new_dhcp6_name_servers\" with tag \"dhcpv6-$interface\" via vyos-hostsd-client"
+            $hostsd_client --add-name-servers $new_dhcp6_name_servers --tag "dhcpv6-$interface"
             hostsd_changes=y
         fi
 
         if [ $hostsd_changes ]; then
             logmsg info "Applying changes via vyos-hostsd-client"
             $hostsd_client --apply
         else
             logmsg info "No changes to apply via vyos-hostsd-client"
         fi
     }
 fi
diff --git a/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup b/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
index eac860cd8..378f74741 100644
--- a/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
+++ b/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
@@ -1,115 +1,115 @@
 ##
 ## VyOS cleanup
 ##
 # NOTE: here we use 'ip' wrapper, therefore a route will be actually deleted via /usr/sbin/ip or vtysh, according to the system state
 hostsd_client="/usr/bin/vyos-hostsd-client"
 hostsd_changes=
 # check vyos-hostsd status
 /usr/bin/systemctl -q is-active vyos-hostsd
 hostsd_status=$?
 
-if [[ $reason =~ (EXPIRE|FAIL|RELEASE|STOP) ]]; then
+if [[ $reason =~ ^(EXPIRE|FAIL|RELEASE|STOP)$ ]]; then
     if [[ $hostsd_status -eq 0 ]]; then
         # delete search domains and nameservers via vyos-hostsd
         logmsg info "Deleting search domains with tag \"dhcp-$interface\" via vyos-hostsd-client"
         $hostsd_client --delete-search-domains --tag "dhcp-$interface"
         logmsg info "Deleting nameservers with tag \"dhcp-${interface}\" via vyos-hostsd-client"
         $hostsd_client --delete-name-servers --tag "dhcp-${interface}"
         hostsd_changes=y
     fi
 
     if_metric="$IF_METRIC"
 
     # try to delete default ip route 
     for router in $old_routers; do
         # check if we are bound to a VRF
         local vrf_name=$(basename /sys/class/net/${interface}/upper_* | sed -e 's/upper_//')
         if [ "$vrf_name" != "*" ]; then
             vrf="vrf $vrf_name"
         fi
 
         logmsg info "Deleting default route: via $router dev ${interface} ${if_metric:+metric $if_metric} ${vrf}"
         ip -4 route del default via $router dev ${interface} ${if_metric:+metric $if_metric} ${vrf}
 
         if_metric=$((if_metric+1))
     done
 
     # delete rfc3442 routes
     if [ -n "$old_rfc3442_classless_static_routes" ]; then
         set -- $old_rfc3442_classless_static_routes
         while [ $# -gt 0 ]; do
             net_length=$1
             via_arg=''
             case $net_length in
                 32|31|30|29|28|27|26|25)
                     if [ $# -lt 9 ]; then
                         return 1
                     fi
                     net_address="${2}.${3}.${4}.${5}"
                     gateway="${6}.${7}.${8}.${9}"
                     shift 9
                     ;;
                 24|23|22|21|20|19|18|17)
                     if [ $# -lt 8 ]; then
                         return 1
                     fi
                     net_address="${2}.${3}.${4}.0"
                     gateway="${5}.${6}.${7}.${8}"
                     shift 8
                     ;;
                 16|15|14|13|12|11|10|9)
                     if [ $# -lt 7 ]; then
                         return 1
                     fi
                     net_address="${2}.${3}.0.0"
                     gateway="${4}.${5}.${6}.${7}"
                     shift 7
                     ;;
                 8|7|6|5|4|3|2|1)
                     if [ $# -lt 6 ]; then
                         return 1
                     fi
                     net_address="${2}.0.0.0"
                     gateway="${3}.${4}.${5}.${6}"
                     shift 6
                     ;;
                 0)  # default route
                     if [ $# -lt 5 ]; then
                         return 1
                     fi
                     net_address="0.0.0.0"
                     gateway="${2}.${3}.${4}.${5}"
                     shift 5
                     ;;
                 *)  # error
                     return 1
                     ;;
             esac
             # take care of link-local routes
             if [ "${gateway}" != '0.0.0.0' ]; then
                 via_arg="via ${gateway}"
             fi
             # delete route (ip detects host routes automatically)
             ip -4 route del "${net_address}/${net_length}" \
                 ${via_arg} dev "${interface}" >/dev/null 2>&1
         done
     fi
 fi
 
-if [[ $reason =~ (EXPIRE6|RELEASE6|STOP6) ]]; then
+if [[ $reason =~ ^(EXPIRE6|RELEASE6|STOP6)$ ]]; then
     if [[ $hostsd_status -eq 0 ]]; then
         # delete search domains and nameservers via vyos-hostsd
         logmsg info "Deleting search domains with tag \"dhcpv6-$interface\" via vyos-hostsd-client"
         $hostsd_client --delete-search-domains --tag "dhcpv6-$interface"
         logmsg info "Deleting nameservers with tag \"dhcpv6-${interface}\" via vyos-hostsd-client"
         $hostsd_client --delete-name-servers --tag "dhcpv6-${interface}"
         hostsd_changes=y
     fi
 fi
 
 if [ $hostsd_changes ]; then
     logmsg info "Applying changes via vyos-hostsd-client"
     $hostsd_client --apply
 else
     logmsg info "No changes to apply via vyos-hostsd-client"
 fi
diff --git a/src/etc/dhcp/dhclient-exit-hooks.d/vyatta-dhclient-hook b/src/etc/dhcp/dhclient-exit-hooks.d/vyatta-dhclient-hook
index eeb8b0782..49bb18372 100644
--- a/src/etc/dhcp/dhclient-exit-hooks.d/vyatta-dhclient-hook
+++ b/src/etc/dhcp/dhclient-exit-hooks.d/vyatta-dhclient-hook
@@ -1,44 +1,44 @@
 #!/bin/sh
 
 # Author: Stig Thormodsrud <stig@vyatta.com>
 # Date: 2007
 # Description: dhcp client hook
 
 # **** License ****
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 2 as
 # published by the Free Software Foundation.
-# 
+#
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 # General Public License for more details.
-# 
+#
 # This code was originally developed by Vyatta, Inc.
 # Portions created by Vyatta are Copyright (C) 2006, 2007, 2008 Vyatta, Inc.
 # All Rights Reserved.
 # **** End License ****
 
 # To enable this script set the following variable to "yes"
 RUN="yes"
 
 proto=""
-if [[ $reason =~ (REBOOT6|INIT6|EXPIRE6|RELEASE6|STOP6|INFORM6|BOUND6|REBIND6|DELEGATED6) ]]; then
+if [[ $reason =~ ^(REBOOT6|INIT6|EXPIRE6|RELEASE6|STOP6|INFORM6|BOUND6|REBIND6|DELEGATED6)$ ]]; then
         proto="v6"
 fi
 
 if [ "$RUN" = "yes" ]; then
         LOG=/var/lib/dhcp/dhclient_"$interface"."$proto"lease
         echo `date` > $LOG
 
         for i in reason interface new_expiry new_dhcp_lease_time medium \
                         alias_ip_address new_ip_address new_broadcast_address \
                         new_subnet_mask new_domain_name new_network_number \
                         new_domain_name_servers new_routers new_static_routes \
 			new_dhcp_server_identifier new_dhcp_message_type \
                         old_ip_address old_subnet_mask old_domain_name \
                         old_domain_name_servers old_routers \
                         old_static_routes; do
                 echo $i=\'${!i}\' >> $LOG
         done
 fi
diff --git a/src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers b/src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers
new file mode 100755
index 000000000..5157469f4
--- /dev/null
+++ b/src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers
@@ -0,0 +1,14 @@
+#!/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"
+$hostsd_client --apply
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 100755
index 000000000..4affaeb5c
--- /dev/null
+++ b/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers
@@ -0,0 +1,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