Netplan & DNS nameserver Ubuntu 18.04

Selama bertahun untuk setting nameserver kita cukup mengganti /etc/resolv.conf :

nameserver 8.8.4.4
nameserver 8.8.8.8

selain itu kita dapat  merubah di /etc/network/interfaces menjadi

dns-addresses 8.8.4.4, 8.8.8.8

Lalu restart :

sudo systemctl restart networking

atau

sudo /etc/init.d/networking restart

Saat ini versi terbaru ubuntu mulai menggunakan Netplan.

Netplan adalah utilitas baris perintah untuk konfigurasi jaringan pada distribusi Linux tertentu. Netplan menggunakan file deskripsi YAML untuk mengkonfigurasi antarmuka jaringan dan, dari deskripsi tersebut, akan menghasilkan pilihan konfigurasi yang diinginkan untuk alat render (eg. network-manager).

File yang perlu kita setup adalah : /etc/netplan/01-*/yaml.

Sehingga kita perlu meletakkan code seperti berikut di dalamnya:

nameserver:
   addresses: [8.8.4.4, 8.8.8.8]

 

Memasang OpenVpn pada Ubuntu 16.04 LTS

Rerefensi : https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-16-04

Introduction

Ingin mengakses Internet dengan aman dan aman dari smartphone atau laptop Anda ketika terhubung ke jaringan tidak terpercaya seperti WiFi dari hotel atau kedai kopi? Virtual Private Network (VPN) memungkinkan Anda untuk melintasi jaringan yang tidak dipercaya secara pribadi dan aman seolah-olah Anda berada di jaringan pribadi. Lalu lintas muncul dari server VPN dan melanjutkan perjalanannya ke tujuan.

When combined with HTTPS connections, this setup allows you to secure your wireless logins and transactions. You can circumvent geographical restrictions and censorship, and shield your location and any unencrypted HTTP traffic from the untrusted network.

OpenVPN is a full-featured open source Secure Socket Layer (SSL) VPN solution that accommodates a wide range of configurations. In this tutorial, we’ll set up an OpenVPN server on a Droplet and then configure access to it from Windows, OS X, iOS and Android. This tutorial will keep the installation and configuration steps as simple as possible for these setups.

Prerequisites

Untuk menyelesaikan tutorial ini, Anda akan memerlukan akses ke server Ubuntu 16.04.

Anda perlu mengkonfigurasi pengguna non-root dengan hak akses sudo sebelum Anda memulai panduan ini. Anda dapat mengikuti panduan pengaturan server awal Ubuntu 16.04 kami untuk mengatur pengguna dengan izin yang sesuai. Tutorial yang terhubung juga akan mengatur firewall, yang akan kita anggap sudah ada selama panduan ini.

===bersambung===

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:
options {
    directory "/var/lib/named";
    managed-keys-directory "/var/lib/named/dyn/";
    dump-file "/var/log/named_dump.db";
    statistics-file "/var/log/named.stats";
    listen-on-v6 { none; };
    notify no;
    disable-empty-zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA";
    include "/etc/named.d/forwarders.conf";
     allow-query { 127.0.0.1; 10.111.10/24; };
     listen-on port 53 { 127.0.0.1; 10.111.10.1; };
};

zone "." in {
    type hint;
    file "root.hint";
};

zone "localhost" in {
    type master;
    file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
    type master;
    file "127.0.0.zone";
};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" in {
    type master;
    file "127.0.0.zone";
};

include "/etc/named.conf.include";
logging {
    category default { log_syslog; };
    channel log_syslog { syslog; };
};
 zone "example.site" in {
     file "master/example.site";
    type master;
    allow-transfer { any; };
};
 zone "10.111.10.in-addr.arpa" in {
     file "master/10.111.10.in-addr.arpa";
    type master;
     allow-transfer { any; };
  };

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

Code:
$TTL 2d
 @        IN SOA        ns1.example.site.    root.example.site. (
                2012052901    ; serial
                3h        ; refresh
                1h        ; retry
                1w        ; expiry
                1d )        ; minimum

 example.site.    IN MX        0 mothership.example.site.
 example.site.    IN NS        mothership.example.site.
 mothership    IN A        10.111.10.1
ns1        IN CNAME    mothership
mail        IN CNAME    mothership

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

Code:
$TTL 2d
 @        IN SOA        ns1.example.site.    root.example.site. (
                2012053000    ; serial
                3h        ; refresh
                1h        ; retry
                1w        ; expiry
                1d )        ; minimum

 10.111.10.in-addr.arpa.    IN NS        ns1.example.site.
 1.10.111.10.in-addr.arpa.    IN PTR        mothership.example.site.

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

mkdir /etc/openvpn/ccd

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

client-config-dir ccd

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 :

cd /etc/openvpn/ccd/
touch safesrv

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

ifconfig-push 10.8.0.100 10.8.0.101

Restart OpenVPN:

service openvpn restart

User smk1jkt akan mendapat  IP 10.8.0.100 =)