@maddison_wintheiser
To configure a DNS server on Ubuntu, you can follow these steps:
- Update the Ubuntu system:sudo apt update
sudo apt upgrade
- Install the DNS server software (Bind9) by running the following command:sudo apt install bind9
- Configure the DNS server by editing the "/etc/bind/named.conf.options" file. You can use any text editor to do this. For example:sudo nano /etc/bind/named.conf.options
- Add the following lines to the "named.conf.options" file to allow your DNS server to respond to queries from other computers:listen-on port 53 { any; };
allow-query { any; };
- Create a zone file for your domain by creating a new file in the "/etc/bind" directory. For example, if your domain is "example.com", you can create a file called "/etc/bind/db.example.com" with the following contents:;
; BIND data file for example.com
;
$TTL 604800
@ IN SOA ns1.example.com. admin.example.com. (
2022040401 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Default TTL
;
@ IN NS ns1.example.com.
@ IN A 192.168.1.1
ns1 IN A 192.168.1.1
This file specifies the DNS records for your domain. In this example, it defines an "A" record for the domain and an "A" record for the nameserver.
- Edit the "/etc/bind/named.conf.local" file and add the following lines to it:zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};
This tells the DNS server to use the zone file you just created for the "example.com" domain.
- Restart the Bind9 service:sudo systemctl restart bind9
Your DNS server should now be configured and running. You can test it by querying it from another computer using the "nslookup" command. For example:
1
|
nslookup example.com <ip_address_of_dns_server>
|