Configure OpenVPN Clients To Use Specific DNS Server
Configure OpenVPN Clients To Use Specific DNS Server
Home ! Security
# 㤘
This is a quick tutorial on how to configure OpenVPN clients to use specific DNS server. OpenVPN
server can be configured to enable the clients to use specific DNS server for hostname resolution.
In our previous tutorials, we have covered how to install and configure OpenVPN server;
There are various ways in which you can push specific DNS servers for name resolution.
For example;
x
cat /etc/openvpn/server/server.conf
port 1194
proto udp
dev tun
ca ca.crt
cert issued/server.crt
key private/server.key # This file should be kept secret
dh dh.pem
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist /var/log/openvpn/ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 192.168.58.22"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DOMAIN kifarunix-demo.com"
client-to-client
keepalive 10 120
tls-auth ta.key 0 # This file is secret
cipher AES-256-CBC
data-ciphers AES-256-CBC
comp-lzo no
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
log-append /var/log/openvpn/openvpn.log
verb 3
explicit-exit-notify 1
auth SHA512
x
systemctl restart [email protected]
If you dont have access to the OpenVPN server to enforce the above configurations, then you can
edit your OpenVPN client configuration file and add the lines;
cat client-1.ovpn
client
tls-client
pull
dev tun
proto udp4
remote 192.168.58.22 1194
resolv-retry infinite x
nobind
#user nobody
#group nogroup
persist-key
persist-tun
key-direction 1
remote-cert-tls server
auth-nocache
comp-lzo
verb 3
auth SHA512
cipher AES-256-CBC
data-ciphers AES-256-CBC
comp-lzo no
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
ec31b288a9a3865c4b5f3583b481ff5c
434e957be6569ed573a58a102ce53efc
b9528f15f5412046c5a603e6916b565b
fe2c6a0f955dcec2d3f7e6cec7e373bb
dff40b041f1488d4177c3de04bdff43b
e361eff6328c499621e0846ec72565ef
734fc02e51540d1c5c19102156a080f7
fde124822bf6fc802dff9facf24998de
6f91f081dafcdd28f4bca9223afe694d
12d57beb6aed96753d651a2ca4722214
5fa87829b9f53f2ccb89d9f15112c9cd
3594ead75bc1df737b50188c2829d724
3aff136577b3c79e6f863112aadf5aeb
8b6d53c607874c71104acfa22e587bd3
22b14a2c0a91e15569d99d5e35a52a8b
0aa4f24ccf10d8757dfd75da14fd21ac
-----END OpenVPN Static key V1-----
x
-----BEGIN CERTIFICATE-----
MIIDSzCCAjOgAwIBAgIUW5NhoHubpdB2QE1IdTqCZeD4CK4wDQYJKoZIhvcNAQEL
BQAwFjEUMBIGA1UEAwwLRWFzeS1SU0EgQ0EwHhcNMjExMTA1MTcxNDQ4WhcNMzEx
MTAzMTcxNDQ4WjAWMRQwEgYDVQQDDAtFYXN5LVJTQSBDQTCCASIwDQYJKoZIhvcN
AQEBBQADggEPADCCAQoCggEBALGvwj57vpugazdMtjIVngKybzapSfT7rm1Rv+d2
SssBwsTf4kDXqfwQiQLPEDo5mpxIO1XBEhsNS3CeBBSfGHgvT3EbiXKLS0mpMiIK
nayJJh2+v3xg+3EU5jemNJ8p3iqsWz566ds/C6haZsp9cM5oGBOOSbHOMJo4S6+6
XmZfi8sdCWlSxrntd74MmEPI7wvmClA5xaM3hfzpHXdhrcTr9JDVMf0sYSkXUbc5
nyDQrLtcZiVyoPCJxB41OoTYd1aLDV/7F+A6ShSQSw/04jQq3yoyQd9qMZUfPieE
edjBiVtaN/ecNGdJM7u7k2L3ADe+ObX9o3Dq6evmxWPUtSECAwEAAaOBkDCBjTAd
BgNVHQ4EFgQUvMfE2qXU2IZw4c5X+i48cGji1/owUQYDVR0jBEowSIAUvMfE2qXU
2IZw4c5X+i48cGji1/qhGqQYMBYxFDASBgNVBAMMC0Vhc3ktUlNBIENBghRbk2Gg
e5ul0HZATUh1OoJl4PgIrjAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkq
hkiG9w0BAQsFAAOCAQEAn5mckexf90rXn/xjzhKSbc2pNarQJ/YcmQ5xpRwv8D6x
GQieEk9BB8iWzaufH0cW+LI80zZYpjMg1qygKDoPIRryn0MVsr03XRCxnQRlkC7f
ow62PMXOp31ru1vq0ar/BjYE9EhQVEFdErhmc0FMmrkWP7H5rwRX7GO5T3wNfO3q
+rftpJiCVeY4lFWyNuHKZv3n8DtfwOoT5ybpJ31/mn6i/SWfaJa5gY9I8+jh6q7m
bRcTvNQk+G1ApgJZuoV5shAPZg6oJZVvU9q8FryMmcPxB4dTZwA3NIZfjQs8Q7lD
B0/XhJ+bjQvtC2YLfNLZgsEwOrUGs+ZCbL3T1FyLpg==
-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
a8:92:f9:c5:d7:40:22:75:38:b8:b6:b6:1e:b1:8c:2c
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=Easy-RSA CA
Validity
Not Before: Nov 5 17:20:19 2021 GMT
Not After : Feb 8 17:20:19 2024 GMT
Subject: CN=koromicha
Subject Public Key Info:
x
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
Modulus:
00:d1:f5:5f:c8:1e:6c:c5:35:fe:9a:68:d1:91:2d:
cb:11:b3:08:ed:47:3a:b8:32:74:df:f1:b7:78:be:
25:fc:95:73:be:6b:de:c8:89:1d:39:5e:72:4d:ea:
a3:13:2a:c9:29:44:2e:17:fc:48:d9:6c:8b:2f:ca:
a4:e5:90:43:a9:8b:a2:7a:bb:b5:c8:7a:6a:fe:9d:
4b:aa:67:78:e8:3f:53:9e:9d:b3:25:77:a1:22:f3:
b1:f0:82:97:9e:f5:14:b2:93:de:c5:20:84:05:54:
d5:70:ad:d5:4f:41:04:a6:56:04:08:e9:45:ea:eb:
c2:00:da:ee:1b:b4:30:74:c5:9e:76:6d:49:0c:8c:
7e:45:8a:e5:93:1a:d0:f6:70:1a:73:df:b2:eb:68:
2d:7a:1e:68:00:9e:b1:1f:1d:14:75:1b:89:56:b2:
e8:8e:84:e6:ea:39:50:93:0d:0e:30:6d:fc:97:3e:
6a:66:c3:cc:f3:93:12:5c:38:b4:62:ef:58:7f:a7:
70:05:2c:2d:f0:54:5e:7e:7a:98:ea:af:8d:6d:2e:
9c:47:80:1f:26:67:b4:2d:44:11:2f:6d:a5:9a:96:
7f:b5:ae:f8:48:61:ca:5c:f8:d5:1b:44:40:8b:fc:
97:01:5e:15:24:28:c6:24:81:39:d4:e0:3d:1f:81:
9a:11
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Subject Key Identifier:
B1:97:65:D8:90:01:7E:57:CA:11:73:4D:E2:E3:83:6F:71:B9:1B:6E
X509v3 Authority Key Identifier:
keyid:BC:C7:C4:DA:A5:D4:D8:86:70:E1:CE:57:FA:2E:3C:70:68:E2:D7:FA
DirName:/CN=Easy-RSA CA
serial:5B:93:61:A0:7B:9B:A5:D0:76:40:4D:48:75:3A:82:65:E0:F8:08:AE
So depending on the method you used above to define the DNS server address you can proceed to
configure OpenVPN clients to use specific DNS server as follows.
x
In this tutorial, we are using a Linux system, specifically, Debian 11/Rocky Linux 8 as our OpenVPN
clients for demonstration purposes.
On Ubuntu/Debian Systems:
Next, edit the OpenVPN client configuration file and add the lines below;
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
cat client-1.ovpn
client
tls-client
pull
dev tun
proto udp4 x
remote 192.168.58.22 1194
resolv-retry infinite
nobind
persist-key
persist-tun
key-direction 1
remote-cert-tls server
auth-nocache
comp-lzo
verb 3
auth SHA512
cipher AES-256-CBC
data-ciphers AES-256-CBC
comp-lzo no
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
a8:92:f9:c5:d7:40:22:75:38:b8:b6:b6:1e:b1:8c:2c
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=Easy-RSA CA
Validity
Not Before: Nov 5 17:20:19 2021 GMT
Not After : Feb 8 17:20:19 2024 GMT
Subject: CN=koromicha
Subject Public Key Info:
x
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
Modulus:
00:d1:f5:5f:c8:1e:6c:c5:35:fe:9a:68:d1:91:2d:
cb:11:b3:08:ed:47:3a:b8:32:74:df:f1:b7:78:be:
25:fc:95:73:be:6b:de:c8:89:1d:39:5e:72:4d:ea:
a3:13:2a:c9:29:44:2e:17:fc:48:d9:6c:8b:2f:ca:
a4:e5:90:43:a9:8b:a2:7a:bb:b5:c8:7a:6a:fe:9d:
4b:aa:67:78:e8:3f:53:9e:9d:b3:25:77:a1:22:f3:
b1:f0:82:97:9e:f5:14:b2:93:de:c5:20:84:05:54:
d5:70:ad:d5:4f:41:04:a6:56:04:08:e9:45:ea:eb:
c2:00:da:ee:1b:b4:30:74:c5:9e:76:6d:49:0c:8c:
7e:45:8a:e5:93:1a:d0:f6:70:1a:73:df:b2:eb:68:
2d:7a:1e:68:00:9e:b1:1f:1d:14:75:1b:89:56:b2:
e8:8e:84:e6:ea:39:50:93:0d:0e:30:6d:fc:97:3e:
6a:66:c3:cc:f3:93:12:5c:38:b4:62:ef:58:7f:a7:
70:05:2c:2d:f0:54:5e:7e:7a:98:ea:af:8d:6d:2e:
9c:47:80:1f:26:67:b4:2d:44:11:2f:6d:a5:9a:96:
7f:b5:ae:f8:48:61:ca:5c:f8:d5:1b:44:40:8b:fc:
97:01:5e:15:24:28:c6:24:81:39:d4:e0:3d:1f:81:
9a:11
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Subject Key Identifier:
B1:97:65:D8:90:01:7E:57:CA:11:73:4D:E2:E3:83:6F:71:B9:1B:6E
X509v3 Authority Key Identifier:
keyid:BC:C7:C4:DA:A5:D4:D8:86:70:E1:CE:57:FA:2E:3C:70:68:E2:D7:FA
DirName:/CN=Easy-RSA CA
serial:5B:93:61:A0:7B:9B:A5:D0:76:40:4D:48:75:3A:82:65:E0:F8:08:AE
x
openvpn client-1.ovpn
2021-11-08 14:25:09 WARNING: Compression for receiving enabled. Compression has bee
2021-11-08 14:25:09 OpenVPN 2.5.1 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [
2021-11-08 14:25:09 library versions: OpenSSL 1.1.1k 25 Mar 2021, LZO 2.10
2021-11-08 14:25:09 NOTE: the current --script-security setting may allow this conf
2021-11-08 14:25:09 Outgoing Control Channel Authentication: Using 512 bit message
2021-11-08 14:25:09 Incoming Control Channel Authentication: Using 512 bit message
2021-11-08 14:25:09 TCP/UDP: Preserving recently used remote address: [AF_INET]192.
2021-11-08 14:25:09 Socket Buffers: R=[212992->212992] S=[212992->212992]
2021-11-08 14:25:09 UDPv4 link local: (not bound)
2021-11-08 14:25:09 UDPv4 link remote: [AF_INET]192.168.58.22:1194
2021-11-08 14:25:09 TLS: Initial packet from [AF_INET]192.168.58.22:1194, sid=0a659
2021-11-08 14:25:09 VERIFY OK: depth=1, CN=Easy-RSA CA
2021-11-08 14:25:09 VERIFY KU OK
2021-11-08 14:25:09 Validating certificate extended key usage
2021-11-08 14:25:09 ++ Certificate has EKU (str) TLS Web Server Authentication, exp
2021-11-08 14:25:09 VERIFY EKU OK
2021-11-08 14:25:09 VERIFY OK: depth=0, CN=server
2021-11-08 14:25:09 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384
2021-11-08 14:25:09 [server] Peer Connection Initiated with [AF_INET]192.168.58.22:
2021-11-08 14:25:09 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway
x de
2021-11-08 14:25:09 OPTIONS IMPORT: timers and/or timeouts modified
2021-11-08 14:25:09 OPTIONS IMPORT: --ifconfig/up options modified
2021-11-08 14:25:09 OPTIONS IMPORT: route options modified
2021-11-08 14:25:09 OPTIONS IMPORT: route-related options modified
2021-11-08 14:25:09 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modifie
2021-11-08 14:25:09 OPTIONS IMPORT: peer-id set
2021-11-08 14:25:09 OPTIONS IMPORT: adjusting link_mtu to 1625
2021-11-08 14:25:09 OPTIONS IMPORT: data channel crypto options modified
2021-11-08 14:25:09 Outgoing Data Channel: Cipher 'AES-256-CBC' initialized with 25
2021-11-08 14:25:09 Outgoing Data Channel: Using 512 bit message hash 'SHA512' for
2021-11-08 14:25:09 Incoming Data Channel: Cipher 'AES-256-CBC' initialized with 25
2021-11-08 14:25:09 Incoming Data Channel: Using 512 bit message hash 'SHA512' for
2021-11-08 14:25:09 net_route_v4_best_gw query: dst 0.0.0.0
2021-11-08 14:25:09 net_route_v4_best_gw result: via 10.0.2.2 dev enp0s3
2021-11-08 14:25:09 ROUTE_GATEWAY 10.0.2.2/255.255.255.0 IFACE=enp0s3 HWADDR=08:00:
2021-11-08 14:25:09 TUN/TAP device tun0 opened
2021-11-08 14:25:09 net_iface_mtu_set: mtu 1500 for tun0
2021-11-08 14:25:09 net_iface_up: set tun0 up
2021-11-08 14:25:09 net_addr_v4_add: 10.8.0.2/24 dev tun0
2021-11-08 14:25:09 /etc/openvpn/update-resolv-conf tun0 1500 1625 10.8.0.2 255.255
dhcp-option DNS 192.168.58.22
dhcp-option DNS 8.8.8.8
dhcp-option DOMAIN kifarunix-demo.com
2021-11-08 14:25:10 net_route_v4_add: 192.168.58.22/32 via 10.0.2.2 dev [NULL] tabl
2021-11-08 14:25:10 net_route_v4_add: 0.0.0.0/1 via 10.8.0.1 dev [NULL] table 0 met
2021-11-08 14:25:10 net_route_v4_add: 128.0.0.0/1 via 10.8.0.1 dev [NULL] table 0 m
2021-11-08 14:25:10 Initialization Sequence Completed
This updates the /etc/resolv.conf file with your custom DNS entries;
x
cat /etc/resolv.conf
# Generated by resolvconf
search kifarunix-demo.com
nameserver 192.168.58.22
nameserver 8.8.8.8
192.168.59.14
On CentOS/RHEL/Rocky Linux:
install update-systemd-resolved
x
git clone https://github.com/jonathanio/update-systemd-resolved.git
cd update-systemd-resolved
make
Sample output;
Update the /etc/nsswitch.conf file to look up DNS via the resolve (systemd-
resolved.service) service. (Use /etc/resolv.conf first, then fall back to systemd-resolved)
cat client-1.ovpn
client
tls-client
pull
dev tun
proto udp4
remote 192.168.58.22 1194
resolv-retry infinite
nobind
persist-key
persist-tun
key-direction 1
remote-cert-tls server
x
auth-nocache
comp-lzo
verb 3
auth SHA512
cipher AES-256-CBC
comp-lzo no
setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
script-security 2
up /etc/openvpn/scripts/update-systemd-resolved
up-restart
down /etc/openvpn/scripts/update-systemd-resolved
down-pre
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
ec31b288a9a3865c4b5f3583b481ff5c
434e957be6569ed573a58a102ce53efc
b9528f15f5412046c5a603e6916b565b
fe2c6a0f955dcec2d3f7e6cec7e373bb
dff40b041f1488d4177c3de04bdff43b
e361eff6328c499621e0846ec72565ef
734fc02e51540d1c5c19102156a080f7
fde124822bf6fc802dff9facf24998de
6f91f081dafcdd28f4bca9223afe694d
12d57beb6aed96753d651a2ca4722214
5fa87829b9f53f2ccb89d9f15112c9cd
3594ead75bc1df737b50188c2829d724
3aff136577b3c79e6f863112aadf5aeb
8b6d53c607874c71104acfa22e587bd3
22b14a2c0a91e15569d99d5e35a52a8b
0aa4f24ccf10d8757dfd75da14fd21ac
-----END OpenVPN Static key V1-----
x
-----BEGIN CERTIFICATE-----
MIIDSzCCAjOgAwIBAgIUW5NhoHubpdB2QE1IdTqCZeD4CK4wDQYJKoZIhvcNAQEL
BQAwFjEUMBIGA1UEAwwLRWFzeS1SU0EgQ0EwHhcNMjExMTA1MTcxNDQ4WhcNMzEx
MTAzMTcxNDQ4WjAWMRQwEgYDVQQDDAtFYXN5LVJTQSBDQTCCASIwDQYJKoZIhvcN
AQEBBQADggEPADCCAQoCggEBALGvwj57vpugazdMtjIVngKybzapSfT7rm1Rv+d2
SssBwsTf4kDXqfwQiQLPEDo5mpxIO1XBEhsNS3CeBBSfGHgvT3EbiXKLS0mpMiIK
nayJJh2+v3xg+3EU5jemNJ8p3iqsWz566ds/C6haZsp9cM5oGBOOSbHOMJo4S6+6
XmZfi8sdCWlSxrntd74MmEPI7wvmClA5xaM3hfzpHXdhrcTr9JDVMf0sYSkXUbc5
nyDQrLtcZiVyoPCJxB41OoTYd1aLDV/7F+A6ShSQSw/04jQq3yoyQd9qMZUfPieE
edjBiVtaN/ecNGdJM7u7k2L3ADe+ObX9o3Dq6evmxWPUtSECAwEAAaOBkDCBjTAd
BgNVHQ4EFgQUvMfE2qXU2IZw4c5X+i48cGji1/owUQYDVR0jBEowSIAUvMfE2qXU
2IZw4c5X+i48cGji1/qhGqQYMBYxFDASBgNVBAMMC0Vhc3ktUlNBIENBghRbk2Gg
e5ul0HZATUh1OoJl4PgIrjAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkq
hkiG9w0BAQsFAAOCAQEAn5mckexf90rXn/xjzhKSbc2pNarQJ/YcmQ5xpRwv8D6x
GQieEk9BB8iWzaufH0cW+LI80zZYpjMg1qygKDoPIRryn0MVsr03XRCxnQRlkC7f
ow62PMXOp31ru1vq0ar/BjYE9EhQVEFdErhmc0FMmrkWP7H5rwRX7GO5T3wNfO3q
+rftpJiCVeY4lFWyNuHKZv3n8DtfwOoT5ybpJ31/mn6i/SWfaJa5gY9I8+jh6q7m
bRcTvNQk+G1ApgJZuoV5shAPZg6oJZVvU9q8FryMmcPxB4dTZwA3NIZfjQs8Q7lD
B0/XhJ+bjQvtC2YLfNLZgsEwOrUGs+ZCbL3T1FyLpg==
-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
a8:92:f9:c5:d7:40:22:75:38:b8:b6:b6:1e:b1:8c:2c
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=Easy-RSA CA
Validity
Not Before: Nov 5 17:20:19 2021 GMT
Not After : Feb 8 17:20:19 2024 GMT
Subject: CN=koromicha
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
x
Modulus:
00:d1:f5:5f:c8:1e:6c:c5:35:fe:9a:68:d1:91:2d:
cb:11:b3:08:ed:47:3a:b8:32:74:df:f1:b7:78:be:
25:fc:95:73:be:6b:de:c8:89:1d:39:5e:72:4d:ea:
a3:13:2a:c9:29:44:2e:17:fc:48:d9:6c:8b:2f:ca:
a4:e5:90:43:a9:8b:a2:7a:bb:b5:c8:7a:6a:fe:9d:
4b:aa:67:78:e8:3f:53:9e:9d:b3:25:77:a1:22:f3:
b1:f0:82:97:9e:f5:14:b2:93:de:c5:20:84:05:54:
d5:70:ad:d5:4f:41:04:a6:56:04:08:e9:45:ea:eb:
c2:00:da:ee:1b:b4:30:74:c5:9e:76:6d:49:0c:8c:
7e:45:8a:e5:93:1a:d0:f6:70:1a:73:df:b2:eb:68:
2d:7a:1e:68:00:9e:b1:1f:1d:14:75:1b:89:56:b2:
e8:8e:84:e6:ea:39:50:93:0d:0e:30:6d:fc:97:3e:
6a:66:c3:cc:f3:93:12:5c:38:b4:62:ef:58:7f:a7:
70:05:2c:2d:f0:54:5e:7e:7a:98:ea:af:8d:6d:2e:
9c:47:80:1f:26:67:b4:2d:44:11:2f:6d:a5:9a:96:
7f:b5:ae:f8:48:61:ca:5c:f8:d5:1b:44:40:8b:fc:
97:01:5e:15:24:28:c6:24:81:39:d4:e0:3d:1f:81:
9a:11
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Subject Key Identifier:
B1:97:65:D8:90:01:7E:57:CA:11:73:4D:E2:E3:83:6F:71:B9:1B:6E
X509v3 Authority Key Identifier:
keyid:BC:C7:C4:DA:A5:D4:D8:86:70:E1:CE:57:FA:2E:3C:70:68:E2:D7:FA
DirName:/CN=Easy-RSA CA
serial:5B:93:61:A0:7B:9B:A5:D0:76:40:4D:48:75:3A:82:65:E0:F8:08:AE
x
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDR9V/IHmzFNf6a
aNGRLcsRswjtRzq4MnTf8bd4viX8lXO+a97IiR05XnJN6qMTKskpRC4X/EjZbIsv
yqTlkEOpi6J6u7XIemr+nUuqZ3joP1OenbMld6Ei87Hwgpee9RSyk97FIIQFVNVw
rdVPQQSmVgQI6UXq68IA2u4btDB0xZ52bUkMjH5FiuWTGtD2cBpz37LraC16HmgA
nrEfHRR1G4lWsuiOhObqOVCTDQ4wbfyXPmpmw8zzkxJcOLRi71h/p3AFLC3wVF5+
epjqr41tLpxHgB8mZ7QtRBEvbaWaln+1rvhIYcpc+NUbRECL/JcBXhUkKMYkgTnU
4D0fgZoRAgMBAAECggEBAMBTVd7Zx+dK06Ob+sRTP15CMx4vjmFmjtsI73jiLafX
O0QmSdhGiYegtXIcSi9nlQeBFfwQtKa+IC2yIiTLZr+rUjW9NwKi6Nm9Oq+owv9z
6uQ0LwNWNzvuIYRgDAWnGMOQYpMOewDrOe1Sv0AvHdREnMOQ8+QC/B6ObWjhQTXk
mqyvCY2IEg22upif5kDPLul6FtGuGwzUQwxYVfyOem0ECVJ4yotuS4ie8D36fxKD
utY18RJGhG9J1gRHJmQYcuB9jRkuVuno8pBdR3jabCE68DzpzOXvV4LHTIAxJtEz
NEZbzgwmf7TPg84pahaLYQOyxQpu8P6xm6QhBfTEPAECgYEA+UIKiGTlvy/EX8st
5I7PI8yhPJI8fbq/9oqjd5nwsUbzngdeuyy7HxruzAPQA/bFGSTikyf9jHPYAqZ0
7GGx9KCgbXyGNUk90ipHEqzXomrEjIh9y3qAQu+VLt4XILAfrDgV+QUITXIsRCnY
tOg4CdUJFJg5uQblR/AZCSx+9MECgYEA16M1SiSImoydUKvtl+4Jzqn4CSg3cKya
xWWtXYQLrh6PMOoKy/idGV6Xcl5H57xASqxjehyL5VzaBw6mSmcIuuovbuMWpI4Q
zVZQEgizsDtEFNr8tQ+qtlXR7DwEkUOLtfQaULDD9LR1OMM06x9Py9UxCbfi3/Dl
Kod8GFazaVECgYAleV1WBj1YUhknAcgDjcjsq+4tyhqYGISVz2AmMhmyvWURBDCk
2WPEmGsAdy5F+krFrfr2ftOq0xvNwjLf+wwjKCcWbttKlZlayIpo7114CK9GJZss
BV3VMmnuYut9OZ15afE7wBrwcdLf6J6xDByotcOouf4rqDK+bwWEkJEBwQKBgQDN
4OIhDq5puDT+b5fhhYBRkw/gVkhQSEtgigoyjb7FGCIoVlvGkHAVZ616oS9Pvfk4
EkzLqnOaocL8F+2GfcblBnARE7lrlMPP+EdsYGiGqp7+tnGtwO6BNYC+ZjMKKg46
w3tYbNw6RwzgC+f7UCLUfpBaMfnnS0zRBRfi+OxEcQKBgEMEes7DT5sqoQkam9lk
AmP8NK+eAoB7RWk8A1ADBlz48xmIH/lR99su9bWWd0xthYuBvx3ZpPRTqp0Z2ehm
7w3jnw+A7BZn1/gmcXLCXexQl+tn0nfm87xpwXCDmHjZzdldzLMpjOMHZDmOcufN
y30Rsmt3vdeo5Rv+whSSypnq
-----END PRIVATE KEY-----
x
openvpn client-1.ovpn
Tue Nov 9 00:02:52 2021 OpenVPN 2.4.11 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZ
Tue Nov 9 00:02:52 2021 library versions: OpenSSL 1.1.1g FIPS 21 Apr 2020, LZO 2.
Tue Nov 9 00:02:52 2021 NOTE: the current --script-security setting may allow this
Tue Nov 9 00:02:52 2021 Outgoing Control Channel Authentication: Using 512 bit mes
Tue Nov 9 00:02:52 2021 Incoming Control Channel Authentication: Using 512 bit mes
Tue Nov 9 00:02:52 2021 TCP/UDP: Preserving recently used remote address: [AF_INET
Tue Nov 9 00:02:52 2021 Socket Buffers: R=[212992->212992] S=[212992->212992]
Tue Nov 9 00:02:52 2021 UDPv4 link local: (not bound)
Tue Nov 9 00:02:52 2021 UDPv4 link remote: [AF_INET]192.168.58.22:1194
Tue Nov 9 00:02:52 2021 TLS: Initial packet from [AF_INET]192.168.58.22:1194, sid=
Tue Nov 9 00:02:52 2021 VERIFY OK: depth=1, CN=Easy-RSA CA
Tue Nov 9 00:02:52 2021 VERIFY KU OK
Tue Nov 9 00:02:52 2021 Validating certificate extended key usage
Tue Nov 9 00:02:52 2021 ++ Certificate has EKU (str) TLS Web Server Authentication
Tue Nov 9 00:02:52 2021 VERIFY EKU OK
Tue Nov 9 00:02:52 2021 VERIFY OK: depth=0, CN=server
Tue Nov 9 00:02:52 2021 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_S
Tue Nov 9 00:02:52 2021 [server] Peer Connection Initiated with [AF_INET]192.168.5
Tue Nov 9 00:02:53 2021 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Tue Nov 9 00:02:53 2021 PUSH: Received control message: 'PUSH_REPLY,redirect-gatew
Tue Nov 9 00:02:53 2021 OPTIONS IMPORT: timers and/or timeouts modified
x
Tue Nov 9 00:02:53 2021 OPTIONS IMPORT: --ifconfig/up options modified
Tue Nov 9 00:02:53 2021 OPTIONS IMPORT: route options modified
Tue Nov 9 00:02:53 2021 OPTIONS IMPORT: route-related options modified
Tue Nov 9 00:02:53 2021 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options mo
Tue Nov 9 00:02:53 2021 OPTIONS IMPORT: peer-id set
Tue Nov 9 00:02:53 2021 OPTIONS IMPORT: adjusting link_mtu to 1625
Tue Nov 9 00:02:53 2021 OPTIONS IMPORT: data channel crypto options modified
Tue Nov 9 00:02:53 2021 Outgoing Data Channel: Cipher 'AES-256-CBC' initialized wi
Tue Nov 9 00:02:53 2021 Outgoing Data Channel: Using 512 bit message hash 'SHA512'
Tue Nov 9 00:02:53 2021 Incoming Data Channel: Cipher 'AES-256-CBC' initialized wi
Tue Nov 9 00:02:53 2021 Incoming Data Channel: Using 512 bit message hash 'SHA512'
Tue Nov 9 00:02:53 2021 ROUTE_GATEWAY 10.0.2.2/255.255.255.0 IFACE=enp0s3 HWADDR=0
Tue Nov 9 00:02:53 2021 TUN/TAP device tun0 opened
Tue Nov 9 00:02:53 2021 TUN/TAP TX queue length set to 100
Tue Nov 9 00:02:53 2021 /sbin/ip link set dev tun0 up mtu 1500
Tue Nov 9 00:02:53 2021 /sbin/ip addr add dev tun0 10.8.0.2/24 broadcast 10.8.0.25
Tue Nov 9 00:02:53 2021 /etc/openvpn/scripts/update-systemd-resolved tun0 1500 160
<14>Nov 9 00:02:53 update-systemd-resolved: Link 'tun0' coming up
<14>Nov 9 00:02:53 update-systemd-resolved: Adding IPv4 DNS Server 192.168.58.22
<14>Nov 9 00:02:53 update-systemd-resolved: Adding IPv4 DNS Server 8.8.8.8
<14>Nov 9 00:02:53 update-systemd-resolved: Adding DNS Domain kifarunix-demo.com
<14>Nov 9 00:02:53 update-systemd-resolved: SetLinkDNS(22 2 2 4 192 168 58 22 2 4
<14>Nov 9 00:02:53 update-systemd-resolved: SetLinkDomains(22 1 kifarunix-demo.com
Tue Nov 9 00:02:53 2021 /sbin/ip route add 192.168.58.22/32 via 10.0.2.2
Tue Nov 9 00:02:53 2021 /sbin/ip route add 0.0.0.0/1 via 10.8.0.1
Tue Nov 9 00:02:53 2021 /sbin/ip route add 128.0.0.0/1 via 10.8.0.1
Tue Nov 9 00:02:53 2021 Initialization Sequence Completed
x
Read more about DNS leakage.
And that is how you can configure OpenVPN clients to use specific DNS Server.
Other Tutorials
! #$ %&'(
)*+,
-./-'012%3
)
- '4
54&+5-5
/ -6)
()
672$$-,
8-,
9:5
)3
;<'54
:33
:'=$-4
+/1&>-,
72$ =?)
'&'@A+'4
+BCD
CE &/-'8/'63
)
- '4='5
&/-'8/'=F6/G
&/4
)&'='5'&4>&,
H)'* &/-'8/'=F6/G
&/4
)&'=&?:)
' &/-'8/'&8-,
,)
=-='5
㩳 # 㤘
!"#$
%&'(
)*+
,--,..)(
/)('0%
#&1)23%
#"# +
#06
477
4#8.)6
'9%
:1%
#8";0<4#4&)("#
-)2%
4#55 -)2%4#5x
5
!
"#"$%
&'(
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a
Blue Teamer who loves to share technological tips and hacks with others as a way of sharing
knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".
RELATED ARTICLES
How to Use Cloud-Based APIs for File Uploading and File Hosting
Jay Decrame - March 30, 2022
NO COMMENTS
LEAVE A REPLY
x
Save my name, email, and website in this browser for the next time I comment.
POST COMMENT
ABOUT US
Kifarunix is a blog dedicated to providing tips, tricks and HowTos for *Nix enthusiasts; Command
cheat sheets, monitoring, server configurations, virtualization, systems security, networking…the
whole FOSS technologies. The major aim of all this is to share our *Nix skills and knowledge with
anyone who is interested especially the upcoming system admins. Stay connected and let us grow
together.
FOLLOW US
# 㘚
x
report this ad