#!/bin/bash
echo "" > /etc/resolv.conf
echo "" > /etc/resolv.conf.ORIG
if [ -d /etc/dhcp/dhclient-enter-hooks.d ]
then
    # Debian/Ubuntu
    echo "#!/bin/sh
make_resolv_conf() { : ; }" > /etc/dhcp/dhclient-enter-hooks.d/noresolvconf
    chmod +x /etc/dhcp/dhclient-enter-hooks.d/noresolvconf
    rm -f /etc/dhcp/dhclient-enter-hooks.d/resolvconf
else
    # RHEL/CentOS/Fedora
    echo "#!/bin/sh
make_resolv_conf() { : ; }" > /etc/dhclient-enter-hooks
    chmod +x /etc/dhclient-enter-hooks
fi

if [ -e /etc/nsswitch.conf ]; then
    sed -i -e "/hosts:/ s/dns//g" /etc/nsswitch.conf
fi
