Hey guys,
I'm running an OpenVPN service on my Debian 8 server. Currently I've setup two configurations/services: One for just connection to the internal LAN, internet traffic is going to the internet connection of the client and a second one for routing all traffic, including internet trough my VPN.
Now I would like to have a third option: routing ONLY internet traffic trough my VPN, meaning the internet requests from the client should come over the VPN, but the client should NOT have access to the internal LAN.
I guess this is done via firewalling, but how? can anyone give me a hint?
Thanks!
Here is my current config:
Intranet VPN (no internet trough VPN)
#Main Configuration#
port 1194
proto udp
dev tun
server 10.8.0.0 255.255.255.0
#Encryption#
cipher AES-256-CBC
comp-lzo
#Certificates#
ca ca.crt
cert server.crt
key server.key
tls-auth ta.key 0
dh dh2048.pem
#Networking#
push "route 10.10.0.0 255.255.255.0"
push "dhcp-option DNS 10.10.0.1"
keepalive 10 60
max-clients 3
#Logging#
status openvpn-status.log
log openvpn.log
verb 4
mute 20
#Rights#
persist-key
persist-tun
user nobody
group nogroup
Internet VPN (internet trough VPN)
#Main Configuration#
port 1195
proto udp
dev tun
server 10.9.0.0 255.255.255.0
#Encryption#
cipher AES-256-CBC
comp-lzo
#Certificates#
ca ca.crt
cert server.crt
key server.key
tls-auth ta.key 0
dh dh2048.pem
#Networking#
push "route 10.10.0.0 255.255.255.0"
push "redirect-gateway def1"
push "dhcp-option DNS 10.10.0.1"
push "dhcp-option DNS 85.214.20.141"
keepalive 5 30
max-clients 3
#Logging#
status openvpn-status.log
log openvpn.log
verb 4
mute 20
#Rights#
persist-key
persist-tun
user nobody
group nogroup
rc.local config
# enable IP-Forward
echo 1 > /proc/sys/net/ipv4/ip_forward
# Forwarding
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o eth0 -s 10.8.0.0/24 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -s 10.9.0.0/24 -j MASQUERADE