Sometimes /etc/hosts might be enough, but when you want wildcard domains to be mapped you might need dnsmasq. And if you are on Linux you might want to integrate your NetworkManager service with dnsmasq. Follow these steps below
- Make sure you installed dnsmasq
- `sudo dnf install dnsmasq`
- Edit /etc/NetworkManager/NetworkManager.conf
-
[main]
#plugins=ifcfg-rh,ibft
dns=dnsmasq
-
- Add resolver on /etc/NetworkManager/dnsmasq.d/local-resolver.conf
-
address=/myhost1.test/127.0.0.1
address=/myhost2.test/127.0.0.1
-
- Make sure dnsmasq not running, because dnsmasq need to started by NetworkManager in order these two to be integrated. And make sure its disable on startup, so NetworkManager can start it successfully on startup.
- `sudo systemctl stop dnsmasq`
- `sudo systemctl disable dnsmasq`
- Restart Network Manager
- `sudo systemctl restart NetworkManager`
- Test
- `ping myhost1.test`