= DNS configuration details

== General DNS setup

The {ocp} cluster managed by {prod} uses 2 DNS domain names, `crc.testing` and `apps-crc.testing`.
The `crc.testing` domain is for core {ocp} services.
The `apps-crc.testing` domain is for accessing {openshift} applications deployed on the cluster.

For example, the {ocp} API server is exposed as `api.crc.testing` while the {ocp} console is accessed as `console-openshift-console.apps-crc.testing`.
These DNS domains are served by a `dnsmasq` DNS container running inside the {prod} instance.

The [command]`{bin} setup` command detects and adjusts your system DNS configuration so that it can resolve these domains.
Additional checks are done to verify DNS is properly configured when running [command]`{bin} start`.

== DNS on Linux

On Linux, depending on your distribution, {prod} expects the following DNS configuration:

=== NetworkManager + systemd-resolved

This configuration is used by default on Fedora 33 or newer, and on Ubuntu Desktop editions.

* {prod} expects NetworkManager to manage networking.
* {prod} configures `systemd-resolved` to forward requests for the `testing` domain to the `192.168.130.11` DNS server.
`192.168.130.11` is the IP of the {prod} instance.
* `systemd-resolved` configuration is done with a NetworkManager dispatcher script in [filename]*_/etc/NetworkManager/dispatcher.d/99-crc.sh_*:
+
----
#!/bin/sh

export LC_ALL=C

systemd-resolve --interface crc --set-dns 192.168.130.11 --set-domain ~testing

exit 0
----

[NOTE]
====
`systemd-resolved` is also available as an unsupported Technology Preview on {rhel} and {centos} 8.3.
After {rhel-resolved-docs}[configuring the host] to use `systemd-resolved`, stop any running clusters and rerun [command]`{bin} setup`.
====

=== NetworkManager + dnsmasq

This configuration is used by default on Fedora 32 or older, on {rhel}, and on {centos}.

* {prod} expects NetworkManager to manage networking.
* NetworkManager uses `dnsmasq` with the [filename]*_/etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf_* configuration file.
* The configuration file for this `dnsmasq` instance is [filename]*_/etc/NetworkManager/dnsmasq.d/crc.conf_*:
+
----
server=/crc.testing/192.168.130.11
server=/apps-crc.testing/192.168.130.11
----

** The NetworkManager `dnsmasq` instance forwards requests for the `crc.testing` and `apps-crc.testing` domains to the `192.168.130.11` DNS server.

////
== {msw}

TODO
////
