Configure DNS settings

To enable name resolution, you need to configure your Linux system to use DNS servers. To do this in Ubuntu, open the /etc/network/interfaces configuration file in a text editor:

etc network interfaces configuration file

This file is used to configure your network settings manually. The first Ethernet interface is usually identified as eth0. To configure a DNS server, add the dns-nameservers IP_ADDRESS line under the eth0 configuration:

dns nameservers

The line dns-nameservers 8.8.8.8 sets up a DNS server with the IP address of 8.8.8.8 as our DNS server (it is a public DNS server from Google). To configure multiple DNS servers, just add spaces between them: dns-nameservers IP_ADDRESS1 IP_ADDRESS2 IP_ADDRESS3

Save the file and exit. Run the sudo ifdown eth0 and sudo ifup eth0 commands to apply the changes:

ifdown ifup

You can test the DNS name resolution process by pinging a hostname:

test dns resolution

Subscribe to our Newsletter

Like us on Facebook

top
Geek University 2019