OpenShift requires you to have a working DNS with wild card resolver, for example *.openshift.example.com should resolve to the IP address of the VM.
Usually you would insert required IP addresses to /etc/hosts -file, but it doesn't support wildcards.
This is where dnsmasq comes very handy, it's a simple local DNS server which can be easily configured for this kind of setup. The trick here is that dnsmasq and NetworkManager overwriting your /etc/hosts -file will cause some funny side effects every time you reconnect to a network.
Luckily NetworkManager nowadays supports dnsmasq, but needs some manual configuration in order to work perfectly for this use case:
with lines similar to this:
As we are replacing the normal dnsmasq configuration, it's important to bind to the network interface(s) needed by libvirt, and also to provide dhcp server to your VMs.
and add dns and dhcp lines, do not touch the plugins line:
plugins=ifcfg-rh,ibft # note that this is Fedora-specific line
Make sure the dnsmasq service is disable because NetworkManager will start it automatically. If it's enabled you will have problems.
systemctl disable dnsmasq
systemctl stop dnsmasq
That's it, you are now ready to test everyting.
systemctl restart NetworkManager
Everything should work now. If you look into /etc/resolve it should have only local host as nameserver:
# Generated by NetworkManager
And ensure your wildcard resolver works also:
testing.openshift.example.com has address 192.168.122.115
Even when switching wlan networks and connecting to VPN networks the resolver should work.
With this configuration dnsmasq will use the DHCP discovered DNS servers which NetworkManager gives it at the time of connection.