Mac command line configuration DNS related actions

Source: Internet
Author: User
List all network connection modes
Networksetup-listallnetworkservices

The results are as follows:
sets the DNS server for the specified network connection mode

Networksetup-setdnsservers Wi-Fi 8.8.8.8

Where Wi-Fi refers to your current network name. Not the WiFi name, but the way the network links are listed in the first command, or viewed with a Mac, the name indicated by the following figure arrow.

And 8.8.8.8 is the DNS you want to set up. Check the current DNS settings

Networksetup-getdnsservers Wi-Fi

If you have not set up any DNS, you will be prompted as follows:
empty the current DNS settings

Networksetup-setdnsservers Wi-Fi empty
Emptying the DNS cache
Dscacheutil-flushcache

The server that resolves the corresponding domain name to the IP address is the DNS server. The biggest symptom of DNS resolution failure is that the IP address of the site is not a problem, but accessing his domain name will cause errors. That is, you know that a Web site's IP address can be opened directly in the browser, and you enter its domain name can not be opened. When a computer accesses a domain name, it does not need to seek help from the DNS server for each visit, typically when the resolution is completed once, the resolution entry is saved in the computer's DNS cache list, and if DNS resolution changes, the DNS cache list information is not changed. When the computer accesses the domain name, it still does not connect to the DNS server to obtain the most recent resolution information and resolves it based on the cached correspondence stored on its own computer, which can cause DNS resolution failures

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.