Net2Secure welcomes you to the latest series of informational guides. Today, you will learn how to configure private nameservers for your VPS or Dedicated server. Doesn’t matter if you are a web hosting providers, reseller, digital agency, or business managing multiple websites; private nameservers enable you to set a professional DNS infrastructure while maintaining full control over your domain’s name resolution.
By default, most hosting providers assign their own nameservers, such as ns1.provider.com and ns2.provider.com, to handle DNS records. While these nameservers function effectively, they represent the provider’s branding instead of your own. Private nameservers, on the other hand, allow you to create branded nameservers such as ns1.yourdomain.com and ns2.yourdomain.com, boosting your organization’s professional image and reinforcing your brand identity.
Furthermore, private nameservers deliver better administrative control over your DNS environment. They simplify website and customer management, enable you to host multiple domains under a unified DNS infrastructure, and are particularly valuable for businesses delivering reseller hosting, VPS Server hosting, dedicated servers, or managed hosting services. Since DNS is responsible for translating domain names into IP addresses, properly configured nameservers are vital for ensuring websites, email services, and other online applications remain accessible and reliable.
In this post, you will learn the complete process of setting up private nameservers on your VPS or Dedicated server hosting. In addition, you will learn how to create child nameservers at your domain registrar, configure DNS records on your server, assign the accurate IP addresses, update your domain to use the newly created nameservers, and verify that everything is functioning properly.
Private nameservers, generally known as custom nameservers, refer to DNS nameservers that use your own domain name instead of your hosting provider’s domain. For example, instead of using generic nameservers like ns1.hostingprovider.com and ns2.hostingprovider.com, you can create branded nameservers such as ns1.yourdomain.com and ns2.yourdomain.com.
Private nameservers do the same function as standard nameservers. They direct your domain to the correct web server. The only difference is that they represent your own domain name, giving your hosting environment a more professional and branded appearance.
Using private nameservers is crucial if you are operating a VPS or Dedicated Server, handling various websites, or operating a web hosting business. They enable you to create a consistent brand identity, making your services appear more reliable and professional to your clients.
For instance, if your domain is example.com, you can configure your own private nameservers as:
Once configured, these nameservers can be used to handle your domain’s DNS records or deliver branded DNS services for customer domains hosted on your server.
The first step is to register your private nameservers with your domain registrar. This allows the global DNS system to recognize your custom nameservers.
Sign in to the control panel where your domain is registered.
Depending on your registrar, this option may appear as:
Register two nameservers using your domain name and assign them the static IP addresses of your VPS or Dedicated Server.
Example:
After registration, your registrar will publish the glue records. DNS propagation may take several hours, depending on the registrar.
For WHM Panel,
For Plesk Panel,
For CyberPanel,
After registering the nameservers, configure a DNS server on your VPS or Dedicated Server.
This guide uses BIND (Berkeley Internet Name Domain), one of the most widely used DNS server applications.
Install BIND
Connect to your server via SSH.
Ubuntu/Debian
sudo apt update
sudo apt install bind9
CentOS/RHEL
sudo yum install bind
Configure DNS Zones
Open the BIND local configuration file.
sudo nano /etc/bind/named.conf.local
Add your forward and reverse DNS 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";
};
Save and close the file.
Create the Zone Directory
sudo mkdir -p /etc/bind/zones
Create the Forward Zone File
sudo nano /etc/bind/zones/db.yourdomain.com
Paste the following configuration:
$TTL 86400
@ IN SOA ns1.yourdomain.com. admin.yourdomain.com. (
2024062701
3600
1800
1209600
86400 )
@ 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
sudo nano /etc/bind/zones/db.192.0.2
Add the following configuration:
$TTL 86400
@ IN SOA ns1.yourdomain.com. admin.yourdomain.com. (
2024062701
3600
1800
1209600
86400 )
@ IN NS ns1.yourdomain.com.
@ IN NS ns2.yourdomain.com.
1 IN PTR ns1.yourdomain.com.
2 IN PTR ns2.yourdomain.com.
Restart the BIND Service
After saving the configuration files, restart BIND to apply the changes.
sudo systemctl restart bind9
You can also verify the configuration before restarting:
sudo named-checkconf
sudo named-checkzone yourdomain.com /etc/bind/zones/db.yourdomain.com
DNS uses TCP and UDP port 53. Ensure both ports are open on your server.
Ubuntu/Debian (UFW)
sudo ufw allow 53/tcp
sudo ufw allow 53/udp
CentOS/RHEL (Firewalld)
sudo firewall-cmd --permanent --add-port=53/tcp
sudo firewall-cmd --permanent --add-port=53/udp
sudo firewall-cmd --reload
Once everything is configured:
For example:
ns1.yourdomain.com
ns2.yourdomain.com
From a Linux system, run:
dig NS example.com
Expected output:
example.com. IN NS ns1.example.com.
example.com. IN NS ns2.example.com.
Test your nameserver directly:
dig @ns1.example.com example.com
Or use:
nslookup example.com ns1.example.com
You can also verify propagation using online DNS lookup tools.
If your private nameservers are not working correctly, try the following checks: