Configuring DNS in an openVPN based routing VPN setup

Hi all

I have an openVPN server which is configured for routing based VPN. Multiple clients connect to this VPN server.

The network address range for the VPN is
The server’s VPN IP address is
The server is also connected directly on the internet with a static IP address on eth0 – some p.q.r.s

Right now I end up addressing all the clients and the server using IP addresses. But I intend to set up different services on the server like a mailhost, git, apache, etc. and I plan to use different hostnames for all of these services but all running on the same server. I’m planning to use a private domain for all the hosts in the VPN.

Could someone guide me through the setup for this ?

I’ve already installed the bind package and went through pages about BIND and named.conf, the zones and such. But it is still kind of confusing how do I put all these together.
Also, what DNS options should I be pushing to the openVPN clients so that their resolv.conf can use the DNS server on the VPN for querying only the hostnames for the domain. All other queries should go through the client’s default nameserver already in the resolv.conf.



I was able to set up the name server for my VPN and it seems to be working. I’m also able to push the DOMAIN and DNS server options from my openvpn server.conf. And all the clients are able to resolve the hostname using either just hostnames or Now I’d like to enable dynamic DNS updates for enabling the clients to register themselves with the name server server on the VPN so that multiple clients can also address each other using hostnames. Could some one help me with that ?

These are my config files.







Set static client’s VPN IP

Kali ini kita akan memberikan static VPN IP untuk setiap client openVPN :

buatlah sebuah direktori ccd di bawah /etc/openvpn/:

Tambahkan satu baris di  OpenVPN server.conf  yang berada di bawah  /etc/openvpn/,:


Sekarang di dalam /etc/openvpn/ccd kita buat sebuah file untuk setiap user agar memiliki ip address yang tetap. Anda harus memberi nama file persama dengan username dari VPN, jika Anda menambahkan user melalui perintah useradd di mesin lokal, atau menggunakan user yang dibuat dalam FreeRADIUS, maka nama file tersebut harus sama dengan nama username.

Contoh : saya memiliki username : smk1jkt dan dalam file OpenVPN server.conf kita gunakan subnet, jika kita ingin memberikan smk1jkt IP kita lakukan di bawah ini :

Dan kemudian tambahkan satu baris ke dalam file yang bernama smk1jkt :

Restart OpenVPN:

User smk1jkt akan mendapat  IP =)

How To Create a New User and Grant Permissions in MySQL

I always forget the MySQL create database with UTF8 character set syntax, so here it is:

GRANT ALL ON mydb.* TO username@localhost IDENTIFIED BY ‘password’;

Alternatively, you can use ‘CREATE SCHEMA’ instead of ‘CREATE DATABASE’:

CREATE SCHEMA mydb CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON mydb.* TO username@localhost IDENTIFIED BY ‘password’;

I hope this helps someone else too!