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

From OnnoWiki
Jump to navigation Jump to search
Line 37: Line 37:
 
  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
 +
#
 
  tun-ipv6
 
  tun-ipv6
  server-ipv6 2345::1/64
+
  server-ipv6 2345::/64
 
  route-ipv6 2003::/64 2345::2            # routing ke arah LAN client
 
  route-ipv6 2003::/64 2345::2            # routing ke arah LAN client
 
  client-config-dir client
 
  client-config-dir client
Line 48: Line 49:
 
  push "route 10.10.10.0 255.255.255.0"    # paksa routing ke upstream
 
  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
 
  iroute 10.10.20.0 255.255.255.0          # internal routing ke arah
 +
#
 
  push tun-ipv6
 
  push tun-ipv6
 
  ifconfig-ipv6 2345::1 2345::2
 
  ifconfig-ipv6 2345::1 2345::2
 +
push "ifconfig-ipv6 2345::2 2345::1"
 
  push "route-ipv6 2002::/64"
 
  push "route-ipv6 2002::/64"
 
  push "route-ipv6 2000::/3"
 
  push "route-ipv6 2000::/3"

Revision as of 09:15, 17 February 2019

Topology

LAN 1 ---------- HOST A ---------------- HOST B -------------- LAN 2
                 ovpn server             ovpn client
2002::/64        2345::1/64              2345::2/64            2003::/64


HOST A OpenVPN Server

OS   : Ubuntu 18.04
IP   : 192.168.0.239/24
IP   : 2345::1/64
LAN1 : 2002::/64

HOST B OpenVPN Client

OS   : Ubuntu 18.04
IP   : 2345::2/64
LAN2 : 2003::/64


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
ip addr add 2002::1/64 dev enp0s8

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
#
tun-ipv6
server-ipv6 2345::/64
route-ipv6 2003::/64 2345::2             # routing ke arah LAN 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
#
push tun-ipv6
ifconfig-ipv6 2345::1 2345::2
push "ifconfig-ipv6 2345::2 2345::1"
push "route-ipv6 2002::/64"
push "route-ipv6 2000::/3"

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
ip addr add 2003::1/64 dev enp0s8

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

ip route show
ip -6 route show
route -n

Referensi

Pranala Menarik