To configure DNS names in Linux, you need to edit the /etc/resolv.conf file, which contains information about the DNS servers that the system should use to resolve domain names.
Here are the steps to configure DNS names in Linux:
Open the /etc/resolv.conf file in a text editor with root privileges. For example, you can use the following command in a terminal:
sudo nano /etc/resolv.conf
Add one or more DNS server IP addresses to the file using the following format:
nameserver <DNS server IP address>
Replace <DNS server IP address> with the actual IP address of the DNS server. For example, if you want to use the Google Public DNS servers, you would add the following lines to the file:
nameserver 8.8.8.8 nameserver 8.8.4.4Optionally, you can also add a search domain to the file using the following format:
search <domain name>
Replace <domain name> with the actual domain name that you want to use as the default search domain. For example, if you want to use the domain name example.com as the default search domain, you would add the following line to the file:
search example.com
Save the changes to the /etc/resolv.conf file and exit the text editor.
Once you have configured the DNS names in the /etc/resolv.conf file, the system will use the specified DNS servers to resolve domain names to IP addresses. You can test the configuration by using the ping or nslookup command with a domain name to verify that the system is able to resolve the domain name to an IP address.
Comments
Post a Comment