Set DNS server in CentOS 7

Source: Internet
Author: User

Set DNS server in CentOS 7

In CentOS 7, manually set the DNS in/etc/resolv. conf. After a while, the system will overwrite or clear the DNS. Different from setting DNS in CentOS 6, there are several methods: 1. Use the new command line tool nmcli to set

# Display the current network connection # nmcli connection showNAME uuid type DEVICEeno1 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eno1 # modify the DNS server corresponding to the current network connection, the network connection here can be identified by the name or UUID # nmcli con mod eno1 ipv4.dns "114.114.114.114 8.8.8.8" # apply the dns configuration # nmcli con up eno1

2. manually modify/etc/resolv. conf using the traditional method.

  • Modify the/etc/NetworkManager. conf file and add the "dns = none" option in the main section:
[Main] plugins = ifcfg-rhdns = none
  • NetworkManager reload the configuration modified above
# Systemctl restart NetworkManager. service
  • Manually modify/etc/resolv. conf
Nameserver 114.114.114.114nameserver 8.8.8.8

For details, see:

# Man NetworkManager. conf # man nmcli

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.