Skip to content

Instantly share code, notes, and snippets.

@PromoFaux
Created March 12, 2017 22:55
Show Gist options
  • Save PromoFaux/98fef6fe5abd5a9a1c130a1d19ba5e11 to your computer and use it in GitHub Desktop.
Save PromoFaux/98fef6fe5abd5a9a1c130a1d19ba5e11 to your computer and use it in GitHub Desktop.
VPN Server, only tunnel DNS requests on client device
client
dev tun
proto tcp
remote [REDACTED SERVER IP/DOMAIN] 1194
resolv-retry infinite
nobind
persist-key
persist-tun
key-direction 1
remote-cert-tls server
tls-version-min 1.2
verify-x509-name server name
cipher AES-256-CBC
auth SHA256
comp-lzo
verb 1
<ca>
-----BEGIN CERTIFICATE-----
[REDACTED]
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
[REDACTED]
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
[REDACTED]
-----END PRIVATE KEY-----
</key>
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
[REDACTED]
-----END OpenVPN Static key V1-----
</tls-auth>
# Automatically generated configuration
daemon
server 10.8.0.0 255.255.255.0
ifconfig 10.8.0.1 10.8.0.2
proto tcp-server
port 1194
dev tun
comp-lzo
keepalive 15 60
verb 3
push "route 192.168.1.0 255.255.255.0"
push "dhcp-option DNS 192.168.1.7"
ca /etc/openvpn/easy-rsa/pki/ca.crt
dh /etc/openvpn/easy-rsa/pki/dh2048.pem
cert /etc/openvpn/easy-rsa/pki/issued/server.crt
key /etc/openvpn/easy-rsa/pki/private/server.key
tls-version-min 1.2
tls-auth /etc/openvpn/easy-rsa/pki/ta.key 0
cipher AES-256-CBC
auth SHA256
status-version 2
status status
log /var/log/openvpn.log
@PromoFaux
Copy link
Author

Make sure Lines 12 and 13 match your own IP subnet

@pk50s
Copy link

pk50s commented Jun 5, 2018

Hi, i am using a vpn service, so i can't modify the server certificate.
I leave in a residence and here, if i don't use vpn, i can't use the dns i want, so it's possible for me just to change the openVpn config to use just the dns of the vpn service?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment