Mac OS routing DNS settings and viewing commands

Source: Internet
Author: User

Set route command

In Mac OS X, the commands for setting up routes are slightly different:

The code is as follows Copy Code

Route-n Add Defalut 10.13.31.1
Route-n add-net 10.0.0.0/8 10.13.31.1
Route-n add-net 210.32.0.0/20 10.13.31.1
Route-n add-net 222.205.0.0/17 10.13.31.1

Prompt routing exists can be deleted by the following method and then added

The code is as follows Copy Code

Route-n Delete Defalut 10.13.31.1

View routes (route)

Very simply, a command can be viewed

The code is as follows Copy Code

Netstat–nr

Setting DNS Commands

The code is as follows Copy Code

Networksetup-listallnetworkservices

Get all interfaces (interfaces).

The code is as follows Copy Code

networksetup-setdnsservers {INTERFACE NAME} {YOUR DNS SERVER}

Set up DNS.

The code is as follows Copy Code

networksetup-setdnsservers {INTERFACE NAME} {YOUR DNS server} {YOUR DNS server}

If you have more than one DNS, separate them with spaces.

You can then use Ifconfig to view the changes.

Never found the MAC command line configuration DNS method

Today's special discovery, recorded:

List all network connection modes

The code is as follows Copy Code

Networksetup-listallnetworkservices

Sets the DNS server for the specified network connection mode

The code is as follows Copy Code

sudo networksetup-setdnsservers AirPort 192.168.10.200

Emptying the DNS cache

  code is as follows copy code

Dscacheutil –flushcache

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.