Unix (Linux and *BSD) » Networking
How can I edit the DNS entries in Linux or BSD?
Both Linux and BSD have a file that lists one name server per line for your computer to resolve domain names. Please note that you need to set your DNS servers only if you don't use DHCP to connect to the Internet, in other words, if you have a fixed IP address such as 192.168.0.2 in your home network, then this tutorial will help you. If you don't define a specific IP address for your NIC, then you don't have to worry about configuring your DNS. Configuring your DNS means basically pasting 2 IP addresses into a file and saving.
Prior to editing this file, you need to find out what the name servers of your ISP are. To find out, you have 3 possibilities:
- Connect to the Internet using DHCP, and have a look at the content of your /etc/resolv.conf file using the command cat /etc/resolv.conf
- Ask a friend of yours who uses Unix and who uses the same ISP as you
- Call the tech support of your ISP and ask for the 2 name servers or ask for the DNS so that you can set up your network
Once you have the 2 IP addresses, log in as root and issue the following commands:
On BSD:
ee /etc/resolv.conf
On Linux:
nano -w /etc/resolv.conf
And add the DNS entries in your file, for instance:
nameserver 201.10.120.2 nameserver 201.10.128.3
Now save, and let's see if your network is properly configured. Open your terminal and issue:
ping 201.239.39.104
You should see on your screen a new line per second showing the time it took for your packet to go back and forth from your computer to the remote machine. If you get a "Destination Host Unreachable" message, you first need to set up your network prior to configuring your DNS.
Then let's see if your DNS are properly set up. Issue in your terminal:
ping google.com
Again, you should see on your screen a new line per second showing the time it took for your packet to go back and forth from your computer to the remote machine. If you get a "Destination Host Unreachable" message, you but if in the previous test worked fine, your DNS are not properly configured. Make sure your /etc/resolv.conf file is saved with the correct name servers. If you pass this test, you can access the Internet normally, using a web browser for instance.
Tags: -
Related entries:
Last update: 2008-09-01 06:09
Author: Charles A. Landemaine
Revision: 1.1
You cannot comment on this entry
Comment of XtAwbTfcjMI:
Keep on writing and chguigng away!
Added at: 2011-09-27 20:29
Comment of RMcOmXsMZTHoqnH:
sqLoUS lnhxqkviubwx
Added at: 2011-09-28 08:31
Comment of GogSYZEYfRv:
tDq2GJ , [url=http://fmechlgugvsh.com/]fmechlgugvsh[/url], [link=http://qbrtfhnbanez.com/]qbrtfhnbanez[/link], http://xjkjlqidinkx.com/
Added at: 2011-09-30 09:17
Comment of nfOgAIjXVaMLH:
hSbNib , [url=http://chsapbdyzonn.com/]chsapbdyzonn[/url], [link=http://svjwpfgmjwbk.com/]svjwpfgmjwbk[/link], http://bkbymqmxcoaw.com/
Added at: 2011-10-05 05:38