Difference between revisions of "OpenVPN: IPv4 routed 2 LAN"

From OnnoWiki
Jump to navigation Jump to search
(Created page with "==Topology== LAN 1 ---------- HOST A ---------------- HOST B -------------- LAN 2 ovpn server ovpn client HOST A OpenVPN Server OS : Ubu...")
 
 
(5 intermediate revisions by the same user not shown)
Line 32: Line 32:
 
  ifconfig 10.8.0.1 255.255.255.0
 
  ifconfig 10.8.0.1 255.255.255.0
 
  server 10.8.0.0 255.255.255.0
 
  server 10.8.0.0 255.255.255.0
  route 10.10.20.0 255.255.255.0 10.8.0.2
+
  route 10.10.20.0 255.255.255.0 10.8.0.2 # routing ke arah client
 
  client-to-client
 
  client-to-client
 
  client-config-dir client
 
  client-config-dir client
Line 39: Line 39:
  
 
  File: client  # tergantung username client.ovpn
 
  File: client  # tergantung username client.ovpn
  ifconfig-push 10.8.0.2 255.255.255.0
+
  ifconfig-push 10.8.0.2 255.255.255.0     # paksa IP static di client untuk memudahkan routing
  push "route 10.10.10.0 255.255.255.0"
+
  push "route 10.10.10.0 255.255.255.0"   # paksa routing ke upstream
  push "route 0.0.0.0 0.0.0.0"
+
  iroute 10.10.20.0 255.255.255.0         # internal routing ke arah client
 
 
 
 
 
  
 
==Konfigurasi Client Gateway==
 
==Konfigurasi Client Gateway==
Line 58: Line 55:
  
  
Tambahan di konfigurasi
+
TIDAK ADA Tambahan konfigurasi di client.ovpn.
 +
Pastikan setup interface BENAR.
 +
Pastikan setup routing BENAR.
  
 +
route -n
  
 
==Referensi==
 
==Referensi==
Line 67: Line 67:
 
==Pranala Menarik==
 
==Pranala Menarik==
  
* [[OpenVPN]]
+
* [[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]]

Latest revision as of 08:18, 31 March 2020

Topology

LAN 1 ---------- HOST A ---------------- HOST B -------------- LAN 2
                 ovpn server             ovpn client


HOST A OpenVPN Server

OS   : Ubuntu 18.04
IP   : 192.168.0.239/24
LAN1 : 10.10.10.0/24

HOST B OpenVPN Client

OS   : Ubuntu 18.04
LAN2 : 10.10.20.0/24

Konfigurasi Server

echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
echo 1 > /proc/sys/net/ipv4/conf/default/forwarding
echo 1 > /proc/sys/net/ipv4/conf/tun0/forwarding
echo 1 > /proc/sys/net/ipv4/conf/enp0s3/forwarding
echo 1 > /proc/sys/net/ipv4/conf/enp0s8/forwarding
ifconfig enp0s3 192.168.0.239 netmask 255.255.255.0
ifconfig enp0s8 10.10.10.1 netmask 255.255.255.0

Tambahan di konfigurasi /etc/openvpn/server.conf

ifconfig 10.8.0.1 255.255.255.0
server 10.8.0.0 255.255.255.0
route 10.10.20.0 255.255.255.0 10.8.0.2  # routing ke arah client
client-to-client
client-config-dir client

Tambahan di /etc/openvpn/client

File: client   # tergantung username client.ovpn
ifconfig-push 10.8.0.2 255.255.255.0     # paksa IP static di client untuk memudahkan routing
push "route 10.10.10.0 255.255.255.0"    # paksa routing ke upstream
iroute 10.10.20.0 255.255.255.0          # internal routing ke arah client

Konfigurasi Client Gateway

echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
echo 1 > /proc/sys/net/ipv4/conf/default/forwarding
echo 1 > /proc/sys/net/ipv4/conf/tun0/forwarding
echo 1 > /proc/sys/net/ipv4/conf/enp0s3/forwarding
echo 1 > /proc/sys/net/ipv4/conf/enp0s8/forwarding
ifconfig enp0s3 192.168.0.237 netmask 255.255.255.0
ifconfig enp0s8 10.10.20.1 netmask 255.255.255.0


TIDAK ADA Tambahan konfigurasi di client.ovpn. Pastikan setup interface BENAR. Pastikan setup routing BENAR.

route -n

Referensi

Pranala Menarik