How To Setup Change Edit DNS Nameservers Linux Command Shell

Forums » Linux Systems » How To Setup Change Edit DNS Nameservers Linux Command Shell
This Page Contains information about How To Setup Change Edit DNS Nameservers Linux Command Shell By wallpaperama in category Linux Systems with 6 Replies. Last Upated: Thu May 15, 2014
the file to chanage or edit your nameservers in debian is this one:

cat /etc/resolv.conf

for example if i wanted to change my nameservers for my server to be these two:
206.12.23.13
206.12.24.13

i would send this command:
nano /etc/resolv.conf


now i would make change the contents to look something like this:

search
nameserver 206.12.23.13
nameserver 206.12.24.13


now save the file and restart your network

/etc/init.d/networking restart


if you need to change hostname, you can follow this link:

Next: Set Hostname
Champ
Kiran
to save file ":wq". generally i use this command :wq in vi editor not sure if it works in nano editor too. but you should give a try.

kiran
nikhil
hey buddy nice post.....but you can also refer this link to do it graphically techviolation /how-to-change-dns-server-settings/
taulant
is really necessary to restart the network?
just
To save a file in nano you use CTRL X. Make sure you use 'sudo nano /etc/resolv.conf' So you can save the file with out the permission denied error message.
FuzzyGhost
- at - Just - CTRL+X exits NANO, not saves. That would be CTRL+O.

I'm wanting to know how to perform this operation permanently. The moment you restart/shutdown, you will have to edit resolv.conf again.
n!kon
Assuming you're using a static IP address, edit /etc/network/interfaces to include the DNS server information.

For example, eth0 would read like this (using openDNS):

iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 208.67.222.222 208.67.220.220

save the file, then either restart the interface (ifdown eth0 && ifup eth0) or the computer.


Title: How To Setup Change Edit DNS Nameservers Linux Command Shell [2953]
Tags: how to setup change edit dns nameservers linux command shell
By
Comments 6
Visits 33737