0 Comments
  •   Posted in: 
  • DNS

Sometimes we have to change the IP in the DNS records to a site. As I did not want to enter IP multiple times I researched the simplest way to define DNS records. You only have to define the IP once. The other records (for instance subdomains hosted via the same IP) you can define as CNAME records. Use wildcard DNS records to minimize the list of records you have to define. With wildcards for subdomains you can route the user to your site even if the user misspelled the subdomain – let your application handle the mistake and still answer the request properly.

That way I reduced our DNS records to two: one A record with the IP, and one CNAME wildcard record pointing to the A record. If I need to change the IP again I will only have to do that at one point.

example.com    A     192.0.2.1
*.example.com CNAME example.com