CentOS 7 Settings DNS method differs from previous version

Source: Internet
Author: User

In CentOS 7, manually set the DNS in the/etc/resolv.conf, after a while, found to be re-overwritten or removed by the system. Unlike the setup DNS method under CentOS 6, there are several ways:

1, use the new command line tool NMCLI to set

#显示当前网络连接 #nmcli Connection showname UUID                                 TYPE           DEVICEeno1 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3- Ethernet eno1# Modify the DNS server for the current network connection, where the network connection can be identified by name or UUID #nmcli con mod eno1 ipv4.dns "114.114.114.114 8.8.8.8" #将dns配置生效 # Nmcli con up Eno1

2, the use of traditional methods, manual modification/etc/resolv.conf

    • Modify the/etc/networkmanager/networkmanager.conf file and add the "dns=none" option in the main section:
[Main]plugins=ifcfg-rhdns=none
    • NetworkManager re-loading the configuration modified above
# systemctl Restart Networkmanager.service
    • Manual modification/etc/resolv.conf
NameServer 114.114.114.114nameserver 8.8.8.8

See MORE:

# man NetworkManager.conf# man nmcli

CentOS 7 Settings DNS method differs from previous version

Related Article

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.