Disabling Local DNS Cache in Ubuntu

Thanks to Bastian Voigt.

Disable and stop the systemd-resolved service:

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved.service

Edit NetworkManager

Put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

dns=default
rm /etc/resolv.conf

The original file is /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

Restart NetworkManager

sudo systemctl restart NetworkManager