Home > Computer Tutorials > Computer Knowledge > Centos7 system configuration DNS service

Centos7 system configuration DNS service

WBOY
Release: 2024-02-19 19:40:22
forward
1146 people have browsed it

Centos7 system configuration DNS service

There are many different ways to configure DNS services in CentOS 7 systems. This article will introduce the two most common methods: using NetworkManager and using the resolv.conf file.

Use NetworkManager to configure DNS service

NetworkManager is a common network manager that can help users manage system network configuration. The following are the steps to configure DNS service using NetworkManager:

  1. Open the NetworkManager configuration file:

    $ sudo vi /etc/NetworkManager/NetworkManager.conf
    Copy after login
  2. Add the following content to the file:

    [main]dns=none[ipv4]dns-search=example.commethod=auto[ipv6]dns-search=example.commethod=auto
    Copy after login

    The above configuration means using NetworkManager to manage network settings, but disabling DNS settings. In addition, the default DNS search domain is configured as example.com.

  3. Restart the NetworkManager service:

    $ sudo systemctl restart NetworkManager
    Copy after login
  4. Confirm that the DNS service has been configured successfully:

    $ nmcli dev show | grep DNS
    Copy after login

    The output should contain the configured DNS search domains and DNS servers.

Use the resolv.conf file to configure the DNS service

The resolv.conf file is the most common method used to configure DNS services. Here are the steps to configure the DNS service using the resolv.conf file:

  1. Open the resolv.conf file:

    $ sudo vi /etc/resolv.conf
    Copy after login
  2. Add the following content to the file:

    nameserver 8.8.8.8nameserver 8.8.4.4
    Copy after login

    The above configuration uses Google public DNS server as the default DNS server.

  3. Save and close the file.
  4. Confirm that the DNS service has been configured successfully:

    $ nslookup example.com
    Copy after login

    If the domain name can be successfully resolved, the DNS service has been configured successfully.

In short, the above two methods are commonly used methods to configure DNS services on CentOS 7 systems. Users can choose one of the methods for configuration according to their own needs.

The above is the detailed content of Centos7 system configuration DNS service. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:mryunwei.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template