Difference between revisions of "OpenVPN: Simple Server using Script"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 28: | Line 28: | ||
==Setup Firewall== | ==Setup Firewall== | ||
− | + | Kadang konfigurasi Firewall bisa di lihat di /etc/rc.local file: | |
− | + | cat /etc/rc.local | |
− | + | Contoh Firewall: | |
iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT | iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT | ||
Line 39: | Line 39: | ||
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 139.59.1.155 | iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 139.59.1.155 | ||
− | + | Contoh konfigurasi Server openvpn, | |
− | + | sudo more /etc/openvpn/server.conf | |
− | + | sudo vi /etc/openvpn/server.conf | |
− | + | Run / Control OpenVPN Server, | |
− | + | sudo systemctl stop openvpn@server | |
− | + | sudo systemctl start openvpn@server | |
− | + | sudo systemctl restart openvpn@server | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | server | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | sudo /etc/init.d/openvpn stop | |
+ | sudo /etc/init.d/openvpn start | ||
+ | sudo /etc/init.d/openvpn restart | ||
− | + | ==ufw firewall rules (optional)== | |
− | |||
− | + | Edit /etc/ufw/before.rules, | |
− | |||
− | + | sudo vi /etc/ufw/before.rules | |
− | |||
− | |||
− | + | sudo ufw allow 1194/udp | |
− | + | sudo ufw allow 22/tcp | |
− | + | Edit /etc/ufw/sysctl.conf file, | |
− | |||
− | + | sudo vi /etc/ufw/sysctl.conf | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
net/ipv4/ip_forward=1 | net/ipv4/ip_forward=1 | ||
− | + | Enable / Reload ufw, | |
− | |||
+ | sudo ufw enable | ||
OR | OR | ||
− | + | sudo ufw reload | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Verify, | |
− | + | sudo ufw status | |
− | + | sudo iptables -t nat -L -n -v | |
+ | sudo iptables -L FORWARD -n -v | ||
+ | sudo iptables -L ufw-before-forward -n -v | ||
− | + | ==Menambah CLIENT== | |
− | |||
− | + | Untuk menambah Client OpenVPN, jalankan ulang, | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | sudo bash openvpn-install.sh | |
− | |||
− | + | Keluaran: | |
− | Looks like OpenVPN is already installed | + | Looks like OpenVPN is already installed |
+ | |||
+ | What do you want to do? | ||
+ | 1) Add a cert for a new user | ||
+ | 2) Revoke existing user cert | ||
+ | 3) Remove OpenVPN | ||
+ | 4) Exit | ||
+ | Select an option [1-4]: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | Pilih [1] untuk menambahkan Client OpenVPN. | ||
==Referensi== | ==Referensi== |
Latest revision as of 08:49, 31 March 2020
sumber: https://www.cyberciti.biz/faq/howto-setup-openvpn-server-on-ubuntu-linux-14-04-or-16-04-lts/
Cek IP Publik Kita
Jika Server tersambung langsung ke Internet, dapat menggunakan
ip addr show eth0 ip addr show enp0s3 ip a
atau menggunakan
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com host myip.opendns.com resolver1.opendns.com
Download openvpn-install.sh script
Download
wget https://git.io/vpn -O openvpn-install.sh openvpn-install.sh
Install OpenVPN, run,
sudo bash openvpn-install.sh
Setup Firewall
Kadang konfigurasi Firewall bisa di lihat di /etc/rc.local file:
cat /etc/rc.local
Contoh Firewall:
iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT iptables -I INPUT -p udp --dport 1194 -j ACCEPT iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 139.59.1.155
Contoh konfigurasi Server openvpn,
sudo more /etc/openvpn/server.conf sudo vi /etc/openvpn/server.conf
Run / Control OpenVPN Server,
sudo systemctl stop openvpn@server sudo systemctl start openvpn@server sudo systemctl restart openvpn@server
sudo /etc/init.d/openvpn stop sudo /etc/init.d/openvpn start sudo /etc/init.d/openvpn restart
ufw firewall rules (optional)
Edit /etc/ufw/before.rules,
sudo vi /etc/ufw/before.rules
sudo ufw allow 1194/udp sudo ufw allow 22/tcp
Edit /etc/ufw/sysctl.conf file,
sudo vi /etc/ufw/sysctl.conf
net/ipv4/ip_forward=1
Enable / Reload ufw,
sudo ufw enable
OR
sudo ufw reload
Verify,
sudo ufw status sudo iptables -t nat -L -n -v sudo iptables -L FORWARD -n -v sudo iptables -L ufw-before-forward -n -v
Menambah CLIENT
Untuk menambah Client OpenVPN, jalankan ulang,
sudo bash openvpn-install.sh
Keluaran:
Looks like OpenVPN is already installed What do you want to do? 1) Add a cert for a new user 2) Revoke existing user cert 3) Remove OpenVPN 4) Exit Select an option [1-4]:
Pilih [1] untuk menambahkan Client OpenVPN.
Referensi
Pranala Menarik
- OpenVPN: IPv4 /32 single client
- OpenVPN: IPv4 /32 multi-client
- OpenVPN: IPv4 routed LAN
- OpenVPN: IPv4 routed 2 LAN
- OpenVPN: IPv6 /128 single client
- OpenVPN: IPv6 routed LAN
- OpenVPN: IPv6 routed 2 LAN
- IPv6: OpenVPN: Ubuntu roadwarrior
- OpenVPN: Simple Server using Script
- OpenVPN: Free VPN untuk Ubuntu
- Instalasi OpenVPN
- Instalasi OpenVPN Client di Linux
- Capture Screen Proses Instalasi OpenVPN di Windows
- Instalasi OpenVPN di Windows
- WNDW: OpenVPN
- OpenVPN: Instalasi di Ubuntu 16.04
- OpenVPN: Instalasi di Ubuntu 18.04
- OpenVPN: Briding dan Routing