Temporary or permanent DNS modification in Linux

Source: Internet
Author: User
Tags nameserver

Linux temporary or permanent DNS modification recently reinstalls the system for VPS. Because the service provider does not provide DHCP, You have to manually set the IP address and DNS Server. Sadly, when the system was reinstalled, it forgot to enter the DNS Server. Finally, after entering the system, various domain names could not be resolved. There are two ways to modify DNS in Linux: temporary modification and Permanent modification. 1. Temporarily modify the nic dns address sudo vim/etc/resolv. change the conf file to the following content: nameserver 8.8.8.8 # change it to your primary DNSnameserver 8.8.8.4.4 # change it to your backup DNSsearch localhost # your domain name I used Google's DNS resolution server here. After modification: if wq exits, the configuration will take effect in real time, but the configuration may be lost after the system is restarted. In fact, when editing this file, you should also be able to see the comment "Do not manually edit" in the file header. 2. permanently modify the nic dns sudo-icd/etc/resolvconf/resolv. conf. dvim base to add the following content: nameserver 8.8.8.8nameserver 8.8.4.4: wq save and exit, so that the settings will not be lost after restart. In fact, your cat head file will find the comments in the image's header, which is not hard to guess resolv. the conf file is based on/etc/resolvconf/resolv. conf. d directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.