5

I want my PC (Debian Jessie, running OpenVPN) to only use my VPN DNS. My resolv.conf file looks like this:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.4.0.1
nameserver 192.168.0.1
search sitecomwl351

I only want it to use the 10.4.0.1 address for DNS. Trying to manually remove the 192.168 line is just a temporary fix, as the line will be automatically readded as soon as I turn the VPN connection off and back on. I don't know where it is coming from and how to turn it off, can't find a way to remove it in the Network Manager either.

Any ideas?

mlamsdif
  • 51
  • 1
  • 2
  • See this answer http://unix.stackexchange.com/questions/285735/how-to-automatically-fetch-new-name-server-on-vpn-connect/288285#288285 (openresolv with '-x' should do the trick). – ysdx Dec 21 '16 at 11:46

2 Answers2

1

You probably have to update your network card configuration.

Usually this is in /etc/sysconfig/network-scripts on most RHEL/CentOs distributions.

You edit the file named ifcfg-ethX that matches your nic.

In here you can add/update DNS1=10.X.X.X which will then be put in resolve.conf.

You can also add PEERDNS="no" .

Likely the mystery DNS server in resolve.conf is being picked up from the local network aka peer dns.

Setting these will make it static without changing resolve.conf

Restart network services to enable changes.

GAD3R
  • 63,407
  • 31
  • 131
  • 192
Blake Russo
  • 88
  • 1
  • 1
  • 7
0

You should remove 192.168.0.1 as Nameserver from your VPN configuration when you didnt accept it again.Or you created resolv.bak contains 10.4.0.1 as nameserver and copy resolv.bak to resolv.conf when you connnected to your vpn.I mean you should overwrite resolv.conf.

supriady
  • 167
  • 2
  • 11