From Funtoo
Jump to: navigation, search



We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


As this page deals with DNS it has the potential to break your internet access! Ensure you have stable live media that can restore your system.

Dnsmasq is a dns cache, dhcp, and pxe server. This package is lightweight, and will work well for individual computers, or small lans.


# emerge net-dns/dnsmasq



When using NetworkManager with dhcp use dhcp for addresses only, and tell it is your dns

/etc/dnsmasq.conf is where most of dnsmasq's configuration is done. It's file is well commented, and ready for several scenarios.

DNS only


place other upstream dns servers in /etc/resolv.dnsmasq.conf with your preferred DNS server at the top of the list. The first console command in the block will wipe out existing /etc/resolv.dnsmasq.conf settings, back them up if you have anything important in them.

# echo "nameserver" > /etc/resolv.dnsmasq.conf
   /etc/dnsmasq.conf - insert local dns only configs at the bottom of the dnsmasq.conf file.

To listen to a DNS server on an alternate port: In this example we'll install Package:Dnscrypt:

   /etc/dnsmasq.conf - insert local dns only configs at the bottom of the dnsmasq.conf file.

Now your localhost / is your primary DNS to point net connection scripts to. This is the point of no return command. Start the service before you run this, and be prepaired to test with dig that it's pulling up servers through dnsmasq.

# echo "nameserver" > /etc/resolv.conf

This is the revert to known working DNS servers command:

# echo "nameserver" > /etc/resolv.conf


# rc-update add dnsmasq default
# rc


DNS only

Package:Bind-tools contains dns testing utilities. To verify that dns requests are returned from the local server: emerge bind-tools, then run:

# dig

Make sure it returns something similar, the ip address for googles upstream server(s) will probably be different.


Hosts has a hosts file that blocks advertisements and malicious domains. The hosts file is updated periodically so you may wish to make a cronjob to fetch the hosts file.

To install mvps' host file:

# mkdir /etc/dnsmasq.d
# echo "conf-dir=/etc/dnsmasq.d" >> /etc/dnsmasq.conf
# curl