2

I have an OpenVPN server running with the following config file

port 1194
proto tcp
dev tun
ca ca.crt
cert server.crt
key server.key 
dh dh2048.pem
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
tls-crypt myvpn.tlsauth
cipher AES-256-CBC
compress lz4-v2
push "compress lz4-v2"
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log /var/log/openvpn.log
verb 3
remote-cert-eku "TLS Web Client Authentication"

and I have different clients connected, on Debian machines I used the following config file

client
tls-client
ca ca.crt
cert pibox.crt
key pibox.key
tls-crypt myvpn.tlsauth
proto tcp
remote X.X.X.X 1194 tcp
dev tun
topology subnet
cipher AES-256-CBC
log /var/log/openvpn.log
pull
script-security 2                     
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

all is working fine, I can access to my VPN and also I have access to the internet, I'm trying to set up a CentOS 7 client for which I used the same config file but since

script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

cannot be used, I'm not sure how can I configure the DNS, I research and some people mention openresolv, I also tried with

pull-filter ignore "dhcp-option DNS"

but nothing works, also, I read this but I don't have

/usr/share/openvpn/update-resolv-conf
/usr/share/openvpn/update-resolv-conf

What is the correct procedure to configure the DNS on a CentOS client?

Frederick Álvarez
  • 153
  • 1
  • 2
  • 7

2 Answers2

3

I managed to fix it, what I did was

cd /etc/yum.repos.d
sudo wget https://copr.fedorainfracloud.org/coprs/macieks/openresolv/repo/epel-7/macieks-openresolv-epel-7.repo
sudo yum update
sudo yum install openresolv

it will create /etc/resolv.conf

then I modified it to set my custom DNS

# Generated by NetworkManager
search Home
nameserver 8.8.8.8
nameserver 8.8.4.4

client

client
tls-client
ca ca.crt
cert i7box.crt
key i7box.key
tls-crypt myvpn.tlsauth
proto tcp
remote x.x.x.x 1194 tcp
dev tun
topology subnet
cipher AES-256-CBC
log /var/log/openvpn.log
pull

also I desabled the automatic DNS and I put static ones, if you know a better method let me know

GUI static DNS

Frederick Álvarez
  • 153
  • 1
  • 2
  • 7
0

on server side (OPenVPN server) go to your server.conf file normally it exist vim /etc/openvpn/server.conf or vim /etc/openvpn/server/server.conf modify this line according to you desire DNS server

push "dhcp-option DNS 8.8.8.8"

this will modify client side dns setting on the run