OpenVPN: IPv6 Server OpenVPN

From OnnoWiki
Revision as of 09:21, 12 March 2019 by Onnowpurbo (talk | contribs) (→‎Menambahkan Client OpenVPN)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Setup Server OpenVPN relatif sama untuk single PC client maupun LAN. Asumsi topologi yang digunakan adalah seperti gambar di bawah ini,

CLIENT 1 ------- HOST A ---------------- HOST B
                 ovpn server             ovpn client
                 2345::1/64

Host A akan berfungsi sebagai OpenVPN Server.

  • OS : Ubuntu 18.04
  • IP : 192.168.0.239/24 (ini bisa berupa IPv4 public)
  • hostname : vpnserver

Host B akan berfungsi sebagai OpenVPN PC client atau OpenVPN LAN gateway.

  • OS : Ubuntu 18.04

Instal dan Konfigurasi OpenVPN Server

Download script openvpn-install dari github

sudo su
apt update
apt install openssh-server openvpn

cd /usr/local/src
wget https://git.io/vpn -O openvpn-install.sh
bash openvpn-install.sh

Jawab pertanyaan:

IP address: 192.168.0.239
Public IP address / hostname: vpnserver
Protocol [1-2]: 1 -- UDP
Port: 1194
DNS [1-5]: 1
Client name: client
Press any key to continue...  <ENTER>

IPv4 Address 192.168.0.239, tergantung dari IPv4 public yang tersambung ke OpenVPN Server. Setelah tekan tombol <ENTER> maka akan tampak file client.ovpn, di

/root/client.ovpn

Nama client.ovpn tergantung permintaan client. Biasanya ini di sesuaikan dengan permintaan user kita (client) untuk identifikasi masing-masing client. File client.ovpn perlu dikirim ke client bisa menggunakan email, file transfer atau scp.

Setelah instalasi OpenVPN selesai di lakukan, reboot server,

shutdown -r now

Cek kondisi jaringan di Server

ifconfig

Akan muncul interface tun0

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.8.0.1  netmask 255.255.255.0  destination 10.8.0.1
        inet6 fe80::eaaa:77ed:ba02:748  prefixlen 64  scopeid 0x20<link>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 100  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6  bytes 288 (288.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Konfigurasi IPv6 Server

Enable IPv6 forwarding

vi /etc/sysctl.conf

net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.enp0s3.forwarding=1
net.ipv6.conf.enp0s8.forwarding=1
net.ipv6.conf.tun0.forwarding=1

sysctl -p

Edit /etc/openvpn/server.conf

vi /etc/openvpn/server.conf

Tambahkan

tun-ipv6
server-ipv6 2345::/64
push tun-ipv6
push "route-ipv6 2000::/3"

Restart

/etc/init.d/openvpn restart

Menambahkan Client OpenVPN

Jika ada lebih dari satu (1) client openvpn, cukup mudah menambahkannya, melalui perintah

cd /usr/local/src
bash openvpn-install.sh

Lakukan

  • Pilih 1 (Add New User)
  • Client name: [nama-client-baru]

Maka akan muncul file

/root/[nama-client-baru].ovpn

file ini di copykan ke client baru tersebut untuk digunakan menyambungkan diri ke OpenVPN Server.


Pranala Menarik