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 10.111.10.0/24
The server’s VPN IP address is 10.111.10.1
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 example.site 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 example.site domain. All other queries should go through the client’s default nameserver already in the resolv.conf.

Thanks.

UPDATE:

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 hostname.example.site. 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.

/etc/named.conf

Code:

/var/lib/named/master/example.site

Code:

/var/lib/named/master/10.111.10.in-addr.arpa

Code:

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/,:

simpan.

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 10.8.0.0/24, jika kita ingin memberikan smk1jkt IP 10.8.0.100 kita lakukan di bawah ini :

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

Restart OpenVPN:

User smk1jkt akan mendapat  IP 10.8.0.100 =)

MySQL Create Database with UTF8 Character Set Syntax

Create database

I usually forgot the MySQL’s command line to create database with UTF8 character set syntax, so here it is:

or

Create user

Create user and give previledge to it

Change user’s password

Replace the password with the password that you want to use.

MySQL 5.7.6 and later:

MySQL 5.7.5 and earlier:

Here is a short list of other common possible permissions that users can enjoy.

  • ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)
  • CREATE- allows them to create new tables or databases
  • DROP- allows them to them to delete tables or databases
  • DELETE- allows them to delete rows from tables
  • INSERT- allows them to insert rows into tables
  • SELECT- allows them to use the Select command to read through databases
  • UPDATE- allow them to update table rows
  • GRANT OPTION- allows them to grant or remove other users’ privileges

 

Reference from :

  • http://www.euperia.com/development/mysql/mysql-create-database-with-utf8-character-set-syntax/1064
  • https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql