sudo yum install dnsmasq
Start it with command:
sudo service dnsmasq start
Check if it was started without any errors:
sudo service dnsmasq status
If there is an error that dnsmasq failed to start because port 53 is already in use, you can check what process listening this post with command:
sudo netstat -tulpn | grep :53
If the process is dnsmasq itself it probably means that you have libvirt installed that has its own dnsmasq copy. To resolve that conflict we need to configure dnsmasq. Configuration file we are going to store in /etc/dnsmasq.d/vm.conf. By default dnsmasq uses file /etc/dnsmasq.conf for configuration. If you open that file, you will be able to see lots of examples and configuration descriptions. Lets left this file intact (almost) and allow dnsmasq to extent configuration with files from dnsmasq.d directory by adding (uncommenting) line:
# Include all files in a directory which end in .conf
Now create file /etc/dnsmasq.d/vm.conf with the following content:
The first line determines what interface dnsmasq will be listening. To check all available interfaces use command ifconfig.
Basicly you need to listen to localhost or 127.0.0.1. You can probably do it with:
The last line of the configuration file says that all requests to sitesupport.net (including subdomains, like super.sitesupport.net) will be redirected to 192.168.33.10 (that's my virtual machine).
Also you need to add to the file /etc/dhcp/dhclient.conf (or create the file if it does not exist):
prepend domain-name-servers 127.0.0.1;
You also need to restart your system. Instead of restarting the system you may try to restart following services:
sudo service dnsmasq restart
sudo service NetworkManager restart
To check that everything works correctly, use command:
The output should show that the request was redirected to 192.168.33.10.