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 with an IP address (

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

The price is about 1000 yen a year for a general domain such as .com "(example)". It is a good idea to estimate about 2000 yen a year on the domain "(example)" 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 "" 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 "" with the domain name "", make the following settings. A record

If you want to access the Web server with the IP address "" with the domain name "", make the following settings. A record

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 ( and can have CNAME records. Please note that it cannot be set to the naked domain (

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 "".

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

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

"" is now another name for "".

"" is now another name for "".

When querying the DNS server, both "" and "" return "" set in the A record of "".

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