DNS Configuration:

Enable or disable the DNS mock server. When enabled, MockServer starts a UDP DNS server that matches incoming DNS queries against expectations. DNS expectations use DnsRequestDefinition for matching and DnsResponse for responses. Supported record types: A, AAAA, CNAME, MX, SRV, TXT, PTR.

Type: boolean Default: false

Java Code:

ConfigurationProperties.dnsEnabled(boolean enable)

System Property:

-Dmockserver.dnsEnabled=...

Environment Variable:

MOCKSERVER_DNS_ENABLED=...

Property File:

mockserver.dnsEnabled=...

Example:

-Dmockserver.dnsEnabled="true"

The UDP port for the DNS mock server. Set to 0 to let the operating system assign an ephemeral port. Use MockServer.getDnsPort() to retrieve the actual bound port at runtime.

Type: integer Default: 0

Java Code:

ConfigurationProperties.dnsPort(int port)

System Property:

-Dmockserver.dnsPort=...

Environment Variable:

MOCKSERVER_DNS_PORT=...

Property File:

mockserver.dnsPort=...

Example:

-Dmockserver.dnsPort="5353"