---
title: Set up Forward DNS zone on your VPS
description: "Requirements - VPS installed with CentOS - Registered domain name 1. Access the VPS via SSH 2. Install bind and dnsutils, which will allow us to use the dig command later on **Centos or Fedora: yum install bind dnsutils** **Ubuntu…"
url: "https://truehost.com/support/knowledge-base/set-up-forward-dns-zone-on-your-vps/"
updated: "2025-04-09"
category: DNS
---

# Set up Forward DNS zone on your VPS

Requirements

- VPS installed with CentOS
- Registered domain name

1. Access the VPS via SSH

2. Install bind and dnsutils, which will allow us to use the dig command later on

**Centos or Fedora: yum install bind dnsutils**

**Ubuntu ir Debian: apt-get install bind9 dnsutils**

3. Create a DNS zone file for the domain that will use the name servers. If the domain is called example.com, here is a sample zone file for the domain. The zone file will be called example.com.db. Save this zone file in /var/named. I will assume your server IP is 10.10.10.10. This file will help map your domain name to the IP.

```
;
; BIND data file for  example.com
;
$TTL    3h
@       IN      SOA     ns1.example.com. admin.example.com. (
                          1        ; Serial
                          3h       ; Refresh after 3 hours
                          1h       ; Retry after 1 hour
                          1w       ; Expire after 1 week
                          1h )     ; Negative caching TTL of 1 day
;
@       IN      NS      ns1.example.com.
@       IN      NS      ns2.example.com.


example.com.    IN      MX      10      mail.example.com.
example.com.    IN      A       10.10.10.10
ns1                     IN      A       10.10.10.10
ns2                     IN      A       10.10.10.10
www                     IN      CNAME   example.com.
mail                    IN      A       10.10.10.10
ftp                     IN      CNAME   example.com.
```

4. Whta you need for your site to go online is a forward DNS as the one we have created above. Now, Update the BIND configuration file. Note that, at this point, you should have the following file

**/var/named/example.com.db**

Now, simply open the Bind configuration file using your favourite editor.

**vim /etc/named.conf**

Then add the following code. Remeber to change example.com to your domain name

**zone "example.com" {**

**type master;**

**file "/var/named/example.com.db";**

**};**

5. Lastly, add an IP address of a stable DNS server in your /etc/resolv.conf file. For example, if you wish to add google’s DNS server, comment our the content of /etc/resolv.conf and add the following line:

**nameserver 8.8.4.4**
