How do you change your DNS settings in Linux/Windows?

in linux •  7 years ago 

If you did not catch my post of information security job interview questions, you might want to give it a quick glance. While the majority of questions are security oriented, it really is a helpful list for anyone interviewing for a tech position. Understand that these are interview questions, so some of them may or may not be obviously trick questions to you.


How do you change your DNS settings in Linux?

In my opinion, changing DNS settings the Linux way is much easier than the traditional Windows way. The file you are looking to edit is usually the /etc/resolv.conf file.

  1. open a terminal
  2. use nano (or vi) to edit /etc/resolv.conf
  3. add a line of "nameserver x.x.x.x" with x.x.x.x being the IP address of your DNS server.
  4. save the file and you're done


How do you change your DNS settings in Windows?

In Windows, there are a few ways of changing DNS settings (as if there were not more than one way on Linux). The traditional way is to simply use the GUI to navigate to the IPv4 settings. Another method that is becoming more common is to just change it with powershell.

GUI Method

  1. Navigate to Control Panel -> Network and Sharing Center -> Change adapter settings
  2. Right-click on the adapter you want to configure and select 'properties.'
  3. Double-Click on TCP/IPv4 
  4. Change the DNS settings to the server(s) you want, and apply your changes.

PowerShell 

  1. Run powershell as administrator
  2. Use the Set-DnsClientServerAddress cmdlet. Be sure to specify the appropriate interface index and server addresses
PS C:\> Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses ("10.0.0.1","10.0.0.2")


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi. I am a volunteer bot for @resteembot that upvoted you.
Your post was chosen at random, as part of the advertisment campaign for @resteembot.
@resteembot is meant to help minnows get noticed by re-steeming their posts
Even better: If your reputation is lower than 28 re-steeming only costs 0.001 SBD!
If you want to learn more - read the introduction post of @resteembot.
If you want help spread the word - read the advertisment program post.