Add/Change DNS server list via command line
I am using the DNS resolver and have a VPN set up. The DNS resolver has DNS query forwarding on and so gets the DNS server from the general settings tab.
Is there any way to change this from the command line as the VPN's DNS changes and I have to manually change this setting in the general settings tab.
I've tried changing the /etc/resolv.conf file but I'm not sure if I need to reload something after changing this as it doesn't seem to update in the general settings tab (it does change the display on the main page however).
Thanks for your help
@trew13 said in Add/Change DNS server list via command line:
as the VPN's DNS changes
During a VPN session your DNS changes ?
Editing /etc/resolv.conf file - or any system file - isn't a good idea, it's the GUI that controls everything.
Thanks for the reply.
When I get disconnected, and then reconnect, I get assigned a new IP address and I need to forward the DNS to that same address with a one at the end.
So for instance if I get assigned the IP 10.20.30.40, the new place to forward DNS will be 10.20.30.1
For now every time I get disconnected I need to manually check the IP address and change the settings. I was going to write a cron script to monitor and change this. Is there a better way to approach this problem?
Never saw a situation like that, neither some VPN setup that works like that.
I use pfSense as a VPN server for remote login only. VPN handles all the DNS stuff.
Just to clarify, this is using the VPN client. The VPN I connect to requires me to change where I'm sending the DNS to get it to work properly.
THe VPN server (pfSense ?) could push the DNS to the client.