How to configure DNS domain name resolution service in Ubuntu?

You can set up DNS domain resolution services on Ubuntu by installing and configuring the BIND software. Here are the detailed steps:

  1. Open the terminal and log in as the root user.
  2. Install the BIND software.
sudo apt update
sudo apt install bind9
  1. Open the main configuration file of BIND for editing.
sudo nano /etc/bind/named.conf.options
  1. shipping agents
forwarders {
    8.8.8.8;    // 这里可以替换为你喜欢的DNS服务器地址
    8.8.4.4;
};
  1. Save and close the file.
  2. Open the local configuration file of BIND for editing.
sudo nano /etc/bind/named.conf.local
  1. example.com is the website address.
  2. The IP address is ten on the 192.168.1 network.
zone "example.com" {
    type master;
    file "/etc/bind/db.example.com";
};
  1. Save and close the file.
  2. Create a domain name resolution file:
sudo nano /etc/bind/db.example.com
  1. Add the following content to the file, replacing it with your own domain name and IP address:
$TTL 86400
@   IN  SOA ns1.example.com. admin.example.com. (
            2021010101  ; Serial
            604800      ; Refresh
            86400       ; Retry
            2419200     ; Expire
            86400       ; Negative Cache TTL
)
;
@   IN  NS  ns1.example.com.
@   IN  A   192.168.1.10
ns1 IN  A   192.168.1.10
  1. Save and close the file.
  2. Restart the BIND service to apply the configuration changes.
sudo systemctl restart bind9

You have successfully set up the DNS domain name resolution service. You can now configure the DNS server on other computers to use the IP address you have set up, allowing you to access your server through domain resolution.

bannerAds