I have tried a lot of tutorials but, could not find anything that works out of the box for Ubuntu 18.04 fresh install. What I have found is that ubuntu 18.04 comes pre-installed with dnsmasq-base which I had to remove to install the full dnsmasq.

Edit the dnsmasq config file

and add the below mentioned lines

Check if the network manager has dnsmasq line, if yes, then remove it

Restart NetworkManager

Retsart dnsmasq

And you should be good to go.