0

I've setup OpenVPN on server and configured it so it relays IP of the server for access. But I've done it so that IP is for everything. I checked with tracert and hops indeed go thorgh server and on tunel created via VPN.

Internet and connection with servers works, but it uses servers IP and resources which I want to avoid on global scale and use my own connection for anything other than SSH and MySQL ports as example.

Server.conf :

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
keepalive 10 120
tls-auth ta.key 0 # This file is secret
cipher AES-256-CBC
auth SHA256
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
log         /var/log/openvpn/openvpn.log
log-append  /var/log/openvpn/openvpn.log
verb 3
explicit-exit-notify 1

And client.conf

client
dev tun
proto udp
remote x.x.x.x 1194
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
cipher AES-256-CBC
auth SHA256
verb 3
<ca>
-----BEGIN CERTIFICATE-----
*ca cert*
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
*cert*
-----END CERTIFICATE-----
</cert>

<key>
-----BEGIN PRIVATE KEY-----
*key*
-----END PRIVATE KEY-----
</key>
key-direction 1
<tls-auth>
-----BEGIN OpenVPN Static key V1-----
*tls-auth*
-----END OpenVPN Static key V1-----
</tls-auth>

IPtables is default and has only these rules added that allowed me internet access via VPN:

https://arashmilani.com/post?id=53

TLDR: I just want to have VPN working for either of two things:

  1. Using VPN towards certain ports (SSH, MySQL, WinSRV)
  2. Using VPN towards certain IP addresses (server IP addresses)

Thanks in advance,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.