This question already has an answer here:
I have a CentOS system that retrieves its upstream DNS servers via DHCP.
I want to run DNSMasq on this box and use it as a server to resolve some hostnames for development.
The problem is when my system starts, the upstream DNS servers are loaded into /etc/resolv.conf and THEN the DNS1 entry from my ifcfg-enp0s3 setup gets loaded. That's a problem because when I query for the internal dev names, it tries to go out to the upstream DNS server instead of checking DNSMasq first. I need the DNSMasq server to be at the TOP of the /etc/resolv.conf and the dhcp loaded ones at the bottom of the resolv.conf so that DNSMasq will work properly.
Any simple way to do that?