To set the DNS settings from the command line in Linux or Unix, you can use the nmcli
command.
To set the DNS servers, you can use the following command:
sudo nmcli con modify <connection name> ipv4.dns "8.8.8.8 8.8.4.4"Source:www.lautturi.com
Replace <connection name>
with the name of the connection you want to modify, and replace the IP addresses with the DNS servers you want to use. You can specify multiple DNS servers by separating them with a space.
To apply the changes, you can use the following command:
sudo nmcli con down <connection name> && nmcli con up <connection name>
Replace <connection name>
with the name of the connection you modified. This will bring the connection down and then bring it back up, which will apply the changes you made.
Keep in mind that these commands may differ depending on your Linux distribution and network manager. You may need to consult the documentation for your specific distribution and network manager for more detailed instructions.