Get domain name and set DNS server

Explains how to get a domain name and set up a DNS server. You can publish your website on the Internet by associating your domain name with your IP address.

I will write about the basic idea and setting method of DNS.

What is DNS?

DNS is a domain name system that associates a domain name (eg perlclub.net) with an IP address (59.106.185.188).

You can get it with a domain name acquisition service such as Name.com.

The price is about 1000 yen a year for a general domain such as .com "(example) perlclub.net". It is a good idea to estimate about 2000 yen a year on the co.jp domain "(example) perlclub.net" for your company.

A record settings

DNS settings are explained on the following pages.

There are some differences in the setting method depending on the DNS server, but basically, set the IP address in the A record and set the corresponding domain name. The domain name can be a subdomain or the domain name itself.

A subdomain is a domain name such as "perlclub.net" with "string." In front of it.

Subdomains are created using A records or CNAME records, which will be explained later.

If you want to access the Web server with the IP address "59.106.185.191" with the domain name "perlclub.net", make the following settings.

perlclub.net A record 59.106.185.191

If you want to access the Web server with the IP address "59.106.185.191" with the domain name "perlclub.net", make the following settings.

perlclub.net A record 59.106.185.191

How to find the IP address of the server

I will write how to find out the IP address of the server. This is because the IP address of the server is required when setting the DNS server.

The server has an IP address. To be precise, the IP address is set on the NIC (network interface card) connected to the server.

The network may be virtualized, but from the perspective of the engineer creating the web application, it doesn't matter. Make a note of the IP address on the server information and network settings page for your VPS or cloud service.

If it is not a public cloud, you can use the ip command or ifconfig command to see the IP address of the server.

Use CNAME records

You can use a CNAME record to set an alias for your domain name.

Only subdomains (perlclub.net and account.perlclub.net) can have CNAME records. Please note that it cannot be set to the naked domain (perlclub.net).

Example of CNAME record settings

CNAME records are useful if you want to configure the same IP address for multiple subdomains.

Suppose the IP address of a server is "59.106.185.179".

First, create a subdomain name that identifies this server using the A record.

prod001.perlclub.net A record 59.106.185.179

Then use the CNAME record to create an alias for the above domain name.

foo.perlclub.net CNAME record prod001.perlclub.net
bar.perlclub.net CNAME record prod001.perlclub.net

"Foo.perlclub.net" is now another name for "prod001.perlclub.net".

"Bar.perlclub.net" is now another name for "prod001.perlclub.net".

When querying the DNS server, both "foo.perlclub.net" and "bar.perlclub.net" return "59.106.185.179" set in the A record of "prod001.perlclub.net".

DNS record query

Querying DNS records is easy with the dig command. You can check the settings of A record, CNAME record, and MX record.

Email address settings

When using e-mail, it is also necessary to set the e-mail address. Please refer to the following articles for creating an email address and setting up a DNS server.

Associated Information