DNS sometimes does not work after fresh Ubuntu 17.04 install. To fix it open NetworkManager.conf file with default editor (nano):
sudo nano /etc/NetworkManager/NetworkManager.conf
This is the content:
[main] plugins=ifupdown,keyfile [ifupdown] managed=false
Insert the following under [main] section before [ifupdown] section
The result should be like this:
[main] plugins=ifupdown,keyfile dns=dnsmasq [ifupdown] managed=false
Save it (CTRL+O) and exit (CTRL+X).
Now reboot to activate changes (you may restart NetworkManager instead of reboot).