In Android we have applications like daedalus which is a local VPN (Not remote) and used to change DNS quickly. I need such way in Ubuntu in order to change DNS whenever needed.
Do we have any way to create such VPN which doesn't make remote tunnel and just changes DNS? Or any other way to switch DNS servers as I need to switch my DNS frequently.
12 Answers
The possible way to do it is:
Disable DNS cache (for example, this way )
Change your connection to "Automatic (addresses only)"
Add your DNS and then change it.
Another way is to create your own local DNS which will redirect you to another one, set it as your default DNS and then just change setting of your local DNS. But it's not too easy.
In Android VPN is probably needed because you can't access network settings directly.
One more way is to do it with network-manager console client like this:
nmcli con modify eth0 +ipv4.dns 8.8.8.8 # add 8.8.8.8 to IPv4 DNS list servers
nmcli con modify eth0 -ipv4.dns 8.8.8.8 # remove 8.8.8.8 from list of DNSNote: Replace eth0 by name of your network interface if needed.
You can also create bash aliases for these commands, appending following lines to ~/.bashrc
alias dns_add='nmcli con modify eth0 +ipv4.dns'
alias dns_rm='nmcli con modify eth0 -ipv4.dns'And the use them like this:
$ dns_add 8.8.8.8
$ dns_rm 8.8.8.8 8 I did it this way:
/bin/dnsme:
#!/bin/bash
sudo cp /etc/resolv.conf /etc/resolv-original.conf
sudo cp /etc/resolv-dnsme.conf /etc/resolv.conf/bin/undnsme:
#!/bin/bash
sudo cp /etc/resolv-original.conf /etc/resolv.confin /etc/resolv-dnsme.conf:
nameserver x.x.x.x
nameserver x.x.x.x
options edns0