Q: Using a private domain to connect with a server I'm a bit struggling with using a domain to connect a domain with my server. First of all, I'm using a Debian Linux(of course actually Raspbian, because the server is running on Raspberry Pi 3).
Let's suppose my domain is lalala.co.kr(bought from a domain provider) and my IP is 1.1.1.1. I found that Raspberry Pi can have a DNS server, but I don't think the DNS will help establishing connection with those(domain and IP).
To explain, My domain provider has some of 'name servers'. They have 'Change name server' option for a domain, and if I use their 'name servers' and make some A records for 'name server hosting' then I can make a connection with those.
However I cannot come up with configuring 'name server' and making A records in Raspberry Pi's own.
Let's suppose that the domain provider's name server IP is 2.2.2.2. How can I solve this problem? I want to not use the domain provider's default name server config, because this cause some money expenses. I'm really confused with some networking concepts. I'll appreciate for some intuitions for solving this problem. The server can be connected by using direct IP connection(which means the server is externally open for some web ports and DNS port).
If I gave insufficient informations, please ask to provide them. 

A: 
I don't think the DNS will help establishing connection with those(domain and IP).

That's actually literally what DNS does.

To explain, My domain provider has some of 'name servers'. They have 'Change name server' option for a domain, and if I use their 'name servers' and make some A records for 'name server hosting' then I can make a connection with those.
However I cannot come up with configuring 'name server' and making A records in Raspberry Pi's own.

A 'name server' is a DNS server. You can use software such as BIND 9, PowerDNS, Knot, or NSD to host your own nameserver.

*

*First install the DNS server software and create a new 'zone' for your domain.


*Create a 'zone file' that contains your A/AAAA/NS/etc. records. Don't forget to add an NS record pointing to the Pi's hostname. For example:
$ORIGIN example.com.

@     SOA   ...
@     NS    mypi
mypi  A     192.0.2.1
mypi  AAAA  ...

(Some programs can keep the DNS records in a database, if you want, but nearly all of them also support a plain text-based format.)


*Test from outside, by using such commands as dig @<your_ip> example.com or nslookup example.com <your_ip>.


*Go to your domain registrar's "Change name server" page and enter your Pi's hostname there (e.g. mypi.example.com). Because it's under the same domain, you also need to enter its IP address alongside, thus creating a "glue record". For example:



*Wait a while for the registrar to submit your changes to the registry, and for the registry to update their nameservers, and for old cached entries on your ISP's resolvers to expire...
This might take anywhere from minutes to several days. You can use a tool like dnstrace -s . example.com to check whether the nameserver information has been updated. (A web version is available through "DNS Auth Trace" in this page.)
You now have a self-hosted domain.
