Wednesday, March 5, 2008

How to set the DNS on linux having multiple eth

You have to edit resolv.conf with your favorite text editor, mine is nano.
First you might want to backup your existing file.
To back up, just do this
$cp /etc/resolv.conf /etc/resolv.conf.bak

$ nano /etc/resolv.conf

Replace anything in it. Dont forget to back up first.
The format would be
nameserver $DNS$

e.g
nameserver 192.168.0.1

if you have multiple dns that you would like to define, then just append it to the next line.

e.g

nameserver 192.168.0.1
nameserver 192.168.1.1

save it and exit the editor
(in nano you can exit and save it by pressing ctrl+o, then you will be ask of the filename, just press enter, then press ctrl+x to exit the editor)

Then last is to restart the network

$service network restart

Check if it works for you, try to ping other pc on your network else if you are trying your linux to connect to internet try to ping www.google.com

$
ping www.google.com

End of my notes....