-1

Will below configuration allow me to use one domain name (example.com) to access two VPSes hosted with the same provider (prod and dev)?

*.example.com        IN A    <vps prod IP>
*.dev.example.com    IN A    <vps dev IP>

Will this configuration allow me to point another domain (example.org) to a subdomain (api.example.com) without any A record?

*.example.org        IN CNAME    *.api.example.com

How should the mail (MX) and the apex domain (@) records be configured?

geek11
  • 3
  • 2
  • You can't have a CNAME being a wildcard like you think you want it. Technically you could use a DNAME but the results may be more problems than solutions so better not to. PS: use `.example` as a fake TLD, not `.tld`. – Patrick Mevzek Aug 10 '20 at 03:37

1 Answers1

0

There must be an A record for the host that *.domain2.example is pointing to. I would not point a wildcard record of one domain to another wildcard record of another domain. Also, you should only use wildcard records when it is absolutely necessary.

If your domains are (for example) example.com and example.org, then your DNS records should look like the below:

*** example.com ***

host1.example.com. IN A 192.0.2.11
host1.dev.example.com. IN A 192.0.2.33
host1.api.example.com. IN A 192.0.2.55

example.com. IN MX 10 host1.example.com.
*** example.org ***

host1.example.org. IN CNAME host1.api.example.com.

You do not need to configure the apex domain, if it is not required. If host1.example.com is acting as the mail server for example.com, then you would include the 4th record under example.com. The IPs being referenced by the A records can all be residing on the same server or multiple servers.

Christopher H
  • 338
  • 2
  • 16