Time to host your applications on cloud. Join Now
Registering private nameservers for VPS and dedicated servers is one of the important basic stages of having one’s own DNS system. This gives you more control over your domain and generally improves the security and functionality of your website.
Such a procedure is explained in the most straightforward and understandable way possible in the guidance that follows.
Private nameservers or custom nameservers are basically DNS servers that are associated with your domain rather than your hosting provider's domain. It is preferred not to use common nameservers such as ns1. Dense cross-linking also forms the basis of major routing protocols. hostingprovider. registration for a domain at our partner com, look at the nameservers like ns1. your domain. com and ns2. your domain. com.
1. Branding: They enhance your brand’s image by using your domain name.
2. Control: Greater flexibility and control over DNS records.
3. Independence: Avoid dependency on your hosting provider’s DNS infrastructure.
4. Resilience: Easier to migrate hosting providers without changing nameservers.
Before setting up private nameservers, ensure you have the following:
1. A Domain Name: Registered with a provider that allows DNS management.
2. A VPS or Dedicated Server: With root access.
3. Static IP Addresses: Assigned to your VPS or dedicated server.
4. Basic Command Line Knowledge: Familiarity with SSH and DNS concepts.
You need to register your private nameservers with your domain registrar so they can be recognized by the global DNS system.
1. Log into your domain registrar’s control panel.
2. Find the DNS or nameserver management section. Look for options like "Custom Nameservers," "Register Nameservers," or similar.
3. Register your nameservers. You'll need to provide:
- Nameserver Name: Typically ns1.yourdomain.com and ns2.yourdomain.com.
- IP Address: The static IPs assigned to your VPS or dedicated server.
4. For example:
- ns1.yourdomain.com -> 192.0.2.1
- ns2.yourdomain.com -> 192.0.2.2
5. Save changes. The registrar will propagate this information globally.
Next, set up DNS server software on your server. Common options include BIND (Berkeley Internet Name Domain) and Unbound. This guide will focus on BIND.
1. Access your server via SSH. Use a terminal or SSH client to connect to your server.
2. Install BIND. Use your package manager:
- Debian/Ubuntu: sudo apt update && sudo apt install bind9
- CentOS/RHEL: sudo yum install bind
Edit the named.conf.local file to define your zones.
sudo nano /etc/bind/named.conf.local
Add your domain zone. Include both forward and reverse zones:
zone "yourdomain.com" {
type master;
file "/etc/bind/zones/db.yourdomain.com";
};
zone "2.0.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.192.0.2";
};
Create zone files. Create the directory if it doesn't exist:
sudo mkdir -p /etc/bind/zones
Create the forward zone file:
sudo nano /etc/bind/zones/db.yourdomain.com
txt
Copy code
$TTL 86400
@ IN SOA ns1.yourdomain.com. admin.yourdomain.com. (
2024062701 ; Serial
3600 ; Refresh
1800 ; Retry
1209600 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS ns1.yourdomain.com.
@ IN NS ns2.yourdomain.com.
ns1 IN A 192.0.2.1
ns2 IN A 192.0.2.2
Create the reverse zone file:
bash
Copy code
sudo nano /etc/bind/zones/db.192.0.2
txt
Copy code
$TTL 86400
@ IN SOA ns1.yourdomain.com. admin.yourdomain.com. (
2024062701 ; Serial
3600 ; Refresh
1800 ; Retry
1209600 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS ns1.yourdomain.com.
@ IN NS ns2.yourdomain.com.
1 IN PTR ns1.yourdomain.com.
2 IN PTR ns2.yourdomain.com.
Restart BIND. Apply the changes:
bash
Copy code
sudo systemctl restart bind9
Ensure that DNS traffic (port 53) is allowed through your server’s firewall.
- Check firewall rules.
Debian/Ubuntu: Use ufw (Uncomplicated Firewall):
bash
Copy code
sudo ufw allow 53/tcp
sudo ufw allow 53/udp
CentOS/RHEL: Use firewalld:
bash
Copy code
sudo firewall-cmd --permanent --add-port=53/tcp
sudo firewall-cmd --permanent --add-port=53/udp
sudo firewall-cmd --reload
- Log into your domain
- Set your domain to use your private nameservers
- Save changes
If you encounter issues, here are common troubleshooting steps:
- Check Syntax: Ensure no syntax errors in your BIND configuration files.
- Review Logs: Check /var/log/syslog or /var/log/messages for BIND-related logs.
- Test Connectivity: Ensure your server’s IP is reachable and that no firewall blocks DNS traffic.
- Re-check Registrar Settings: Confirm that nameservers are correctly registered.
Setting up private nameservers for your VPS or dedicated server gives you control over your DNS, branding advantages, and flexibility. Follow this guide carefully, and you’ll have your custom nameservers up and running smoothly. If you run into issues, consult your hosting provider or seek professional assistance to ensure your DNS infrastructure is stable and secure.
Let’s talk about the future, and make it happen!