Parameters that can be used to configure DNS host names can be transmitted with a switch that specifies how to prioritize IPv4 or IPv6 when a connection is established.
Specific use cases are, for example, the use of DNS names in VPN connections or SIP registrars, where you need to control whether the connection is established via IPv4 or IPv6.
Example 1: If the host name vpn.example.org is resolved to an IPv4 and an IPv6 address, a host usually prefers IPv6 over IPv4. However, if IPv4 is to be used, this can be controlled by appending ?4 to the host name, i.e. in this case: vpn.example.org?4.
Example 2: If IPv4 is to be preferred for a CLI ping of an IPv4/IPv6 DNS host name, the following syntax can be used: ping www.example.org?4.
The following suffixes are allowed:
- ?4: Resolve only over IPv4
- ?6: Resolve only over IPv6
- ?46: Prefer IPv4 over IPv6, i.e. if IPv4 cannot be resolved, IPv6 is used.
- ?64: Prefer IPv6 over IPv4, i.e. if IPv6 cannot be resolved, IPv4 is used.