Skip to content

How to Permanently Set DNS (VPN Provider Seems to Change it)

I'd like to keep my DNS permanent. AFAIK it's not possible on my system, which isn't good. I believe it's the NordVPN cli app which is changing it. Steps I've taken so far with adding my DNS server of choice:

  • edited /etc/resolv.conf and made immutable with chattr
  • edited /etc/resolvconf/resolv.conf.d/head and /etc/resolvconf/resolv.conf.d/base
  • edited /run/resolvconf/interfaces/tun0
  • edited /etc/NetworkManager/NetworkManager.conf

The network manager and resolvconf head/base files stay as I've edited them, but the /run/resolvconf/interfaces/tun0 file gets changed as does my etc/resolv.conf. I found all these interfaces by looking through several Arch forum threads as well as askubuntu threads, so believe me I am trying. I cannot make the tun0 interface file immutable as apparently the /run filesystem does not accept flags. I just don't want my DNS to change, and NordVPN doesn't seem to be of any help. If anyone knows how to enforce read-only on these files that would be great, or perhaps a better solution. All help is appreciated.

8 points5 comments
Open on Reddit
About this post
Posted
Archived
Score
8 · 100% up
Kind
Text
ID
e07tt5

Author

14
posts
89
comments
3
media
View profile

6 comments

Can you not manually set up the VPN profile in nm with your own dns settings?

3 points

I originally was doing that, but swapping between servers, a killswitch, and VPN setting management was not quickly performed.

For the moment I'm trying making a symbolic link to my own resolv.conf that's immutable and read only. I tried connecting to a few different servers and it didn't seem to alter the file, so that solution may have worked, albeit a bit hacky.

1 points

I initially had DNS problems when learning to set up a VPN, but they were solved by installing package openresolv. After that, the DNS was properly changed to that of the VPN provider when I start openVPN, then changed back to my "normal" DNS when openVPN is terminated.

2 points
unknown author

Deleted before we saved it.

1 points

configuring the app would be the best solution, but if not…

is the vpn app running as root? if not you could make sure it's read-only

if not, you could run the vpn app in a chroot

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.